tpmkms_4wp 9.5.1-beta.3 → 9.5.1-beta.31

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 (114) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +112 -102
  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 +3 -3
  8. package/common/colors.instance.json +10 -10
  9. package/common/comparable.instance.json +2 -2
  10. package/common/concept.js +19 -22
  11. package/common/concept.test.json +54 -40
  12. package/common/conjunction.js +13 -5
  13. package/common/conjunction.test.json +32 -42
  14. package/common/crew.instance.json +164 -150
  15. package/common/crew.js +1 -1
  16. package/common/currency.js +1 -1
  17. package/common/dateTimeSelectors.instance.json +2 -2
  18. package/common/dateTimeSelectors.js +3 -3
  19. package/common/dateTimeSelectors.test.json +76935 -35739
  20. package/common/dates.instance.json +3 -3
  21. package/common/dates.test.json +284 -287
  22. package/common/dialogues.js +41 -119
  23. package/common/dialogues.test.json +1171 -996
  24. package/common/dimension.instance.json +21374 -562
  25. package/common/dimension.js +145 -51
  26. package/common/dimension.test.json +8753 -3495
  27. package/common/drone.instance.json +23710 -0
  28. package/common/drone.js +429 -0
  29. package/common/drone.test.json +61113 -0
  30. package/common/edible.instance.json +23 -95
  31. package/common/emotions.instance.json +53 -80
  32. package/common/emotions.js +1 -1
  33. package/common/english_helpers.js +277 -67
  34. package/common/fastfood.instance.json +180 -372
  35. package/common/fastfood.js +4 -4
  36. package/common/fastfood.test.json +6970 -6829
  37. package/common/formulas.instance.json +1 -1
  38. package/common/gdefaults.js +94 -17
  39. package/common/help.js +11 -11
  40. package/common/help.test.json +65 -11
  41. package/common/helpers/concept.js +1 -1
  42. package/common/helpers/conjunction.js +54 -44
  43. package/common/helpers/dateTimeSelectors.js +2 -2
  44. package/common/helpers/dialogues.js +7 -2
  45. package/common/helpers/formulas.js +13 -11
  46. package/common/helpers/menus.js +12 -12
  47. package/common/helpers/meta.js +8 -8
  48. package/common/helpers/properties.js +104 -23
  49. package/common/helpers.js +114 -48
  50. package/common/hierarchy.js +6 -4
  51. package/common/kirk.instance.json +1 -1
  52. package/common/kirk.test.json +600 -424
  53. package/common/latin.instance.json +10 -10
  54. package/common/latin.js +5 -5
  55. package/common/length.instance.json +27612 -2890
  56. package/common/length.js +6 -1
  57. package/common/length.test.json +45315 -3925
  58. package/common/math.instance.json +20 -20
  59. package/common/math.js +45 -44
  60. package/common/menus.instance.json +6 -9
  61. package/common/menus.js +2 -9
  62. package/common/meta.js +50 -33
  63. package/common/nameable.js +13 -6
  64. package/common/nameable.test.json +436 -0
  65. package/common/numbers.js +1 -1
  66. package/common/ordering.instance.json +20 -30
  67. package/common/ordering.js +1 -1
  68. package/common/ordering.test.json +414 -426
  69. package/common/people.instance.json +82 -348
  70. package/common/people.js +1 -1
  71. package/common/people.test.json +952 -681
  72. package/common/pipboy.instance.json +16 -16
  73. package/common/pokemon.instance.json +8 -8
  74. package/common/pokemon.js +1 -1
  75. package/common/pressure.instance.json +3579 -1610
  76. package/common/pressure.test.json +433 -477
  77. package/common/properties.instance.json +6 -17
  78. package/common/properties.js +19 -6
  79. package/common/properties.test.json +8746 -6638
  80. package/common/rates.instance.json +59 -0
  81. package/common/rates.js +97 -0
  82. package/common/rates.test.json +27702 -0
  83. package/common/reminders.js +1 -1
  84. package/common/reminders.test.json +64635 -25787
  85. package/common/reports.instance.json +3 -3
  86. package/common/reports.js +18 -16
  87. package/common/scorekeeper.js +4 -4
  88. package/common/sdefaults.js +22 -2
  89. package/common/spock.instance.json +1 -1
  90. package/common/spock.test.json +606 -430
  91. package/common/stgame.js +1 -1
  92. package/common/stm.js +15 -4
  93. package/common/tell.js +1 -1
  94. package/common/temperature.instance.json +3786 -1705
  95. package/common/temperature.test.json +433 -477
  96. package/common/tester.js +3 -3
  97. package/common/time.instance.json +24762 -0
  98. package/common/time.js +137 -141
  99. package/common/time.test.json +31876 -3757
  100. package/common/tokenize.js +1 -1
  101. package/common/ui.instance.json +2 -5
  102. package/common/ui.js +1 -8
  103. package/common/weight.instance.json +10359 -4077
  104. package/common/weight.test.json +2601 -2263
  105. package/common/words.instance.json +9 -0
  106. package/common/words.js +53 -0
  107. package/common/words.test.json +2 -0
  108. package/common/wp.instance.json +336 -8
  109. package/common/wp.js +8 -4
  110. package/common/wp.test.json +7385 -6906
  111. package/main.js +4 -2
  112. package/package.json +18 -5
  113. package/common/listener.js +0 -50
  114. package/common/listener.test.json +0 -142
@@ -997,7 +997,7 @@
997
997
  "word": "formulas",
998
998
  "range": {
999
999
  "start": 0,
1000
- "end": 20
1000
+ "end": 7
1001
1001
  },
1002
1002
  "dead": true,
1003
1003
  "types": [
@@ -1,10 +1,10 @@
1
1
  const pluralize = require('pluralize')
2
- const { defaultContextCheck } = require('./helpers')
3
- const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
+ const { defaultContextCheck, getValue, isMany } = require('./helpers')
3
+ const { knowledgeModule, where, flatten } = require('./runtime').theprogrammablemind
4
4
  const tokenize = require('./tokenize.js')
5
+ const words = require('./words.js')
5
6
  const gdefaults_tests = require('./gdefaults.test.json')
6
7
  const englishHelpers = require('./english_helpers.js')
7
- const { getValue, isMany } = require('./helpers.js')
8
8
  const helpers = require('./helpers')
9
9
 
10
10
  const config = {
@@ -90,7 +90,7 @@ const config = {
90
90
  text.push(await g(m))
91
91
  }
92
92
  } else {
93
- text.push(await g(context[modifier], { isModifier: true }))
93
+ text.push(await g(context[modifier], { assumed: { isModifier: true } }))
94
94
  }
95
95
  }
96
96
  // text.push(context.word)
@@ -152,14 +152,47 @@ const config = {
152
152
  {
153
153
  where: where(),
154
154
  priority: -1,
155
- match: ({context}) => context.evaluateWord && context.paraphrase && context.word && (context.number == 'many' || context.number > 1),
155
+ // match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'one' && !context.imperative && !context.interpolate,
156
+ match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && !context.imperative && !context.interpolate,
157
+ apply: ({context}) => {
158
+ const infinitive = englishHelpers.getInfinitive(context.word)
159
+ if (context.form == 'infinitive') {
160
+ const cases = englishHelpers.conjugateVerb(infinitive)
161
+ const def = cases.find((def) => def.form == context.form)
162
+ return def.word
163
+ } else if (context.tense) {
164
+ const cases = englishHelpers.conjugateVerb(infinitive)
165
+ const def = cases.find((def) => def.tense == context.tense)
166
+ return def.word
167
+ } else {
168
+ return pluralize.plural(context.word)
169
+ }
170
+ },
171
+ },
172
+
173
+ /*
174
+ {
175
+ where: where(),
176
+ priority: -1,
177
+ match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'many' && !context.imperative && !context.interpolate,
178
+ apply: ({context}) => {
179
+ const infinitive = englishHelpers.getInfinitive(context.word)
180
+ const cases = englishHelpers.conjugateVerb(infinitive)
181
+ return pluralize.singular(context.word)
182
+ },
183
+ },
184
+ */
185
+ {
186
+ where: where(),
187
+ priority: -1,
188
+ match: ({context}) => context.evaluateWord && context.paraphrase && context.word && (context.number == 'many' || context.number > 1) && !context.interpolate,
156
189
  apply: ({context}) => pluralize.plural(context.word),
157
190
  },
158
191
 
159
192
  {
160
193
  where: where(),
161
194
  priority: -1,
162
- match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'one' && !context.imperative,
195
+ match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'one' && !context.imperative && !context.interpolate,
163
196
  apply: ({context}) => {
164
197
  const infinitive = englishHelpers.getInfinitive(context.word)
165
198
  const cases = englishHelpers.conjugateVerb(infinitive)
@@ -170,7 +203,7 @@ const config = {
170
203
  {
171
204
  where: where(),
172
205
  priority: -1,
173
- match: ({context}) => context.evaluateWord && context.paraphrase && context.word && context.number == 'one',
206
+ match: ({context}) => context.evaluateWord && context.paraphrase && context.word && context.number == 'one' && !context.interpolate,
174
207
  apply: ({context}) => {
175
208
  return pluralize.singular(context.word)
176
209
  },
@@ -180,6 +213,10 @@ const config = {
180
213
  where: where(),
181
214
  match: ({context}) => context.paraphrase && context.word && (context.number == 'many' || context.number > 1),
182
215
  apply: ({context}) => {
216
+ // TODO make the sentence that the plural celcius is celcius work
217
+ if (["fahrenheit", "celcius"].includes(context.word)) {
218
+ return context.word
219
+ }
183
220
  return pluralize.plural(context.word)
184
221
  }
185
222
  },
@@ -242,27 +279,30 @@ const config = {
242
279
  ],
243
280
  };
244
281
 
245
- const initializer = ({config}) => {
282
+ function initializer({config}) {
246
283
  config.addArgs((args) => {
284
+ function verbatim(text) {
285
+ args.insert({ marker: 'verbatim', verbatim: text, isResponse: true })
286
+ }
247
287
  return {
288
+ flatten,
248
289
  number: (context) => isMany(context) ? "many" : "one",
249
290
  // number/gender/person etc
250
291
  gw: (context, { number: numberContext }) => {
251
292
  const number = numberContext ? args.number(numberContext) : context.number;
252
293
  return args.gp( { ...context, evaluateWord: true, number } )
253
294
  },
254
- verbatim: (text) => {
255
- args.insert({ marker: 'verbatim', verbatim: text, isResponse: true })
256
- },
295
+ verbatim,
296
+ say: verbatim,
257
297
  interpolate: async (interpolate, context) => {
258
- const evaluator = async (key) => {
298
+ async function evaluator(key) {
259
299
  if (Array.isArray(context[key])) {
260
300
  return args.gsp(context[key])
261
301
  } else {
262
302
  return args.gp(context[key])
263
303
  }
264
304
  }
265
- const getValue = (keyOrValue) => {
305
+ function getValue(keyOrValue) {
266
306
  if (typeof keyOrValue == 'string' && context[keyOrValue]) {
267
307
  return context[keyOrValue]
268
308
  }
@@ -273,7 +313,15 @@ const initializer = ({config}) => {
273
313
  const strings = []
274
314
  let separator = ''
275
315
  for (const element of interpolate) {
276
- if (typeof element == 'string') {
316
+ // { "word": { "marker": "canPassive" } ie { word: <selectionCriteria> }
317
+ if (element.word) {
318
+ const word = args.getWordFromDictionary(element.word)
319
+ if (word) {
320
+ strings.push(separator)
321
+ strings.push(await args.gp(word))
322
+ separator = ' '
323
+ }
324
+ } else if (typeof element == 'string') {
277
325
  separator = element
278
326
  } else if (element.separator && element.values) {
279
327
  let ctr = 0
@@ -287,14 +335,43 @@ const initializer = ({config}) => {
287
335
  vstrings.push(getValue(value))
288
336
  }
289
337
  strings.push(await args.gsp(vstrings))
290
- } else {
291
- let value = element
338
+ } else if (element.semantic) {
339
+ const wordContext = {}
340
+ for (const term of element.semantic) {
341
+ if (term.property) {
342
+ Object.assign(wordContext, context[term.property])
343
+ } else if (term.overrides) {
344
+ Object.assign(wordContext, term.overrides)
345
+ }
346
+ }
347
+ const value = await args.gp(wordContext) //, { options: { debug: { apply: true } } })
348
+ if (value) {
349
+ strings.push(separator)
350
+ strings.push(await args.gp(value))
351
+ separator = ' '
352
+ }
353
+ } else if (element.property) {
354
+ value = context[element.property]
355
+ if (value) {
356
+ if (element.context) {
357
+ value = { ...value, ...element.context }
358
+ }
359
+ strings.push(separator)
360
+ strings.push(await args.gp(value))
361
+ separator = ' '
362
+ }
363
+ } else if (element.context) {
364
+ let value = element.context
292
365
  if (element.property) {
293
366
  value = context[element.property]
294
367
  if (element.context) {
295
368
  Object.assign(value, element.context)
296
369
  }
297
370
  }
371
+ // if (!value?.number && element.number) {
372
+ if (value?.form !== 'infinitive' && element.number) {
373
+ value.number = isMany(context[element.number]) ? "many": "one"
374
+ }
298
375
  if (value) {
299
376
  strings.push(separator)
300
377
  strings.push(await args.gp(value))
@@ -313,7 +390,7 @@ const initializer = ({config}) => {
313
390
 
314
391
  knowledgeModule({
315
392
  config,
316
- includes: [tokenize],
393
+ includes: [tokenize, words],
317
394
  initializer,
318
395
 
319
396
  module,
package/common/help.js CHANGED
@@ -4,16 +4,16 @@ const dialogues = require('./dialogues')
4
4
  const help_tests = require('./help.test.json')
5
5
  const helpers = require('./helpers')
6
6
 
7
- const getHelp = (config, indent=2) => {
7
+ function getHelp(config, indent=2) {
8
8
  indent = ' '.repeat(indent)
9
9
  let help = ''
10
- if (config.tests.length == 0) {
10
+ if (config.getTests().length == 0) {
11
11
  return ''
12
12
  }
13
- help += `${indent}NAME: ${config.name}\n`
14
- help += `${indent}DESCRIPTION: ${config.description}\n\n`
13
+ help += `${indent}NAME: ${config.getName()}\n`
14
+ help += `${indent}DESCRIPTION: ${config.getDescription()}\n\n`
15
15
  help += `${indent}SAMPLE SENTENCES\n\n`
16
- for (const test of config.tests) {
16
+ for (const test of config.getTests()) {
17
17
  if (test.developerTest) {
18
18
  continue
19
19
  }
@@ -47,17 +47,17 @@ const config = {
47
47
  const isAll = kms.length == 0
48
48
  let help = '';
49
49
  let separator = ''
50
- if (isAll || kms.includes(config.name)) {
51
- if (config.name !== 'tester') {
50
+ if (isAll || kms.includes(config.getName())) {
51
+ if (config.getName() !== 'tester') {
52
52
  help += getHelp(config)
53
53
  separator = '\n'
54
54
  }
55
55
  }
56
56
 
57
- if (config.configs.length > 1) {
58
- for (km of config.configs) {
57
+ if (config.getConfigs().length > 1) {
58
+ for (km of config.getConfigs()) {
59
59
  if (km._config instanceof Config) {
60
- if (isAll || kms.includes(km._config.name)) {
60
+ if (isAll || kms.includes(km._config.getName())) {
61
61
  help += separator + getHelp(km._config)
62
62
  separator = '\n'
63
63
  }
@@ -82,7 +82,7 @@ const config = {
82
82
  },
83
83
  };
84
84
 
85
- const initializer = ({ config, addWord, kms }) => {
85
+ function initializer({ config, addWord, kms }) {
86
86
  const names = new Set()
87
87
  for (const name in kms) {
88
88
  names.add(name);
@@ -52,6 +52,7 @@
52
52
  },
53
53
  "contexts": [
54
54
  {
55
+ "context_id": 2,
55
56
  "context_index": 1,
56
57
  "dead": true,
57
58
  "default": true,
@@ -230,6 +231,8 @@
230
231
  ]
231
232
  },
232
233
  "objects": {
234
+ "associations": [
235
+ ],
233
236
  "nameToUUID": {
234
237
  "articles": "articles2",
235
238
  "asking": "asking2",
@@ -244,50 +247,71 @@
244
247
  "punctuation": "punctuation2",
245
248
  "sdefaults": "sdefaults2",
246
249
  "stm": "stm2",
247
- "tokenize": "tokenize2"
250
+ "tokenize": "tokenize2",
251
+ "words": "words2"
248
252
  },
249
253
  "namespaced": {
250
254
  "articles2": {
255
+ "km": "articles2"
251
256
  },
252
257
  "asking2": {
258
+ "km": "asking2"
253
259
  },
254
260
  "conjunction2": {
261
+ "km": "conjunction2"
255
262
  },
256
263
  "dialogues2": {
257
264
  "idSuffix": "",
265
+ "km": "dialogues2",
258
266
  "mentioned": [
259
267
  ],
260
268
  "variables": {
261
269
  }
262
270
  },
263
271
  "evaluate2": {
272
+ "km": "evaluate2"
264
273
  },
265
274
  "gdefaults2": {
275
+ "km": "gdefaults2"
266
276
  },
267
277
  "help1": {
278
+ "km": "help1"
268
279
  },
269
280
  "meta2": {
281
+ "km": "meta2"
270
282
  },
271
283
  "negation2": {
284
+ "km": "negation2"
272
285
  },
273
286
  "pos2": {
287
+ "km": "pos2"
274
288
  },
275
289
  "punctuation2": {
290
+ "km": "punctuation2"
276
291
  },
277
292
  "sdefaults2": {
293
+ "km": "sdefaults2"
278
294
  },
279
295
  "stm2": {
296
+ "km": "stm2",
280
297
  "mentioned": [
281
298
  ],
282
299
  "variables": {
283
300
  }
284
301
  },
285
302
  "tokenize2": {
303
+ "km": "tokenize2"
304
+ },
305
+ "words2": {
306
+ "km": "words2",
307
+ "words": [
308
+ ]
286
309
  }
287
310
  },
288
311
  "processed": [
289
312
  {
290
313
  "context": {
314
+ "context_id": 2,
291
315
  "context_index": 1,
292
316
  "dead": true,
293
317
  "default": true,
@@ -352,9 +376,12 @@
352
376
  "value": "help",
353
377
  "word": "help"
354
378
  },
355
- "generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)",
356
- "paraphrases": "help",
357
- "paraphrasesParenthesized": "(help)",
379
+ "generatedParenthesized": [
380
+ ],
381
+ "paraphrases": [
382
+ ],
383
+ "paraphrasesParenthesized": [
384
+ ],
358
385
  "responses": [
359
386
  " NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
360
387
  ]
@@ -626,6 +653,7 @@
626
653
  },
627
654
  "contexts": [
628
655
  {
656
+ "context_id": 2,
629
657
  "context_index": 1,
630
658
  "dead": true,
631
659
  "default": true,
@@ -645,7 +673,7 @@
645
673
  }
646
674
  ],
647
675
  "generatedParenthesized": [
648
- "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)"
676
+ "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)"
649
677
  ],
650
678
  "metadata": {
651
679
  "opChoices": [
@@ -665,6 +693,8 @@
665
693
  ]
666
694
  },
667
695
  "objects": {
696
+ "associations": [
697
+ ],
668
698
  "nameToUUID": {
669
699
  "articles": "articles2",
670
700
  "asking": "asking2",
@@ -679,50 +709,71 @@
679
709
  "punctuation": "punctuation2",
680
710
  "sdefaults": "sdefaults2",
681
711
  "stm": "stm2",
682
- "tokenize": "tokenize2"
712
+ "tokenize": "tokenize2",
713
+ "words": "words2"
683
714
  },
684
715
  "namespaced": {
685
716
  "articles2": {
717
+ "km": "articles2"
686
718
  },
687
719
  "asking2": {
720
+ "km": "asking2"
688
721
  },
689
722
  "conjunction2": {
723
+ "km": "conjunction2"
690
724
  },
691
725
  "dialogues2": {
692
726
  "idSuffix": "",
727
+ "km": "dialogues2",
693
728
  "mentioned": [
694
729
  ],
695
730
  "variables": {
696
731
  }
697
732
  },
698
733
  "evaluate2": {
734
+ "km": "evaluate2"
699
735
  },
700
736
  "gdefaults2": {
737
+ "km": "gdefaults2"
701
738
  },
702
739
  "help1": {
740
+ "km": "help1"
703
741
  },
704
742
  "meta2": {
743
+ "km": "meta2"
705
744
  },
706
745
  "negation2": {
746
+ "km": "negation2"
707
747
  },
708
748
  "pos2": {
749
+ "km": "pos2"
709
750
  },
710
751
  "punctuation2": {
752
+ "km": "punctuation2"
711
753
  },
712
754
  "sdefaults2": {
755
+ "km": "sdefaults2"
713
756
  },
714
757
  "stm2": {
758
+ "km": "stm2",
715
759
  "mentioned": [
716
760
  ],
717
761
  "variables": {
718
762
  }
719
763
  },
720
764
  "tokenize2": {
765
+ "km": "tokenize2"
766
+ },
767
+ "words2": {
768
+ "km": "words2",
769
+ "words": [
770
+ ]
721
771
  }
722
772
  },
723
773
  "processed": [
724
774
  {
725
775
  "context": {
776
+ "context_id": 2,
726
777
  "context_index": 1,
727
778
  "dead": true,
728
779
  "default": true,
@@ -740,11 +791,14 @@
740
791
  "value": "help",
741
792
  "word": "help"
742
793
  },
743
- "generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)",
744
- "paraphrases": "help",
745
- "paraphrasesParenthesized": "(help)",
794
+ "generatedParenthesized": [
795
+ ],
796
+ "paraphrases": [
797
+ ],
798
+ "paraphrasesParenthesized": [
799
+ ],
746
800
  "responses": [
747
- " NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
801
+ " NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
748
802
  ]
749
803
  }
750
804
  ]
@@ -757,7 +811,7 @@
757
811
  ],
758
812
  "query": "help",
759
813
  "responses": [
760
- " NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
814
+ " NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n every distributable\n each distributable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
761
815
  ],
762
816
  "summaries": [
763
817
  {
@@ -38,7 +38,7 @@ class API {
38
38
  const modifierIds = modifiers.map( (modifier) => this.args.kms.dialogues.api.toScopedId(modifier) )
39
39
  const modifiersObjectId = `${modifierIds.join("_")}_${objectId}`
40
40
 
41
- const toWord = (object) => {
41
+ function toWord(object) {
42
42
  if (typeof object == 'string') {
43
43
  return object
44
44
  }
@@ -1,7 +1,13 @@
1
1
  const { propertyToArray } = require('../helpers.js')
2
2
 
3
- const asList = (context) => {
4
- if (context.marker === 'list') {
3
+ function asList(context) {
4
+ if (Array.isArray(context)) {
5
+ return {
6
+ marker: 'list',
7
+ // types: [context.marker],
8
+ value: context
9
+ }
10
+ } else if (context.marker === 'list') {
5
11
  return context
6
12
  }
7
13
  return {
@@ -11,60 +17,64 @@ const asList = (context) => {
11
17
  }
12
18
  }
13
19
 
14
- const listable = (hierarchy) => (c, type) => {
15
- if (!c) {
16
- return false
17
- }
18
- if (hierarchy.isA(c.marker, type)) {
19
- return true
20
- }
21
- if (c.marker === 'list') {
22
- for (const t of c.types) {
23
- if (hierarchy.isA(t, type)) {
24
- return true
20
+ function listable(hierarchy) {
21
+ return (c, type) => {
22
+ if (!c) {
23
+ return false
24
+ }
25
+ if (hierarchy.isA(c.marker, type)) {
26
+ return true
27
+ }
28
+ if (c.marker === 'list') {
29
+ for (const t of c.types) {
30
+ if (hierarchy.isA(t, type)) {
31
+ return true
32
+ }
25
33
  }
26
34
  }
27
- }
28
- return false
29
- }
30
-
31
- const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
32
- if (!child || !parent) {
33
35
  return false
34
36
  }
37
+ }
35
38
 
36
- if (strict) {
37
- if (child.marker) {
38
- child = child.marker
39
- }
40
- if (parent.marker) {
41
- parent = parent.marker
39
+ function isA(hierarchy) {
40
+ return (child, parent, { strict=false } = {}) => {
41
+ if (!child || !parent) {
42
+ return false
42
43
  }
43
- return hierarchy.isA(child, parent)
44
- } else {
45
- const children = propertyToArray(child)
46
- for (const child of children) {
47
- let okay = false
48
- if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
49
- okay = true
50
- } else {
51
- for (const childT of child.types || [child]) {
52
- if (okay) {
53
- break
54
- }
55
- for (const parentT of parent.types || [parent]) {
56
- if (hierarchy.isA(childT, parentT)) {
57
- okay = true
44
+
45
+ if (strict) {
46
+ if (child.marker) {
47
+ child = child.marker
48
+ }
49
+ if (parent.marker) {
50
+ parent = parent.marker
51
+ }
52
+ return hierarchy.isA(child, parent)
53
+ } else {
54
+ const children = propertyToArray(child)
55
+ for (const child of children) {
56
+ let okay = false
57
+ if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
58
+ okay = true
59
+ } else {
60
+ for (const childT of child.types || [child]) {
61
+ if (okay) {
58
62
  break
59
63
  }
64
+ for (const parentT of parent.types || [parent]) {
65
+ if (hierarchy.isA(childT, parentT)) {
66
+ okay = true
67
+ break
68
+ }
69
+ }
60
70
  }
61
71
  }
72
+ if (!okay) {
73
+ return false
74
+ }
62
75
  }
63
- if (!okay) {
64
- return false
65
- }
76
+ return true
66
77
  }
67
- return true
68
78
  }
69
79
  }
70
80
 
@@ -86,8 +86,8 @@ function getTime(time) {
86
86
  return { hour, minute, second }
87
87
  }
88
88
 
89
- instantiate = (isA, now, context) => {
90
- const getType = (context, type) => {
89
+ function instantiate(isA, now, context) {
90
+ function getType(context, type) {
91
91
  if (context.marker == 'onDate_dates' && context.date?.marker == type) {
92
92
  return context.date
93
93
  } if (context.marker == type) {