tpmkms_4wp 9.5.1 → 9.6.0

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 (122) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +116 -106
  3. package/common/avatar.test.json +1001 -860
  4. package/common/can.instance.json +2174 -0
  5. package/common/can.js +254 -0
  6. package/common/can.test.json +51307 -0
  7. package/common/characters.js +5 -5
  8. package/common/colors.instance.json +12 -12
  9. package/common/comparable.instance.json +3 -3
  10. package/common/concept.js +25 -27
  11. package/common/concept.test.json +180 -144
  12. package/common/conjunction.js +13 -5
  13. package/common/conjunction.test.json +32 -42
  14. package/common/crew.instance.json +196 -160
  15. package/common/crew.js +1 -1
  16. package/common/crew.test.json +4148 -3324
  17. package/common/currency.js +1 -1
  18. package/common/dateTimeSelectors.instance.json +2 -2
  19. package/common/dateTimeSelectors.js +3 -3
  20. package/common/dateTimeSelectors.test.json +76935 -35739
  21. package/common/dates.instance.json +3 -3
  22. package/common/dates.test.json +284 -287
  23. package/common/dialogues.js +41 -119
  24. package/common/dialogues.test.json +1171 -996
  25. package/common/dimension.instance.json +21369 -557
  26. package/common/dimension.js +148 -54
  27. package/common/dimension.test.json +8753 -3495
  28. package/common/drone.instance.json +23712 -0
  29. package/common/drone.js +448 -0
  30. package/common/drone.test.json +66665 -0
  31. package/common/edible.instance.json +32 -32
  32. package/common/emotions.instance.json +75 -76
  33. package/common/emotions.js +1 -1
  34. package/common/emotions.test.json +242 -174
  35. package/common/english_helpers.js +336 -0
  36. package/common/errors.js +6 -6
  37. package/common/evaluate.js +2 -2
  38. package/common/events.js +8 -8
  39. package/common/fastfood.instance.json +389 -245
  40. package/common/fastfood.js +11 -11
  41. package/common/fastfood.test.json +6970 -6829
  42. package/common/formulas.instance.json +1 -1
  43. package/common/formulas.js +1 -1
  44. package/common/gdefaults.js +111 -17
  45. package/common/help.js +12 -12
  46. package/common/help.test.json +65 -11
  47. package/common/helpers/concept.js +1 -1
  48. package/common/helpers/conjunction.js +54 -44
  49. package/common/helpers/dateTimeSelectors.js +2 -2
  50. package/common/helpers/dialogues.js +7 -2
  51. package/common/helpers/formulas.js +13 -11
  52. package/common/helpers/menus.js +12 -12
  53. package/common/helpers/meta.js +9 -9
  54. package/common/helpers/properties.js +185 -62
  55. package/common/helpers.js +167 -48
  56. package/common/hierarchy.js +6 -4
  57. package/common/kirk.instance.json +1 -1
  58. package/common/kirk.test.json +600 -424
  59. package/common/latin.instance.json +12 -12
  60. package/common/latin.js +9 -9
  61. package/common/length.instance.json +27612 -2890
  62. package/common/length.js +6 -1
  63. package/common/length.test.json +45315 -3925
  64. package/common/math.instance.json +29 -29
  65. package/common/math.js +47 -46
  66. package/common/menus.instance.json +7 -10
  67. package/common/menus.js +2 -9
  68. package/common/meta.js +77 -60
  69. package/common/nameable.js +20 -13
  70. package/common/nameable.test.json +436 -0
  71. package/common/numbers.js +1 -1
  72. package/common/ordering.instance.json +87 -19
  73. package/common/ordering.js +1 -1
  74. package/common/ordering.test.json +835 -417
  75. package/common/people.instance.json +96 -348
  76. package/common/people.js +6 -4
  77. package/common/people.test.json +4135 -3606
  78. package/common/pipboy.instance.json +17 -17
  79. package/common/pipboy.js +2 -3
  80. package/common/pokemon.instance.json +13 -13
  81. package/common/pokemon.js +1 -1
  82. package/common/pressure.instance.json +3579 -1610
  83. package/common/pressure.test.json +433 -477
  84. package/common/properties.instance.json +6 -17
  85. package/common/properties.js +25 -7
  86. package/common/properties.test.json +9565 -6951
  87. package/common/rates.instance.json +59 -0
  88. package/common/rates.js +97 -0
  89. package/common/rates.test.json +27702 -0
  90. package/common/reminders.instance.json +4 -4
  91. package/common/reminders.js +5 -5
  92. package/common/reminders.test.json +64635 -25787
  93. package/common/reports.instance.json +3 -3
  94. package/common/reports.js +18 -16
  95. package/common/scorekeeper.js +6 -6
  96. package/common/sdefaults.js +22 -2
  97. package/common/spock.instance.json +1 -1
  98. package/common/spock.test.json +606 -430
  99. package/common/stgame.js +1 -1
  100. package/common/stm.js +17 -6
  101. package/common/tell.js +1 -1
  102. package/common/temperature.instance.json +3659 -1690
  103. package/common/temperature.test.json +433 -477
  104. package/common/tester.js +3 -3
  105. package/common/time.instance.json +24762 -0
  106. package/common/time.js +137 -141
  107. package/common/time.test.json +31876 -3757
  108. package/common/tokenize.js +5 -2
  109. package/common/ui.instance.json +2 -5
  110. package/common/ui.js +1 -8
  111. package/common/weight.instance.json +10360 -4078
  112. package/common/weight.test.json +2601 -2263
  113. package/common/words.instance.json +9 -0
  114. package/common/words.js +53 -0
  115. package/common/words.test.json +2 -0
  116. package/common/wp.instance.json +408 -8
  117. package/common/wp.js +8 -4
  118. package/common/wp.test.json +7385 -6906
  119. package/main.js +4 -2
  120. package/package.json +20 -5
  121. package/common/listener.js +0 -50
  122. package/common/listener.test.json +0 -142
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]
@@ -292,6 +296,7 @@ const config = {
292
296
  }
293
297
  if (context.to.value) {
294
298
  kms.stm.api.setVariable(context.from.value, context.to.value)
299
+ // config.addWord(context.from.word, context.to)
295
300
  } else {
296
301
  await kms.dialogues.api.makeObject({ context: context.from, types: context.to.types || [], config });
297
302
  kms.stm.api.setVariable(context.from.value, context.to)
@@ -306,15 +311,21 @@ const config = {
306
311
  apply: async ({config, context, g}) => {
307
312
  // setup the write semantic
308
313
  {
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))
314
+ function matchByMarker(defContext) {
315
+ return ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
316
+ }
317
+ function matchByValue(defContext) {
318
+ return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
319
+ }
320
+ function apply(mappings, TO) {
321
+ return async ({context, s}) => {
322
+ TO = _.cloneDeep(TO)
323
+ for (const { from, to } of mappings) {
324
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
325
+ }
326
+ toPrime = await s(TO)
327
+ context.result = toPrime.result
315
328
  }
316
- toPrime = await s(TO)
317
- context.result = toPrime.result
318
329
  }
319
330
  const mappings = translationMapping(context.from, context.to)
320
331
  let match = matchByMarker(context)
@@ -333,30 +344,36 @@ const config = {
333
344
 
334
345
  // setup the read semantic
335
346
  {
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
347
+ function matchByMarker(defContext) {
348
+ return ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
349
+ }
350
+ function matchByValue(defContext) {
351
+ return ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
352
+ }
353
+ function apply(mappings, TO) {
354
+ return async ({uuid, context, s, g, config}) => {
355
+ TO = _.cloneDeep(TO)
356
+ for (const { from, to } of mappings) {
357
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
358
+ }
359
+ // next move add debug arg to s and g
360
+ // TODO why is there query and evaluate?
361
+ if (context.query) {
362
+ TO.query = context.query
363
+ } else {
364
+ TO.evaluate = context.evaluate
365
+ }
366
+ TO[`disable${uuid}`] = true
367
+ toPrime = await s(TO)
368
+ if (context.query) {
369
+ if (toPrime.evalue) {
370
+ context.evalue = toPrime.evalue
371
+ } else {
372
+ context.evalue = toPrime
373
+ }
355
374
  } else {
356
- context.evalue = toPrime
375
+ context.evalue = toPrime.evalue
357
376
  }
358
- } else {
359
- context.evalue = toPrime.evalue
360
377
  }
361
378
  }
362
379
  const mappings = translationMapping(context.from, context.to)
@@ -1,5 +1,5 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck } = require('./helpers')
2
+ const { defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
3
3
  const helpers = require('./helpers')
4
4
  const stm = require('./stm')
5
5
  const nameable_tests = require('./nameable.test.json')
@@ -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}) => {
@@ -107,19 +107,26 @@ const config = {
107
107
  id: 'call',
108
108
  isA: ['verb'],
109
109
  bridge: "{ ...next(operator), nameable: after[0], name: after[1:][0] }",
110
- // bridge: "{ ...next(operator), nameable: after[0], name: after[1] }",
111
- // generatorp: async ({context, g}) => `call ${await g(context.nameable)} ${await g(context.name)}`,
112
110
  generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
113
- semantic: async ({config, context, api, e}) => {
111
+ semantic: async ({config, context, api, e, verbatim, g}) => {
114
112
  // TODO find report being referred to
115
113
  const nameable = (await e(context.nameable)).evalue
114
+ if (!nameable) {
115
+ verbatim(`${await g(context.nameable)} is not known`)
116
+ return
117
+ }
116
118
  const name = context.name.map((n) => n.text).join(' ')
117
119
  // const name = context.name.text
118
120
  config.addWord(name, { id: nameable.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
119
121
  api.setName(nameable, name)
120
- }
122
+ },
123
+ check: defaultContextCheckProperties(['nameable', 'name']),
124
+ },
125
+ {
126
+ id: 'nameable',
127
+ words: helpers.words('nameable'),
128
+ children: ['thisitthat'],
121
129
  },
122
- { id: 'nameable', words: helpers.words('nameable')},
123
130
  ]
124
131
  }
125
132