tpmkms 9.5.0 → 9.5.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 (83) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +106 -104
  3. package/common/can.instance.json +17 -0
  4. package/common/can.js +188 -0
  5. package/common/characters.js +5 -5
  6. package/common/colors.instance.json +38 -10
  7. package/common/comparable.instance.json +2 -2
  8. package/common/concept.test.json +54 -40
  9. package/common/conjunction.js +13 -5
  10. package/common/crew.instance.json +71 -85
  11. package/common/crew.js +1 -1
  12. package/common/crew.test.json +4148 -3324
  13. package/common/currency.js +1 -1
  14. package/common/dates.instance.json +87 -3
  15. package/common/dialogues.js +12 -9
  16. package/common/dimension.instance.json +9 -9
  17. package/common/dimension.js +4 -4
  18. package/common/edible.instance.json +79 -23
  19. package/common/emotions.instance.json +29 -7
  20. package/common/emotions.js +1 -1
  21. package/common/emotions.test.json +242 -174
  22. package/common/english_helpers.js +336 -0
  23. package/common/errors.js +3 -3
  24. package/common/evaluate.js +2 -2
  25. package/common/events.js +8 -8
  26. package/common/fastfood.instance.json +205 -553
  27. package/common/fastfood.js +4 -4
  28. package/common/formulas.instance.json +1 -1
  29. package/common/formulas.js +1 -1
  30. package/common/gdefaults.js +58 -9
  31. package/common/help.js +3 -3
  32. package/common/helpers/concept.js +1 -1
  33. package/common/helpers/conjunction.js +54 -44
  34. package/common/helpers/dateTimeSelectors.js +2 -2
  35. package/common/helpers/dialogues.js +1 -1
  36. package/common/helpers/formulas.js +13 -11
  37. package/common/helpers/menus.js +12 -12
  38. package/common/helpers/meta.js +9 -9
  39. package/common/helpers/properties.js +158 -55
  40. package/common/helpers.js +135 -46
  41. package/common/hierarchy.js +3 -3
  42. package/common/kirk.instance.json +1 -1
  43. package/common/latin.instance.json +2 -2
  44. package/common/latin.js +4 -4
  45. package/common/length.instance.json +2 -2
  46. package/common/listener.js +1 -1
  47. package/common/math.instance.json +28 -28
  48. package/common/math.js +47 -46
  49. package/common/menus.instance.json +3 -3
  50. package/common/menus.js +1 -1
  51. package/common/meta.js +76 -60
  52. package/common/nameable.js +7 -7
  53. package/common/ordering.instance.json +85 -19
  54. package/common/ordering.js +1 -1
  55. package/common/ordering.test.json +786 -298
  56. package/common/people.instance.json +59 -56
  57. package/common/people.js +6 -4
  58. package/common/people.test.json +4135 -3606
  59. package/common/pipboy.instance.json +72 -16
  60. package/common/pipboy.js +2 -3
  61. package/common/pokemon.instance.json +8 -8
  62. package/common/pokemon.js +1 -1
  63. package/common/pressure.instance.json +2 -2
  64. package/common/properties.instance.json +1 -1
  65. package/common/properties.js +22 -4
  66. package/common/reminders.instance.json +4 -4
  67. package/common/reminders.js +3 -3
  68. package/common/reports.instance.json +3 -3
  69. package/common/reports.js +18 -16
  70. package/common/scorekeeper.js +6 -6
  71. package/common/sdefaults.js +22 -2
  72. package/common/spock.instance.json +1 -1
  73. package/common/stgame.js +1 -1
  74. package/common/stm.js +4 -4
  75. package/common/tell.js +1 -1
  76. package/common/temperature.instance.json +2 -2
  77. package/common/tester.js +3 -3
  78. package/common/time.js +3 -3
  79. package/common/tokenize.js +5 -2
  80. package/common/weight.instance.json +2 -2
  81. package/common/wp.instance.json +136 -8
  82. package/common/wp.js +4 -4
  83. package/package.json +6 -2
package/common/meta.js CHANGED
@@ -26,13 +26,13 @@ const config = {
26
26
  "(([orAble|]) [orList|or] ([orAble|]))",
27
27
  // "cats is the plural of cat"
28
28
  // "is cat the plural of cats"
29
- { pattern: "([x])", development: true },
29
+ { pattern: "([x])", scope: "testing" },
30
30
  // if f x then g x
31
- { pattern: "([e])", development: true },
32
- { pattern: "([f])", development: true },
33
- { pattern: "([g])", development: true },
34
- { pattern: "([undefined])", development: true },
35
- { pattern: "([defined])", development: true },
31
+ { pattern: "([e])", scope: "testing" },
32
+ { pattern: "([f])", scope: "testing" },
33
+ { pattern: "([g])", scope: "testing" },
34
+ { pattern: "([undefined])", scope: "testing" },
35
+ { pattern: "([defined])", scope: "testing" },
36
36
 
37
37
  /*
38
38
  if creating a new word make a motivation to ask if word is plura or singlar of anohter wordA
@@ -61,9 +61,9 @@ const config = {
61
61
  // [['means', 0], ['is', 0]],
62
62
  ],
63
63
  hierarchy: [
64
- { child: 'e', parent: 'orAble', development: true },
65
- { child: 'f', parent: 'orAble', development: true },
66
- { child: 'g', parent: 'ifAble', development: true },
64
+ { child: 'e', parent: 'orAble', scope: "testing" },
65
+ { child: 'f', parent: 'orAble', scope: "testing" },
66
+ { child: 'g', parent: 'ifAble', scope: "testing" },
67
67
  { child: 'orAble', parent: 'ifAble' },
68
68
  ],
69
69
  bridges: [
@@ -94,12 +94,12 @@ const config = {
94
94
  { id: "then", level: 0, bridge: "{ ...next(operator), consequence: after[0] }" },
95
95
  { id: "ifAble" },
96
96
  { id: "orAble" },
97
- { id: "x", development: true },
98
- { id: "e", development: true },
99
- { id: "f", development: true },
100
- { id: "g", development: true },
101
- { id: "undefined", development: true },
102
- { id: "defined", development: true },
97
+ { id: "x", scope: "testing" },
98
+ { id: "e", scope: "testing" },
99
+ { id: "f", scope: "testing" },
100
+ { id: "g", scope: "testing" },
101
+ { id: "undefined", scope: "testing" },
102
+ { id: "defined", scope: "testing" },
103
103
  // { id: "testWord2", level: 0, bridge: "{ ...next(operator) }" },
104
104
  ],
105
105
  version: '3',
@@ -107,12 +107,12 @@ const config = {
107
107
  "literals": {
108
108
  // 'testWord2': [{"id": "testWord2", "initial": "{ value: 'testWord2Value' }" }],
109
109
  // TODO make this development and select out for module
110
- // 'x': [{id: "x", initial: "{ value: 'x' }", development: true }],
111
- // 'f': [{id: "ifAble", initial: "{ word: 'f' }", development: true }],
112
- // 'g': [{id: "ifAble", initial: "{ word: 'g' }", development: true }],
113
- 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", development: true }],
114
- 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", development: true }],
115
- 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", development: true }],
110
+ // 'x': [{id: "x", initial: "{ value: 'x' }", scope: "testing" }],
111
+ // 'f': [{id: "ifAble", initial: "{ word: 'f' }", scope: "testing" }],
112
+ // 'g': [{id: "ifAble", initial: "{ word: 'g' }", scope: "testing" }],
113
+ 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", scope: "testing" }],
114
+ 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", scope: "testing" }],
115
+ 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", scope: "testing" }],
116
116
  }
117
117
  },
118
118
  generators: [
@@ -120,19 +120,19 @@ const config = {
120
120
  where: where(),
121
121
  match: ({context}) => context.marker == 'undefined',
122
122
  apply: ({context}) => 'undefined',
123
- development: true,
123
+ scope: "testing",
124
124
  },
125
125
  {
126
126
  where: where(),
127
127
  match: ({context}) => context.marker == 'defined',
128
128
  apply: ({context}) => 'defined',
129
- development: true,
129
+ scope: "testing",
130
130
  },
131
131
  {
132
132
  where: where(),
133
133
  match: ({context}) => context.evalue && !context.paraphrase,
134
134
  apply: ({context}) => context.evalue.verbatim,
135
- development: true,
135
+ scope: "testing",
136
136
  },
137
137
  {
138
138
  where: where(),
@@ -154,13 +154,13 @@ const config = {
154
154
  where: where(),
155
155
  match: ({context}) => context.marker === 'ifAble',
156
156
  apply: ({context}) => context.value,
157
- development: true,
157
+ scope: "testing",
158
158
  },
159
159
  {
160
160
  where: where(),
161
161
  match: ({context}) => ['x', 'g', 'f', 'e', 'ifAble'].includes(context.marker),
162
162
  apply: ({context}) => `${context.word}`,
163
- development: true,
163
+ scope: "testing",
164
164
  },
165
165
  {
166
166
  where: where(),
@@ -182,7 +182,7 @@ const config = {
182
182
  }
183
183
  context.isResponse = true
184
184
  },
185
- development: true,
185
+ scope: "testing",
186
186
  },
187
187
  {
188
188
  where: where(),
@@ -206,10 +206,14 @@ const config = {
206
206
  // setup the read semantic
207
207
 
208
208
  // !topLevel or maybe !value??!?!
209
- const match = (defContext) => ({context}) => context.marker == (defContext.consequence || {}).marker && context.query // && !context.value
210
- const apply = (DEFINITIONs, DERIVED) => {
209
+ function match(defContext) {
210
+ return ({context}) => context.marker == (defContext.consequence || {}).marker && context.query // && !context.value
211
+ }
212
+ function apply(DEFINITIONs, DERIVED) {
211
213
  const mappingss = translationMappings(DEFINITIONs, DERIVED)
212
- const invertMappings = (mappings) => mappings.map( ({ from, to }) => { return { to: from, from: to } } )
214
+ function invertMappings(mappings) {
215
+ return mappings.map( ({ from, to }) => { return { to: from, from: to } } )
216
+ }
213
217
  return async ({context, s, config}) => {
214
218
  DEFINITIONs = _.cloneDeep(DEFINITIONs)
215
219
  //const mappings = mappingss[0]
@@ -306,15 +310,21 @@ const config = {
306
310
  apply: async ({config, context, g}) => {
307
311
  // setup the write semantic
308
312
  {
309
- const matchByMarker = (defContext) => ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
310
- const matchByValue = (defContext) => ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
311
- const apply = (mappings, TO) => async ({context, s}) => {
312
- TO = _.cloneDeep(TO)
313
- for (const { from, to } of mappings) {
314
- hashIndexesSet(TO, to, hashIndexesGet(context, from))
313
+ function matchByMarker(defContext) {
314
+ return ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
315
+ }
316
+ function matchByValue(defContext) {
317
+ return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
318
+ }
319
+ function apply(mappings, TO) {
320
+ return async ({context, s}) => {
321
+ TO = _.cloneDeep(TO)
322
+ for (const { from, to } of mappings) {
323
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
324
+ }
325
+ toPrime = await s(TO)
326
+ context.result = toPrime.result
315
327
  }
316
- toPrime = await s(TO)
317
- context.result = toPrime.result
318
328
  }
319
329
  const mappings = translationMapping(context.from, context.to)
320
330
  let match = matchByMarker(context)
@@ -333,30 +343,36 @@ const config = {
333
343
 
334
344
  // setup the read semantic
335
345
  {
336
- const matchByMarker = (defContext) => ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
337
- const matchByValue = (defContext) => ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
338
- const apply = (mappings, TO) => async ({uuid, context, s, g, config}) => {
339
- TO = _.cloneDeep(TO)
340
- for (const { from, to } of mappings) {
341
- hashIndexesSet(TO, to, hashIndexesGet(context, from))
342
- }
343
- // next move add debug arg to s and g
344
- // TODO why is there query and evaluate?
345
- if (context.query) {
346
- TO.query = context.query
347
- } else {
348
- TO.evaluate = context.evaluate
349
- }
350
- TO[`disable${uuid}`] = true
351
- toPrime = await s(TO)
352
- if (context.query) {
353
- if (toPrime.evalue) {
354
- context.evalue = toPrime.evalue
346
+ function matchByMarker(defContext) {
347
+ return ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
348
+ }
349
+ function matchByValue(defContext) {
350
+ return ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
351
+ }
352
+ function apply(mappings, TO) {
353
+ return async ({uuid, context, s, g, config}) => {
354
+ TO = _.cloneDeep(TO)
355
+ for (const { from, to } of mappings) {
356
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
357
+ }
358
+ // next move add debug arg to s and g
359
+ // TODO why is there query and evaluate?
360
+ if (context.query) {
361
+ TO.query = context.query
362
+ } else {
363
+ TO.evaluate = context.evaluate
364
+ }
365
+ TO[`disable${uuid}`] = true
366
+ toPrime = await s(TO)
367
+ if (context.query) {
368
+ if (toPrime.evalue) {
369
+ context.evalue = toPrime.evalue
370
+ } else {
371
+ context.evalue = toPrime
372
+ }
355
373
  } else {
356
- context.evalue = toPrime
374
+ context.evalue = toPrime.evalue
357
375
  }
358
- } else {
359
- context.evalue = toPrime.evalue
360
376
  }
361
377
  }
362
378
  const mappings = translationMapping(context.from, context.to)
@@ -77,25 +77,25 @@ const config = {
77
77
  operators: [
78
78
  // "([call] ([nameable]) (name))",
79
79
  "([call] ([nameable]) (!@<=endOfSentence)*)",
80
- { pattern: "([getNamesByType] (type))", development: true },
81
- { pattern: "([m1])", development: true },
82
- // { pattern: "([testPullFromContext] ([memorable]))", development: true }
80
+ { pattern: "([getNamesByType] (type))", scope: "testing" },
81
+ { pattern: "([m1])", scope: "testing" },
82
+ // { pattern: "([testPullFromContext] ([memorable]))", scope: "testing" }
83
83
  ],
84
84
  words: {
85
85
  literals: {
86
- // "m1": [{"id": "memorable", development: true, "initial": "{ value: 'm1' }" }],
87
- // "m2": [{"id": "memorable", development: true, "initial": "{ value: 'm2' }" }],
86
+ // "m1": [{"id": "memorable", scope: "testing", "initial": "{ value: 'm1' }" }],
87
+ // "m2": [{"id": "memorable", scope: "testing", "initial": "{ value: 'm2' }" }],
88
88
  },
89
89
  },
90
90
  bridges: [
91
91
  {
92
92
  id: 'm1',
93
93
  isA: ['memorable', 'nameable'],
94
- development: true,
94
+ scope: "testing",
95
95
  },
96
96
  {
97
97
  id: 'getNamesByType',
98
- development: true,
98
+ scope: "testing",
99
99
  isA: ['verb'],
100
100
  bridge: "{ ...next(operator), type: after[0] }",
101
101
  semantic: async ({context, api}) => {
@@ -594,7 +594,7 @@
594
594
  "word": "wants",
595
595
  "range": {
596
596
  "start": 0,
597
- "end": 37
597
+ "end": 4
598
598
  },
599
599
  "dead": true,
600
600
  "types": [
@@ -2207,12 +2207,7 @@
2207
2207
  },
2208
2208
  "do": {
2209
2209
  "left": "liker",
2210
- "right": "likee",
2211
- "range": {
2212
- "start": 3,
2213
- "end": 11
2214
- },
2215
- "text": "ikes y"
2210
+ "right": "likee"
2216
2211
  },
2217
2212
  "liker": {
2218
2213
  "value": "x",
@@ -2246,6 +2241,21 @@
2246
2241
  ],
2247
2242
  "level": 0
2248
2243
  },
2244
+ "operator": {
2245
+ "value": "like",
2246
+ "number": "one",
2247
+ "text": "likes",
2248
+ "marker": "like",
2249
+ "word": "likes",
2250
+ "range": {
2251
+ "start": 5,
2252
+ "end": 9
2253
+ },
2254
+ "evaluateWord": true,
2255
+ "imperative": false,
2256
+ "isVerb": true,
2257
+ "level": 0
2258
+ },
2249
2259
  "unflatten": [
2250
2260
  "liker",
2251
2261
  "likee"
@@ -2254,6 +2264,18 @@
2254
2264
  "liker",
2255
2265
  "likee"
2256
2266
  ],
2267
+ "interpolate": [
2268
+ {
2269
+ "property": "liker"
2270
+ },
2271
+ {
2272
+ "property": "operator",
2273
+ "number": "liker"
2274
+ },
2275
+ {
2276
+ "property": "likee"
2277
+ }
2278
+ ],
2257
2279
  "dead": true,
2258
2280
  "types": [
2259
2281
  "like"
@@ -2272,12 +2294,7 @@
2272
2294
  },
2273
2295
  "do": {
2274
2296
  "left": "lover",
2275
- "right": "lovee",
2276
- "range": {
2277
- "start": 16,
2278
- "end": 24
2279
- },
2280
- "text": ""
2297
+ "right": "lovee"
2281
2298
  },
2282
2299
  "lover": {
2283
2300
  "value": "x",
@@ -2311,6 +2328,21 @@
2311
2328
  ],
2312
2329
  "level": 0
2313
2330
  },
2331
+ "operator": {
2332
+ "value": "love",
2333
+ "number": "one",
2334
+ "text": "loves",
2335
+ "marker": "love",
2336
+ "word": "loves",
2337
+ "range": {
2338
+ "start": 18,
2339
+ "end": 22
2340
+ },
2341
+ "evaluateWord": true,
2342
+ "imperative": false,
2343
+ "isVerb": true,
2344
+ "level": 0
2345
+ },
2314
2346
  "unflatten": [
2315
2347
  "lover",
2316
2348
  "lovee"
@@ -2319,6 +2351,18 @@
2319
2351
  "lover",
2320
2352
  "lovee"
2321
2353
  ],
2354
+ "interpolate": [
2355
+ {
2356
+ "property": "lover"
2357
+ },
2358
+ {
2359
+ "property": "operator",
2360
+ "number": "lover"
2361
+ },
2362
+ {
2363
+ "property": "lovee"
2364
+ }
2365
+ ],
2322
2366
  "types": [
2323
2367
  "love"
2324
2368
  ],
@@ -2343,12 +2387,7 @@
2343
2387
  },
2344
2388
  "do": {
2345
2389
  "left": "wanter",
2346
- "right": "wantee",
2347
- "range": {
2348
- "start": 31,
2349
- "end": 39
2350
- },
2351
- "text": ""
2390
+ "right": "wantee"
2352
2391
  },
2353
2392
  "wanter": {
2354
2393
  "value": "x",
@@ -2382,6 +2421,21 @@
2382
2421
  ],
2383
2422
  "level": 0
2384
2423
  },
2424
+ "operator": {
2425
+ "value": "want",
2426
+ "text": "wants",
2427
+ "marker": "want",
2428
+ "word": "wants",
2429
+ "range": {
2430
+ "start": 33,
2431
+ "end": 37
2432
+ },
2433
+ "evaluateWord": true,
2434
+ "imperative": false,
2435
+ "isVerb": true,
2436
+ "number": "one",
2437
+ "level": 0
2438
+ },
2385
2439
  "unflatten": [
2386
2440
  "wanter",
2387
2441
  "wantee"
@@ -2390,6 +2444,18 @@
2390
2444
  "wanter",
2391
2445
  "wantee"
2392
2446
  ],
2447
+ "interpolate": [
2448
+ {
2449
+ "property": "wanter"
2450
+ },
2451
+ {
2452
+ "property": "operator",
2453
+ "number": "wanter"
2454
+ },
2455
+ {
2456
+ "property": "wantee"
2457
+ }
2458
+ ],
2393
2459
  "types": [
2394
2460
  "want"
2395
2461
  ],
@@ -32,7 +32,7 @@ const api = new API();
32
32
 
33
33
  if a likes b then a wants b
34
34
  */
35
- const initializer = ({config, km}) => {
35
+ function initializer({config, km}) {
36
36
  const oapi = km('ordering').api
37
37
  oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
38
38
  const papi = km('properties').api