tpmkms_4wp 9.3.0-beta.52 → 9.3.0-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/common/animals.js +1 -4
  2. package/common/animals.test.json +1607 -1
  3. package/common/articles.js +1 -5
  4. package/common/asking.js +3 -3
  5. package/common/avatar.js +1 -3
  6. package/common/characters.js +1 -3
  7. package/common/colors.instance.json +0 -28
  8. package/common/colors.js +1 -3
  9. package/common/comparable.js +1 -3
  10. package/common/concept.js +1 -4
  11. package/common/conjunction.js +2 -6
  12. package/common/countable.js +1 -15
  13. package/common/crew.js +1 -3
  14. package/common/currency.js +1 -4
  15. package/common/dateTimeSelectors.js +1 -18
  16. package/common/dates.instance.json +0 -84
  17. package/common/dates.js +1 -17
  18. package/common/dialogues.js +3 -3
  19. package/common/dimension.js +2 -4
  20. package/common/edible.instance.json +0 -56
  21. package/common/edible.js +1 -3
  22. package/common/emotions.js +1 -3
  23. package/common/errors.js +1 -0
  24. package/common/evaluate.js +1 -3
  25. package/common/events.js +1 -4
  26. package/common/fastfood.instance.json +691 -247
  27. package/common/fastfood.js +2 -6
  28. package/common/formulas.js +1 -1
  29. package/common/gdefaults.js +1 -4
  30. package/common/help.js +1 -3
  31. package/common/helpers.js +16 -73
  32. package/common/hierarchy.js +1 -4
  33. package/common/javascript.js +1 -4
  34. package/common/kirk.js +1 -4
  35. package/common/length.js +1 -4
  36. package/common/listener.js +1 -1
  37. package/common/math.js +1 -4
  38. package/common/menus.js +1 -1
  39. package/common/meta.js +1 -4
  40. package/common/nameable.js +1 -1
  41. package/common/negation.js +1 -3
  42. package/common/numbers.js +1 -4
  43. package/common/ordering.js +1 -4
  44. package/common/ordinals.js +1 -4
  45. package/common/people.instance.json +0 -36
  46. package/common/people.js +1 -4
  47. package/common/percentages.js +1 -4
  48. package/common/percentages.test.json +57 -11
  49. package/common/pipboy.instance.json +0 -56
  50. package/common/pipboy.js +1 -1
  51. package/common/pokemon.js +1 -4
  52. package/common/pos.js +1 -3
  53. package/common/pressure.js +1 -3
  54. package/common/properties.js +1 -11
  55. package/common/punctuation.js +1 -3
  56. package/common/reminders.instance.json +4 -0
  57. package/common/reminders.js +1 -1
  58. package/common/reports.instance.json +1 -1
  59. package/common/reports.js +1 -3
  60. package/common/scorekeeper.js +1 -3
  61. package/common/sdefaults.js +1 -3
  62. package/common/self.js +1 -3
  63. package/common/sizeable.js +1 -3
  64. package/common/spock.js +1 -3
  65. package/common/stgame.js +1 -3
  66. package/common/stm.js +1 -1
  67. package/common/tell.js +1 -3
  68. package/common/temperature.js +1 -3
  69. package/common/time.js +1 -9
  70. package/common/time.test.json +73 -119
  71. package/common/tokenize.js +1 -3
  72. package/common/ui.js +1 -1
  73. package/common/weight.js +1 -3
  74. package/common/wp.instance.json +73 -41
  75. package/common/wp.js +1 -3
  76. package/common/yesno.js +1 -3
  77. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  const { knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck, propertyToArray } = require('./helpers')
2
+ const { defaultObjectCheck, defaultContextCheck, propertyToArray } = require('./helpers')
3
3
  const edible = require('./edible')
4
4
  const events = require('./events')
5
5
  const sizeable = require('./sizeable')
@@ -995,11 +995,7 @@ knowledgeModule( {
995
995
  { property: 'quantity', filter: ['marker', 'value', 'text' ] },
996
996
  { property: 'pieces', filter: ['marker', 'value', 'text' ] },
997
997
  ],
998
- context: [
999
- ...defaultContextCheck(),
1000
- // TODO some kind of conditional selector { match: (value) => value.marker == 'count', filter: ['marker', 'value', 'text'] },
1001
- { property: 'comboNumber', filter: ['marker', 'value', 'text' ] },
1002
- ],
998
+ ...defaultContextCheck(['comboNumber']),
1003
999
  },
1004
1000
  },
1005
1001
  template: {
@@ -207,7 +207,7 @@ knowledgeModule({
207
207
  objects: [
208
208
  'formulas',
209
209
  ],
210
- context: defaultContextCheck(),
210
+ ...defaultContextCheck(),
211
211
  }
212
212
  },
213
213
  })
@@ -264,9 +264,6 @@ knowledgeModule({
264
264
  test: {
265
265
  name: './gdefaults.test.json',
266
266
  contents: gdefaults_tests,
267
- checks: {
268
- context: defaultContextCheck(),
269
- },
270
-
267
+ checks: defaultContextCheck(),
271
268
  },
272
269
  })
package/common/help.js CHANGED
@@ -102,8 +102,6 @@ knowledgeModule({
102
102
  test: {
103
103
  name: './help.test.json',
104
104
  contents: help_tests,
105
- checks: {
106
- context: defaultContextCheck(),
107
- },
105
+ checks: defaultContextCheck(),
108
106
  },
109
107
  })
package/common/helpers.js CHANGED
@@ -151,82 +151,25 @@ const toEValue = (context) => {
151
151
  return context;
152
152
  }
153
153
 
154
- const defaultContextCheckValidify = (properties) => {
155
- return // new way
156
- for (const value of properties) {
157
- if (typeof value == 'string') {
158
- continue
159
- }
160
- if (typeof value.property == 'string' && value.filter) {
161
- continue
162
- }
163
- throw new Error("Expected the <checks> argument to defaultContextCheck to be a list of <property> or { property: <property>, filter: <checks> }. Where <property> is a string.")
164
- }
165
- }
166
-
167
- const defaultContextCheckProperties = ['marker', 'text', 'verbatim', 'isResponse', 'types', { property: 'response', filter: ['marker', 'text', 'verbatim'] }]
168
-
169
- const expand_checks = (properties, variables = {}) => {
170
- let expanded = []
171
- if (properties == 'defaults') {
172
- return defaultContextCheckProperties
173
- }
174
- if (properties.variable) {
175
- return variables[properties.variable]
176
- }
177
- if (Array.isArray(properties)) {
178
- for (const property of properties) {
179
- defaultContextCheckValidify(properties)
180
- if (typeof property == 'string') {
181
- expanded.push({ property, filter: defaultContextCheckProperties })
182
- } else if (property.property && property.filter) {
183
- expanded.push({ property: property.property, filter: [defaultContextCheckProperties, ...expand_checks(property.filter, variables)] })
184
- } else {
185
- expanded = [...expanded, ...expand_checks(property, variables)]
186
- }
187
- }
188
- return expanded
189
- }
190
- for (const key of Object.keys(properties)) {
191
- if (key === '_') {
192
- expanded = [...expanded, ...defaultContextCheckProperties]
193
- } else {
194
- expanded.push({ property: key, filter: [...expand_checks(properties[key], variables)] })
195
- }
154
+ const defaultObjectCheck = (extra = []) => {
155
+ return {
156
+ objects: [
157
+ {
158
+ match: ({objects}) => true,
159
+ apply: () => extra
160
+ },
161
+ ],
196
162
  }
197
- return expanded
198
-
199
163
  }
200
164
 
201
- const defaultContextCheck = (properties = [], variables={}, minimal=false) => {
202
- defaultContextCheckValidify(properties)
203
- variables.defaults = defaultContextCheckProperties
204
- if (minimal) {
205
- return expand_checks(properties, variables)
206
- } else {
207
- return [
208
- ...defaultContextCheckProperties,
209
- // ...properties.map((property) => { return { property, filter: defaultContextCheckProperties } }),
210
- ...expand_checks(properties, variables),
211
- (object) => {
212
- if (typeof object.value == 'object') {
213
- return { property: 'value', filter: defaultContextCheckProperties }
214
- } else {
215
- return 'value'
216
- }
217
- },
218
- (object) => {
219
- if (!Array.isArray(object.modifiers)) {
220
- return
221
- }
222
- if (typeof object.modifiers[0] == 'object') {
223
- return { property: 'modifiers', filter: defaultContextCheckProperties }
224
- } else {
225
- return 'modifiers'
226
- }
165
+ const defaultContextCheck = (extra = []) => {
166
+ return {
167
+ context: [
168
+ {
169
+ match: ({context}) => !Array.isArray(context),
170
+ apply: () => ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra],
227
171
  },
228
- { property: 'modifiers', isPropertyList: true, filter: defaultContextCheckProperties }
229
- ]
172
+ ],
230
173
  }
231
174
  }
232
175
 
@@ -319,7 +262,7 @@ module.exports = {
319
262
  pushL,
320
263
  getValue,
321
264
  defaultContextCheck,
322
- defaultContextCheckProperties,
265
+ defaultObjectCheck,
323
266
  toEValue,
324
267
  millisecondsUntilHourOfDay,
325
268
  indent,
@@ -305,10 +305,7 @@ knowledgeModule( {
305
305
  // TODO doesnt this need the KM
306
306
  checks: {
307
307
  objects: ['children', 'concept', 'parents', 'properties'],
308
- checks: {
309
- context: defaultContextCheck(),
310
- },
311
-
308
+ ...defaultContextCheck(),
312
309
  },
313
310
  includes: {
314
311
  words: true,
@@ -72,9 +72,6 @@ knowledgeModule( {
72
72
  test: {
73
73
  name: './javascript.test.json',
74
74
  contents: javascript_tests,
75
- checks: {
76
- context: defaultContextCheck(),
77
- },
78
-
75
+ checks: defaultContextCheck(),
79
76
  },
80
77
  })
package/common/kirk.js CHANGED
@@ -26,10 +26,7 @@ knowledgeModule( {
26
26
  test: {
27
27
  name: './kirk.test.json',
28
28
  contents: kirk_tests,
29
- checks: {
30
- context: defaultContextCheck(),
31
- },
32
-
29
+ checks: defaultContextCheck(),
33
30
  },
34
31
  template: {
35
32
  template,
package/common/length.js CHANGED
@@ -45,10 +45,7 @@ knowledgeModule({
45
45
  test: {
46
46
  name: './length.test.json',
47
47
  contents: length_tests,
48
- checks: {
49
- context: defaultContextCheck(),
50
- },
51
-
48
+ checks: defaultContextCheck(),
52
49
  },
53
50
  template: {
54
51
  template,
@@ -41,7 +41,7 @@ knowledgeModule( {
41
41
  name: './listener.test.json',
42
42
  contents: listener_tests,
43
43
  checks: {
44
- context: defaultContextCheck(),
44
+ ...defaultContextCheck(),
45
45
  objects: ['mentioned', { km: 'gdefaults' }],
46
46
  },
47
47
  },
package/common/math.js CHANGED
@@ -123,9 +123,6 @@ knowledgeModule( {
123
123
  test: {
124
124
  name: './math.test.json',
125
125
  contents: tests,
126
- checks: {
127
- context: defaultContextCheck(),
128
- },
129
-
126
+ checks: defaultContextCheck(),
130
127
  },
131
128
  })
package/common/menus.js CHANGED
@@ -251,7 +251,7 @@ knowledgeModule({
251
251
  fixtures,
252
252
  checks: {
253
253
  objects: ['move', 'select', 'unselect', 'cancel', 'stop', 'show', 'menuDefs', 'close'],
254
- context: defaultContextCheck(['operator', 'direction', 'moveable']),
254
+ ...defaultContextCheck(['operator', 'direction', 'moveable']),
255
255
  },
256
256
  },
257
257
  template: {
package/common/meta.js CHANGED
@@ -392,10 +392,7 @@ knowledgeModule({
392
392
  include: {
393
393
  words: true,
394
394
  },
395
- checks: {
396
- context: defaultContextCheck(),
397
- },
398
-
395
+ checks: defaultContextCheck(),
399
396
  },
400
397
  template: {
401
398
  template,
@@ -134,7 +134,7 @@ knowledgeModule( {
134
134
  name: './nameable.test.json',
135
135
  contents: nameable_tests,
136
136
  checks: {
137
- context: [...defaultContextCheck(), 'pullFromContext'],
137
+ ...defaultContextCheck(['pullFromContext']),
138
138
  objects: ['mentioned', { km: 'stm' }],
139
139
  },
140
140
  include: {
@@ -35,9 +35,7 @@ knowledgeModule( {
35
35
  test: {
36
36
  name: './negation.test.json',
37
37
  contents: negation_tests,
38
- checks: {
39
- context: defaultContextCheck(),
40
- },
38
+ checks: defaultContextCheck(),
41
39
  },
42
40
  })
43
41
 
package/common/numbers.js CHANGED
@@ -111,9 +111,6 @@ knowledgeModule( {
111
111
  test: {
112
112
  name: './numbers.test.json',
113
113
  contents: numbers_tests,
114
- checks: {
115
- context: defaultContextCheck(),
116
- },
117
-
114
+ checks: defaultContextCheck(['instance'])
118
115
  },
119
116
  })
@@ -120,10 +120,7 @@ knowledgeModule( {
120
120
  name: './ordering.test.json',
121
121
  heck: ['children', 'concept', 'parents', 'properties'],
122
122
  contents: ordering_tests,
123
- checks: {
124
- context: defaultContextCheck(),
125
- },
126
-
123
+ checks: defaultContextCheck(),
127
124
  },
128
125
  template: {
129
126
  template,
@@ -59,9 +59,6 @@ knowledgeModule( {
59
59
  test: {
60
60
  name: './ordinals.test.json',
61
61
  contents: ordinals_tests,
62
- checks: {
63
- context: defaultContextCheck(),
64
- },
65
-
62
+ checks: defaultContextCheck(),
66
63
  },
67
64
  })
@@ -8430,24 +8430,6 @@
8430
8430
  0
8431
8431
  ]
8432
8432
  ],
8433
- [
8434
- [
8435
- "by",
8436
- 0
8437
- ],
8438
- [
8439
- "isEd",
8440
- 0
8441
- ],
8442
- [
8443
- "owned",
8444
- 0
8445
- ],
8446
- [
8447
- "unknown",
8448
- 0
8449
- ]
8450
- ],
8451
8433
  [
8452
8434
  [
8453
8435
  "isEd",
@@ -8846,24 +8828,6 @@
8846
8828
  0
8847
8829
  ]
8848
8830
  ],
8849
- [
8850
- [
8851
- "by",
8852
- 0
8853
- ],
8854
- [
8855
- "isEd",
8856
- 0
8857
- ],
8858
- [
8859
- "owned",
8860
- 0
8861
- ],
8862
- [
8863
- "unknown",
8864
- 0
8865
- ]
8866
- ],
8867
8831
  [
8868
8832
  [
8869
8833
  "first",
package/common/people.js CHANGED
@@ -70,10 +70,7 @@ knowledgeModule( {
70
70
  test: {
71
71
  name: './people.test.json',
72
72
  contents: people_tests,
73
- checks: {
74
- context: defaultContextCheck(),
75
- },
76
-
73
+ checks: defaultContextCheck(),
77
74
  },
78
75
  template: {
79
76
  template,
@@ -45,9 +45,6 @@ knowledgeModule( {
45
45
  test: {
46
46
  name: './percentages.test.json',
47
47
  contents: percentages_tests,
48
- checks: {
49
- context: [...defaultContextCheck(), { property: 'scale', filter: ['marker', 'word', 'value'] }],
50
- },
51
-
48
+ checks: defaultContextCheck(['scale'])
52
49
  },
53
50
  })
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "contexts": [
18
18
  {
19
+ "context_id": 2,
19
20
  "context_index": 1,
20
21
  "dead": true,
21
22
  "level": 1,
@@ -87,6 +88,8 @@
87
88
  ]
88
89
  },
89
90
  "objects": {
91
+ "associations": [
92
+ ],
90
93
  "nameToUUID": {
91
94
  "gdefaults": "gdefaults2",
92
95
  "numbers": "numbers2",
@@ -96,19 +99,25 @@
96
99
  },
97
100
  "namespaced": {
98
101
  "gdefaults2": {
102
+ "km": "gdefaults2"
99
103
  },
100
104
  "numbers2": {
105
+ "km": "numbers2"
101
106
  },
102
107
  "percentages1": {
108
+ "km": "percentages1"
103
109
  },
104
110
  "sdefaults2": {
111
+ "km": "sdefaults2"
105
112
  },
106
113
  "tokenize2": {
114
+ "km": "tokenize2"
107
115
  }
108
116
  },
109
117
  "processed": [
110
118
  {
111
119
  "context": {
120
+ "context_id": 2,
112
121
  "context_index": 1,
113
122
  "dead": true,
114
123
  "level": 1,
@@ -141,9 +150,12 @@
141
150
  "value": "percent",
142
151
  "word": "percent"
143
152
  },
144
- "generatedParenthesized": "",
145
- "paraphrases": "10 percent",
146
- "paraphrasesParenthesized": "(10 percent)",
153
+ "generatedParenthesized": [
154
+ ],
155
+ "paraphrases": [
156
+ ],
157
+ "paraphrasesParenthesized": [
158
+ ],
147
159
  "responses": [
148
160
  ""
149
161
  ]
@@ -250,6 +262,7 @@
250
262
  },
251
263
  "contexts": [
252
264
  {
265
+ "context_id": 2,
253
266
  "context_index": 1,
254
267
  "dead": true,
255
268
  "level": 1,
@@ -321,6 +334,8 @@
321
334
  ]
322
335
  },
323
336
  "objects": {
337
+ "associations": [
338
+ ],
324
339
  "nameToUUID": {
325
340
  "gdefaults": "gdefaults2",
326
341
  "numbers": "numbers2",
@@ -330,19 +345,25 @@
330
345
  },
331
346
  "namespaced": {
332
347
  "gdefaults2": {
348
+ "km": "gdefaults2"
333
349
  },
334
350
  "numbers2": {
351
+ "km": "numbers2"
335
352
  },
336
353
  "percentages1": {
354
+ "km": "percentages1"
337
355
  },
338
356
  "sdefaults2": {
357
+ "km": "sdefaults2"
339
358
  },
340
359
  "tokenize2": {
360
+ "km": "tokenize2"
341
361
  }
342
362
  },
343
363
  "processed": [
344
364
  {
345
365
  "context": {
366
+ "context_id": 2,
346
367
  "context_index": 1,
347
368
  "dead": true,
348
369
  "level": 1,
@@ -375,9 +396,12 @@
375
396
  "value": "percent",
376
397
  "word": "%"
377
398
  },
378
- "generatedParenthesized": "",
379
- "paraphrases": "10%",
380
- "paraphrasesParenthesized": "(10%)",
399
+ "generatedParenthesized": [
400
+ ],
401
+ "paraphrases": [
402
+ ],
403
+ "paraphrasesParenthesized": [
404
+ ],
381
405
  "responses": [
382
406
  ""
383
407
  ]
@@ -512,6 +536,7 @@
512
536
  },
513
537
  "contexts": [
514
538
  {
539
+ "context_id": 2,
515
540
  "context_index": 1,
516
541
  "dead": true,
517
542
  "default": true,
@@ -563,13 +588,16 @@
563
588
  "percentages#call2"
564
589
  ],
565
590
  "value": {
591
+ "context_id": 2,
566
592
  "context_index": 1,
567
593
  "dead": true,
568
594
  "default": true,
569
595
  "evalue": {
570
596
  "edefault": true,
571
- "evalue": 110,
597
+ "evalue": 11,
572
598
  "instance": true,
599
+ "isModule": true,
600
+ "isProcess": true,
573
601
  "level": 0,
574
602
  "marker": "integer",
575
603
  "range": {
@@ -587,6 +615,8 @@
587
615
  "word": null
588
616
  },
589
617
  "instance": true,
618
+ "isModule": true,
619
+ "isProcess": true,
590
620
  "isReponse": true,
591
621
  "isResponse": true,
592
622
  "level": 1,
@@ -728,6 +758,8 @@
728
758
  ]
729
759
  },
730
760
  "objects": {
761
+ "associations": [
762
+ ],
731
763
  "nameToUUID": {
732
764
  "gdefaults": "gdefaults2",
733
765
  "numbers": "numbers2",
@@ -737,19 +769,25 @@
737
769
  },
738
770
  "namespaced": {
739
771
  "gdefaults2": {
772
+ "km": "gdefaults2"
740
773
  },
741
774
  "numbers2": {
775
+ "km": "numbers2"
742
776
  },
743
777
  "percentages1": {
778
+ "km": "percentages1"
744
779
  },
745
780
  "sdefaults2": {
781
+ "km": "sdefaults2"
746
782
  },
747
783
  "tokenize2": {
784
+ "km": "tokenize2"
748
785
  }
749
786
  },
750
787
  "processed": [
751
788
  {
752
789
  "context": {
790
+ "context_id": 2,
753
791
  "context_index": 1,
754
792
  "dead": true,
755
793
  "default": true,
@@ -801,13 +839,16 @@
801
839
  "percentages#call2"
802
840
  ],
803
841
  "value": {
842
+ "context_id": 2,
804
843
  "context_index": 1,
805
844
  "dead": true,
806
845
  "default": true,
807
846
  "evalue": {
808
847
  "edefault": true,
809
- "evalue": 110,
848
+ "evalue": 11,
810
849
  "instance": true,
850
+ "isModule": true,
851
+ "isProcess": true,
811
852
  "level": 0,
812
853
  "marker": "integer",
813
854
  "range": {
@@ -825,6 +866,8 @@
825
866
  "word": null
826
867
  },
827
868
  "instance": true,
869
+ "isModule": true,
870
+ "isProcess": true,
828
871
  "isReponse": true,
829
872
  "isResponse": true,
830
873
  "level": 1,
@@ -894,9 +937,12 @@
894
937
  },
895
938
  "word": "of"
896
939
  },
897
- "generatedParenthesized": "(((11)))",
898
- "paraphrases": "10 percent of 110",
899
- "paraphrasesParenthesized": "(10 percent of 110)",
940
+ "generatedParenthesized": [
941
+ ],
942
+ "paraphrases": [
943
+ ],
944
+ "paraphrasesParenthesized": [
945
+ ],
900
946
  "responses": [
901
947
  "11"
902
948
  ]