tpmkms_4wp 8.9.1-beta.1 → 8.9.1-beta.10

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 (76) hide show
  1. package/common/animals.instance.json +195 -16
  2. package/common/articles.js +18 -2
  3. package/common/articles.test.json +338 -0
  4. package/common/asking.js +2 -2
  5. package/common/avatar.js +1 -1
  6. package/common/characters.js +1 -1
  7. package/common/colors.instance.json +210 -45
  8. package/common/comparable.instance.json +45 -0
  9. package/common/comparable.js +1 -1
  10. package/common/concept.js +1 -1
  11. package/common/conjunction.js +1 -1
  12. package/common/countable.js +2 -8
  13. package/common/countable.test.json +0 -586
  14. package/common/crew.instance.json +390 -0
  15. package/common/currency.js +2 -2
  16. package/common/dialogues.js +6 -4
  17. package/common/dimension.instance.json +11 -4
  18. package/common/dimension.js +2 -2
  19. package/common/edible.instance.json +352 -58
  20. package/common/emotions.instance.json +15 -0
  21. package/common/errors.js +3 -1
  22. package/common/events.js +1 -1
  23. package/common/fastfood.instance.json +2017 -402
  24. package/common/fastfood.js +3 -3
  25. package/common/formulas.instance.json +11 -1
  26. package/common/formulas.js +1 -1
  27. package/common/gdefaults.js +28 -17
  28. package/common/help.js +4 -4
  29. package/common/help.test.json +4 -4
  30. package/common/helpers/concept.js +3 -3
  31. package/common/helpers/conjunction.js +1 -1
  32. package/common/helpers/formulas.js +4 -4
  33. package/common/helpers/frankenhash.js +4 -4
  34. package/common/helpers/meta.js +4 -4
  35. package/common/helpers/ordering.js +2 -2
  36. package/common/helpers/properties.js +16 -16
  37. package/common/helpers.js +17 -1
  38. package/common/hierarchy.js +3 -3
  39. package/common/javascript.js +1 -1
  40. package/common/kirk.instance.json +15 -0
  41. package/common/length.instance.json +165 -20
  42. package/common/math.instance.json +11 -1
  43. package/common/math.js +1 -1
  44. package/common/meta.js +5 -5
  45. package/common/negation.js +1 -1
  46. package/common/numbers.js +1 -1
  47. package/common/ordering.instance.json +31 -71
  48. package/common/ordinals.js +5 -3
  49. package/common/people.instance.json +120 -0
  50. package/common/people.js +1 -1
  51. package/common/percentages.js +1 -1
  52. package/common/pipboy.instance.json +187 -46
  53. package/common/pipboy.js +1 -1
  54. package/common/pokemon.instance.json +195 -5
  55. package/common/pos.js +11 -1
  56. package/common/pressure.instance.json +44 -7
  57. package/common/properties.instance.json +15 -0
  58. package/common/properties.js +2 -2
  59. package/common/punctuation.js +1 -1
  60. package/common/reports.instance.json +32 -4
  61. package/common/reports.js +7 -7
  62. package/common/scorekeeper.js +5 -5
  63. package/common/sdefaults.js +2 -2
  64. package/common/sizeable.js +1 -1
  65. package/common/spock.instance.json +15 -0
  66. package/common/stm.js +6 -6
  67. package/common/tell.js +1 -1
  68. package/common/temperature.instance.json +44 -8
  69. package/common/tester.js +1 -1
  70. package/common/ui.instance.json +16 -1
  71. package/common/weight.instance.json +132 -16
  72. package/common/wp.instance.json +13996 -1532
  73. package/common/wp.js +150 -25
  74. package/common/wp.test.json +82657 -3824
  75. package/common/yesno.js +1 -1
  76. package/package.json +11 -6
package/common/reports.js CHANGED
@@ -49,7 +49,7 @@ const newReport = ({km, objects}) => {
49
49
  }
50
50
 
51
51
  const compareObject = (ordering) => (v1, v2) => {
52
- for (let order of ordering) {
52
+ for (const order of ordering) {
53
53
  c = compareValue(order[0], v1, v2)
54
54
  if (c == 0) {
55
55
  continue
@@ -110,7 +110,7 @@ const apiTemplate = (marker, testData) => {
110
110
  const api1 = apiTemplate('models', testData2)
111
111
  const api2 = apiTemplate('clothes', testData)
112
112
 
113
- let config = {
113
+ const config = {
114
114
  name: 'reports',
115
115
  operators: [
116
116
  //"(([type]) [([(<less> ([than]))] ([amount]))])",
@@ -301,9 +301,9 @@ let config = {
301
301
  "generatorr": async ({gp, context, apis, objects, config}) => {
302
302
  const reports = propertyToArray(context.report)
303
303
  let response = ''
304
- for (let report of reports) {
304
+ for (const report of reports) {
305
305
  if (report.number == 'many') {
306
- for (let reportId in objects.listings) {
306
+ for (const reportId in objects.listings) {
307
307
  if (reportId.startsWith('tempReport')) {
308
308
  continue
309
309
  }
@@ -452,10 +452,10 @@ let config = {
452
452
  const data = []
453
453
  for (const product of products) {
454
454
  const row = []
455
- for (let p of Object.keys(product)) {
455
+ for (const p of Object.keys(product)) {
456
456
  kms.stm.api.setVariable(p, { marker: p, value: product[p] })
457
457
  }
458
- for (let property of columns) {
458
+ for (const property of columns) {
459
459
  const value = toEValue(await e({ marker: property, value: property }));
460
460
  row.push(value)
461
461
  }
@@ -515,7 +515,7 @@ let config = {
515
515
  const id = report.value.value
516
516
  const listing = objects.listings[id]
517
517
  const values = propertyToArray(context.properties)
518
- for (let value of values) {
518
+ for (const value of values) {
519
519
  let column = value.marker
520
520
  if (value.marker == 'unknown') {
521
521
  column = value.value
@@ -25,7 +25,7 @@ const template = {
25
25
  }
26
26
 
27
27
  const setPlayers = (objects, config, players) => {
28
- for (let player of players) {
28
+ for (const player of players) {
29
29
  config.addWord(player, { "id": "player", "initial": `{ value: "${player}" }` })
30
30
  }
31
31
  objects.players = players;
@@ -51,7 +51,7 @@ const addPlayer = (objects, config, player) => {
51
51
  objects.players.push(player);
52
52
  }
53
53
 
54
- let config = {
54
+ const config = {
55
55
  name: 'scorekeeper',
56
56
  operators: [
57
57
  "([next])",
@@ -156,7 +156,7 @@ let config = {
156
156
  apply: ({context, objects, config, km}) => {
157
157
  const players = context.same.value.map( (props) => props.value )
158
158
  setPlayers(objects, config, players)
159
- for (let player of objects.players) {
159
+ for (const player of objects.players) {
160
160
  objects.scores[player] = 0
161
161
  }
162
162
  objects.nextPlayer = 0;
@@ -172,7 +172,7 @@ let config = {
172
172
  objects.scores = {}
173
173
  objects.nextPlayer = 0
174
174
  setNextPlayer(km, objects);
175
- for (let player of objects.players) {
175
+ for (const player of objects.players) {
176
176
  objects.scores[player] = 0;
177
177
  }
178
178
  if (objects.winningScore) {
@@ -281,7 +281,7 @@ let config = {
281
281
  apply: ({context, objects}) => {
282
282
  const players = Object.keys(objects.scores);
283
283
  let allScoresAreZero = true
284
- for (let player of players) {
284
+ for (const player of players) {
285
285
  if (objects.scores[player] != 0) {
286
286
  allScoresAreZero = false
287
287
  break;
@@ -2,7 +2,7 @@ const { flatten, knowledgeModule, where } = require('./runtime').theprogrammable
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const sdefaults_tests = require('./sdefaults.test.json')
4
4
 
5
- let config = {
5
+ const config = {
6
6
  name: 'sdefaults',
7
7
  semantics: [
8
8
  {
@@ -14,7 +14,7 @@ let config = {
14
14
  // match: ({context}) => context.flatten || context.listable || (Array.isArray(context.value) && context.value.some((value) => value.flatten)),
15
15
  apply: async ({config, km, context, s}) => {
16
16
  const [flats, wf] = flatten(['list'], context)
17
- for (let flat of flats) {
17
+ for (const flat of flats) {
18
18
  await s({ ...flat, flatten: false })
19
19
  }
20
20
  }
@@ -6,7 +6,7 @@ const sizeable_tests = require('./sizeable.test.json')
6
6
 
7
7
  // TODO 1 to 2 sizeables
8
8
 
9
- let config = {
9
+ const config = {
10
10
  name: 'sizeable',
11
11
  operators: [
12
12
  "(([size|]) [sizing] ([sizeable]))",
@@ -365,6 +365,11 @@
365
365
  "theAble",
366
366
  false
367
367
  ],
368
+ [
369
+ "distributable",
370
+ "queryable",
371
+ false
372
+ ],
368
373
  [
369
374
  "doctor",
370
375
  "hierarchyAble",
@@ -445,6 +450,11 @@
445
450
  "queryable",
446
451
  false
447
452
  ],
453
+ [
454
+ "each",
455
+ "articlePOS",
456
+ false
457
+ ],
448
458
  [
449
459
  "eagle",
450
460
  "bird",
@@ -495,6 +505,11 @@
495
505
  "verb",
496
506
  false
497
507
  ],
508
+ [
509
+ "every",
510
+ "articlePOS",
511
+ false
512
+ ],
498
513
  [
499
514
  "feel",
500
515
  "canBeDoQuestion",
package/common/stm.js CHANGED
@@ -27,7 +27,7 @@ class API {
27
27
  }
28
28
 
29
29
  isA(child, parent) {
30
- for (let isA of this.isAs) {
30
+ for (const isA of this.isAs) {
31
31
  if (isA(child, parent)) {
32
32
  return true
33
33
  }
@@ -69,7 +69,7 @@ class API {
69
69
  }
70
70
 
71
71
  mentions({ context, frameOfReference, useHierarchy=true, all, condition = (() => true) } = {}) {
72
- let mentioned = frameOfReference?.mentioned || this._objects.mentioned
72
+ const mentioned = frameOfReference?.mentioned || this._objects.mentioned
73
73
 
74
74
  const findPrevious = !!context.stm_previous
75
75
  const forAll = []
@@ -81,7 +81,7 @@ class API {
81
81
 
82
82
  // care about value first
83
83
  let findCounter = 0
84
- for (let m of mentioned) {
84
+ for (const m of mentioned) {
85
85
  if (context.value && (context.value == m.marker || context.value == m.value)) {
86
86
  findCounter += 1
87
87
  if (findPrevious && findCounter < 2) {
@@ -103,7 +103,7 @@ class API {
103
103
 
104
104
  // care about marker second
105
105
  findCounter = 0
106
- for (let m of mentioned) {
106
+ for (const m of mentioned) {
107
107
  if (context.marker != 'unknown' && this.isA(m.marker, context.marker)) {
108
108
  findCounter += 1
109
109
  if (findPrevious && findCounter < 2) {
@@ -119,7 +119,7 @@ class API {
119
119
  }
120
120
  // if (context.types && context.types.includes(m.marker)) {
121
121
  if (context.types) {
122
- for (let parent of context.types) {
122
+ for (const parent of context.types) {
123
123
  if (parent != 'unknown' && this.isA(m.marker, parent)) {
124
124
  findCounter += 1
125
125
  if (findPrevious && findCounter < 2) {
@@ -139,7 +139,7 @@ class API {
139
139
 
140
140
  findCounter = 0
141
141
  if (context.types && context.types.length == 1) {
142
- for (let m of mentioned) {
142
+ for (const m of mentioned) {
143
143
  if (context.unknown) {
144
144
  findCounter += 1
145
145
  if (findPrevious && findCounter < 2) {
package/common/tell.js CHANGED
@@ -40,7 +40,7 @@ class API {
40
40
 
41
41
  const api = new API()
42
42
 
43
- let config = {
43
+ const config = {
44
44
  name: 'tell',
45
45
  operators: [
46
46
  "([tell] ([person]) ([info|]) ([event]))"
@@ -213,6 +213,11 @@
213
213
  "theAble",
214
214
  false
215
215
  ],
216
+ [
217
+ "distributable",
218
+ "queryable",
219
+ false
220
+ ],
216
221
  [
217
222
  "divideByExpression",
218
223
  "mathematicalExpression",
@@ -228,6 +233,11 @@
228
233
  "queryable",
229
234
  false
230
235
  ],
236
+ [
237
+ "each",
238
+ "articlePOS",
239
+ false
240
+ ],
231
241
  [
232
242
  "evaluate",
233
243
  "verb",
@@ -235,7 +245,7 @@
235
245
  ],
236
246
  [
237
247
  "every",
238
- "quantifier",
248
+ "articlePOS",
239
249
  false
240
250
  ],
241
251
  [
@@ -1433,6 +1443,11 @@
1433
1443
  "theAble",
1434
1444
  false
1435
1445
  ],
1446
+ [
1447
+ "distributable",
1448
+ "queryable",
1449
+ false
1450
+ ],
1436
1451
  [
1437
1452
  "divideByExpression",
1438
1453
  "mathematicalExpression",
@@ -1448,6 +1463,11 @@
1448
1463
  "queryable",
1449
1464
  false
1450
1465
  ],
1466
+ [
1467
+ "each",
1468
+ "articlePOS",
1469
+ false
1470
+ ],
1451
1471
  [
1452
1472
  "evaluate",
1453
1473
  "verb",
@@ -1455,7 +1475,7 @@
1455
1475
  ],
1456
1476
  [
1457
1477
  "every",
1458
- "quantifier",
1478
+ "articlePOS",
1459
1479
  false
1460
1480
  ],
1461
1481
  [
@@ -2546,7 +2566,6 @@
2546
2566
  },
2547
2567
  "types": [
2548
2568
  "list",
2549
- "queryable",
2550
2569
  "unknown"
2551
2570
  ],
2552
2571
  "listable": true,
@@ -2564,7 +2583,6 @@
2564
2583
  },
2565
2584
  "dead": true,
2566
2585
  "types": [
2567
- "queryable",
2568
2586
  "unknown"
2569
2587
  ],
2570
2588
  "level": 1
@@ -2580,7 +2598,6 @@
2580
2598
  "end": 17
2581
2599
  },
2582
2600
  "types": [
2583
- "queryable",
2584
2601
  "unknown"
2585
2602
  ],
2586
2603
  "dead": true,
@@ -2597,7 +2614,6 @@
2597
2614
  "end": 28
2598
2615
  },
2599
2616
  "types": [
2600
- "queryable",
2601
2617
  "unknown"
2602
2618
  ],
2603
2619
  "dead": true,
@@ -3133,6 +3149,11 @@
3133
3149
  "theAble",
3134
3150
  false
3135
3151
  ],
3152
+ [
3153
+ "distributable",
3154
+ "queryable",
3155
+ false
3156
+ ],
3136
3157
  [
3137
3158
  "divideByExpression",
3138
3159
  "mathematicalExpression",
@@ -3148,6 +3169,11 @@
3148
3169
  "queryable",
3149
3170
  false
3150
3171
  ],
3172
+ [
3173
+ "each",
3174
+ "articlePOS",
3175
+ false
3176
+ ],
3151
3177
  [
3152
3178
  "evaluate",
3153
3179
  "verb",
@@ -3155,7 +3181,7 @@
3155
3181
  ],
3156
3182
  [
3157
3183
  "every",
3158
- "quantifier",
3184
+ "articlePOS",
3159
3185
  false
3160
3186
  ],
3161
3187
  [
@@ -4831,6 +4857,11 @@
4831
4857
  "theAble",
4832
4858
  false
4833
4859
  ],
4860
+ [
4861
+ "distributable",
4862
+ "queryable",
4863
+ false
4864
+ ],
4834
4865
  [
4835
4866
  "divideByExpression",
4836
4867
  "mathematicalExpression",
@@ -4846,6 +4877,11 @@
4846
4877
  "queryable",
4847
4878
  false
4848
4879
  ],
4880
+ [
4881
+ "each",
4882
+ "articlePOS",
4883
+ false
4884
+ ],
4849
4885
  [
4850
4886
  "evaluate",
4851
4887
  "verb",
@@ -4853,7 +4889,7 @@
4853
4889
  ],
4854
4890
  [
4855
4891
  "every",
4856
- "quantifier",
4892
+ "articlePOS",
4857
4893
  false
4858
4894
  ],
4859
4895
  [
package/common/tester.js CHANGED
@@ -17,7 +17,7 @@ const createConfig = async () => {
17
17
  global.theprogrammablemind = {
18
18
  loadForTesting: {}
19
19
  }
20
- for (let module of args.modules.split(',')) {
20
+ for (const module of args.modules.split(',')) {
21
21
  global.theprogrammablemind.loadForTesting[module] = true
22
22
  const km = require(`./${module}`)
23
23
  // km.rebuild({ isModule: false }) // load the usually defaults
@@ -69,6 +69,11 @@
69
69
  "direction",
70
70
  false
71
71
  ],
72
+ [
73
+ "distributable",
74
+ "queryable",
75
+ false
76
+ ],
72
77
  [
73
78
  "doubleQuote",
74
79
  "queryable",
@@ -79,6 +84,11 @@
79
84
  "direction",
80
85
  false
81
86
  ],
87
+ [
88
+ "each",
89
+ "articlePOS",
90
+ false
91
+ ],
82
92
  [
83
93
  "evaluate",
84
94
  "verb",
@@ -86,7 +96,7 @@
86
96
  ],
87
97
  [
88
98
  "every",
89
- "quantifier",
99
+ "articlePOS",
90
100
  false
91
101
  ],
92
102
  [
@@ -214,6 +224,11 @@
214
224
  "ifAble",
215
225
  false
216
226
  ],
227
+ [
228
+ "orderable",
229
+ "queryable",
230
+ false
231
+ ],
217
232
  [
218
233
  "ordinalOnOrdered",
219
234
  "adjective",