tpmkms_4wp 9.5.1-beta.9 → 9.6.0-beta.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 (114) hide show
  1. package/common/animals.instance.json +130 -0
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +12 -4
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2182 -5
  6. package/common/can.js +102 -39
  7. package/common/can.test.json +51307 -0
  8. package/common/colors.instance.json +142 -30
  9. package/common/colors.js +3 -6
  10. package/common/comparable.instance.json +31 -1
  11. package/common/comparable.js +3 -6
  12. package/common/concept.js +25 -27
  13. package/common/concept.test.json +142 -120
  14. package/common/conjunction.test.json +32 -42
  15. package/common/crew.instance.json +400 -126
  16. package/common/crew.js +3 -6
  17. package/common/dateTimeSelectors.instance.json +2 -2
  18. package/common/dateTimeSelectors.js +6 -9
  19. package/common/dateTimeSelectors.test.json +76935 -35739
  20. package/common/dates.instance.json +50 -84
  21. package/common/dates.js +3 -6
  22. package/common/dates.test.json +284 -287
  23. package/common/dialogues.js +33 -115
  24. package/common/dialogues.test.json +1248 -1152
  25. package/common/dimension.instance.json +21498 -566
  26. package/common/dimension.js +147 -52
  27. package/common/dimension.test.json +10979 -4625
  28. package/common/drone.instance.json +24709 -0
  29. package/common/drone.js +662 -0
  30. package/common/drone.test.json +30522 -0
  31. package/common/drone_v1.instance.json +24703 -0
  32. package/common/drone_v1.js +596 -0
  33. package/common/drone_v1.test.json +115538 -0
  34. package/common/edible.instance.json +365 -65
  35. package/common/edible.js +3 -5
  36. package/common/emotions.instance.json +57 -70
  37. package/common/emotions.js +3 -6
  38. package/common/errors.js +3 -3
  39. package/common/fastfood.instance.json +1270 -244
  40. package/common/fastfood.js +10 -12
  41. package/common/fastfood.test.json +6970 -6829
  42. package/common/formulas.instance.json +10 -0
  43. package/common/formulas.js +2 -1
  44. package/common/gdefaults.js +58 -13
  45. package/common/help.js +9 -9
  46. package/common/help.test.json +65 -11
  47. package/common/helpers/dialogues.js +9 -1
  48. package/common/helpers/properties.js +37 -18
  49. package/common/helpers.js +32 -2
  50. package/common/hierarchy.js +10 -8
  51. package/common/kirk.instance.json +10 -0
  52. package/common/kirk.js +4 -6
  53. package/common/kirk.test.json +600 -424
  54. package/common/latin.instance.json +10 -10
  55. package/common/latin.js +8 -10
  56. package/common/length.instance.json +34659 -3157
  57. package/common/length.js +11 -6
  58. package/common/length.test.json +54357 -2557
  59. package/common/math.instance.json +11 -1
  60. package/common/math.js +2 -1
  61. package/common/menus.instance.json +74 -7
  62. package/common/menus.js +3 -12
  63. package/common/meta.js +4 -5
  64. package/common/nameable.js +29 -15
  65. package/common/nameable.test.json +436 -0
  66. package/common/numbers.js +1 -1
  67. package/common/ordering.instance.json +24 -2
  68. package/common/ordering.js +3 -5
  69. package/common/ordering.test.json +104 -174
  70. package/common/people.instance.json +140 -315
  71. package/common/people.js +3 -5
  72. package/common/pipboy.instance.json +171 -57
  73. package/common/pipboy.js +2 -1
  74. package/common/pokemon.instance.json +135 -5
  75. package/common/pokemon.js +3 -5
  76. package/common/pressure.instance.json +3990 -1981
  77. package/common/pressure.js +3 -5
  78. package/common/pressure.test.json +433 -477
  79. package/common/properties.instance.json +15 -16
  80. package/common/properties.js +10 -9
  81. package/common/properties.test.json +9565 -6951
  82. package/common/rates.instance.json +59 -0
  83. package/common/rates.js +95 -0
  84. package/common/rates.test.json +27702 -0
  85. package/common/reminders.js +5 -8
  86. package/common/reminders.test.json +64635 -25787
  87. package/common/reports.instance.json +22 -2
  88. package/common/reports.js +3 -5
  89. package/common/scorekeeper.js +3 -6
  90. package/common/spock.instance.json +10 -0
  91. package/common/spock.js +4 -7
  92. package/common/spock.test.json +606 -430
  93. package/common/stm.js +37 -20
  94. package/common/temperature.instance.json +3162 -1153
  95. package/common/temperature.js +3 -5
  96. package/common/temperature.test.json +433 -477
  97. package/common/time.instance.json +24852 -0
  98. package/common/time.js +136 -139
  99. package/common/time.test.json +31876 -3757
  100. package/common/ui.instance.json +12 -5
  101. package/common/ui.js +4 -13
  102. package/common/weight.instance.json +10500 -4098
  103. package/common/weight.js +3 -5
  104. package/common/weight.test.json +2601 -2263
  105. package/common/words.instance.json +9 -0
  106. package/common/words.js +50 -0
  107. package/common/words.test.json +2 -0
  108. package/common/wp.instance.json +470 -58
  109. package/common/wp.js +6 -4
  110. package/common/wp.test.json +7385 -6906
  111. package/main.js +6 -2
  112. package/package.json +21 -6
  113. package/common/listener.js +0 -50
  114. package/common/listener.test.json +0 -142
@@ -798,6 +798,16 @@
798
798
  "adjective",
799
799
  false
800
800
  ],
801
+ [
802
+ "stm_current",
803
+ "adjective",
804
+ false
805
+ ],
806
+ [
807
+ "stm_previous",
808
+ "adjective",
809
+ false
810
+ ],
801
811
  [
802
812
  "that",
803
813
  "thisitthat",
@@ -199,7 +199,8 @@ knowledgeModule({
199
199
 
200
200
  module,
201
201
  description: 'Formulas using math',
202
- template: { template, instance },
202
+ instance,
203
+ template,
203
204
  test: {
204
205
  name: './formulas.test.json',
205
206
  contents: tests,
@@ -2,6 +2,7 @@ const pluralize = require('pluralize')
2
2
  const { defaultContextCheck, getValue, isMany } = require('./helpers')
3
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
8
  const helpers = require('./helpers')
@@ -89,7 +90,7 @@ const config = {
89
90
  text.push(await g(m))
90
91
  }
91
92
  } else {
92
- text.push(await g(context[modifier], { isModifier: true }))
93
+ text.push(await g(context[modifier], { assumed: { isModifier: true } }))
93
94
  }
94
95
  }
95
96
  // text.push(context.word)
@@ -151,12 +152,16 @@ const config = {
151
152
  {
152
153
  where: where(),
153
154
  priority: -1,
154
- match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'one' && !context.imperative && !context.interpolate,
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,
155
157
  apply: ({context}) => {
156
158
  const infinitive = englishHelpers.getInfinitive(context.word)
157
- if (context.tense) {
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) {
158
164
  const cases = englishHelpers.conjugateVerb(infinitive)
159
- // console.log(JSON.stringify(cases, null, 2))
160
165
  const def = cases.find((def) => def.tense == context.tense)
161
166
  return def.word
162
167
  } else {
@@ -165,6 +170,7 @@ const config = {
165
170
  },
166
171
  },
167
172
 
173
+ /*
168
174
  {
169
175
  where: where(),
170
176
  priority: -1,
@@ -175,7 +181,7 @@ const config = {
175
181
  return pluralize.singular(context.word)
176
182
  },
177
183
  },
178
-
184
+ */
179
185
  {
180
186
  where: where(),
181
187
  priority: -1,
@@ -207,6 +213,10 @@ const config = {
207
213
  where: where(),
208
214
  match: ({context}) => context.paraphrase && context.word && (context.number == 'many' || context.number > 1),
209
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
+ }
210
220
  return pluralize.plural(context.word)
211
221
  }
212
222
  },
@@ -271,6 +281,9 @@ const config = {
271
281
 
272
282
  function initializer({config}) {
273
283
  config.addArgs((args) => {
284
+ function verbatim(text) {
285
+ args.insert({ marker: 'verbatim', verbatim: text, isResponse: true })
286
+ }
274
287
  return {
275
288
  flatten,
276
289
  number: (context) => isMany(context) ? "many" : "one",
@@ -279,9 +292,8 @@ function initializer({config}) {
279
292
  const number = numberContext ? args.number(numberContext) : context.number;
280
293
  return args.gp( { ...context, evaluateWord: true, number } )
281
294
  },
282
- verbatim: (text) => {
283
- args.insert({ marker: 'verbatim', verbatim: text, isResponse: true })
284
- },
295
+ verbatim,
296
+ say: verbatim,
285
297
  interpolate: async (interpolate, context) => {
286
298
  async function evaluator(key) {
287
299
  if (Array.isArray(context[key])) {
@@ -301,7 +313,15 @@ function initializer({config}) {
301
313
  const strings = []
302
314
  let separator = ''
303
315
  for (const element of interpolate) {
304
- 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') {
305
325
  separator = element
306
326
  } else if (element.separator && element.values) {
307
327
  let ctr = 0
@@ -315,8 +335,33 @@ function initializer({config}) {
315
335
  vstrings.push(getValue(value))
316
336
  }
317
337
  strings.push(await args.gsp(vstrings))
318
- } else {
319
- 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
320
365
  if (element.property) {
321
366
  value = context[element.property]
322
367
  if (element.context) {
@@ -324,7 +369,7 @@ function initializer({config}) {
324
369
  }
325
370
  }
326
371
  // if (!value?.number && element.number) {
327
- if (value?.number !== 'infinitive' && element.number) {
372
+ if (value?.form !== 'infinitive' && element.number) {
328
373
  value.number = isMany(context[element.number]) ? "many": "one"
329
374
  }
330
375
  if (value) {
@@ -345,7 +390,7 @@ function initializer({config}) {
345
390
 
346
391
  knowledgeModule({
347
392
  config,
348
- includes: [tokenize],
393
+ includes: [tokenize, words],
349
394
  initializer,
350
395
 
351
396
  module,
package/common/help.js CHANGED
@@ -7,13 +7,13 @@ const helpers = require('./helpers')
7
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
  }
@@ -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
  {
@@ -83,10 +83,18 @@ class API {
83
83
  }
84
84
  const { word, value, number } = context;
85
85
  if (!value) {
86
+ if (config.exists(context.marker)) {
87
+ return context.marker
88
+ }
86
89
  return
87
90
  }
88
91
  // const concept = pluralize.singular(value)
89
- const concept = this.toScopedId(context)
92
+ let concept = this.toScopedId(context)
93
+ const extraTypes = []
94
+ if (concept == 'unit' && context.objects) {
95
+ concept = context.objects.map((c) => this.toScopedId(c)).join("_")
96
+ types.push(this.toScopedId(context.objects[0]))
97
+ }
90
98
  if (config.exists(concept)) {
91
99
  return concept
92
100
  }
@@ -10,6 +10,24 @@ const { compose, translationMapping, translationMappingToInstantiatorMappings }
10
10
  class API {
11
11
  constructor() {
12
12
  this.digraph = new Digraph()
13
+ this.hierarchyWatchers = []
14
+ }
15
+
16
+ addHierarchyWatcher(watcher) {
17
+ this.hierarchyWatchers.push(watcher)
18
+ }
19
+
20
+ removeHierarchyWatcher(watcher) {
21
+ this.hierarchyWatchers = this.hierarchyWatchers.filter((w) => w.id == watcher.id)
22
+ }
23
+
24
+ seenHierarchyWatcher(watcherArgs) {
25
+ const args = { ...this.args, ...watcherArgs }
26
+ for (const { match, apply } of this.hierarchyWatchers) {
27
+ if (match(args)) {
28
+ apply(args)
29
+ }
30
+ }
13
31
  }
14
32
 
15
33
  initialize({ km, objects, config }) {
@@ -229,8 +247,8 @@ class API {
229
247
  match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.one && context.one.marker == after[0].tag && context.one.constraints && context.one.constraints[0] && context.one.constraints[0].constraint.marker == edAble.operator && context.one.constraints[0].constraint[before[0].tag].implicit,
230
248
  apply: async ({context, fragments, g, gs, callId}) => {
231
249
  const isToFromM = [{"from":["one"],"to":["two"]},{"from":["two"],"to":["one"]}]
232
- const fromF = fragments(whoIsWhatVerbedBy).contexts()[0]
233
- const toF = fragments(thisIsVerbedByThat)
250
+ const fromF = (await fragments(whoIsWhatVerbedBy)).contexts()[0]
251
+ const toF = await fragments(thisIsVerbedByThat)
234
252
  const to = toF.contexts()[0]
235
253
  const tm = translationMapping(fromF, to)
236
254
  /*
@@ -311,7 +329,6 @@ class API {
311
329
  pattern: `([(${beforeOperators} [${operator}|] ${afterOperators}^)])`,
312
330
  allowDups: true,
313
331
  })
314
- // config.addOperator({ id: operator, level: 1, words: [operator] })
315
332
  config.addBridge({
316
333
  id: operator,
317
334
  level: 1,
@@ -331,7 +348,6 @@ class API {
331
348
  if (create.includes(argument.id)) {
332
349
  // config.addHierarchy('unknown', argument.id)
333
350
  // config.addHierarchy('what', argument.id)
334
- // greg23 <<<<<<<<<<<< doing this
335
351
  config.addHierarchy(argument.id, 'unknown')
336
352
  config.addHierarchy(argument.id, 'what')
337
353
  }
@@ -413,14 +429,14 @@ class API {
413
429
  const conjugation = conjugateVerb(createDef.infinitive)
414
430
  if (can) {
415
431
  const def = conjugation.find((def) => def.form == "pastParticiple")
416
- config.addWord(def.word, { id: operator, initial: `{ value: '${operator}', tense: '${def.tense}' }`})
432
+ config.addWord(def.word, { id: operator, initial: `{ value: '${operator}', isVerb: true, tense: '${def.tense}' }`})
417
433
  }
418
434
  }
419
435
 
420
436
  const operatorPlural = pluralize.singular(operator)
421
437
  const operatorSingular = pluralize.plural(operator)
422
- config.addWord(operatorSingular, { id: operator, initial: `{ value: '${operator}', number: 'one' }`})
423
- config.addWord(operatorPlural, { id: operator, initial: `{ value: '${operator}', number: 'many' }`})
438
+ config.addWord(operatorSingular, { id: operator, initial: `{ value: '${operator}', isVerb: true, number: 'one' }`})
439
+ config.addWord(operatorPlural, { id: operator, initial: `{ value: '${operator}', isVerb: true, number: 'many' }`})
424
440
  }
425
441
 
426
442
  for (const { child, parent } of hierarchy) {
@@ -438,12 +454,12 @@ class API {
438
454
  const beforeIds = before.map((def) => def.id)
439
455
  const afterIds = after.map((def) => def.id)
440
456
  config.addHierarchy(operator, 'canableAction')
441
- config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestion', 0], [beforeIds[0], 0], ['make', 0]], choose: 1 })
442
- config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestion', 0], [beforeIds[0], 0], ['make', 0]], choose: 1 })
443
- config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0]], choose: 1 })
444
- config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0]], choose: 1 })
445
- config.addAssociation({ context: [[afterIds[0], 0], ['canPassive', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
446
- config.addAssociation({ context: [[afterIds[0], 1], ['canPassive', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
457
+ config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestion', 0], [beforeIds[0], 0], [operator, 0]], choose: 1 })
458
+ config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestion', 0], [beforeIds[0], 0], [operator, 0]], choose: 1 })
459
+ config.addAssociation({ context: [[afterIds[0], 0], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0]], choose: 1 })
460
+ config.addAssociation({ context: [[afterIds[0], 1], ['whatCanQuestionPassive', 0], [beforeIds[0], 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0]], choose: 1 })
461
+ config.addAssociation({ context: [[afterIds[0], 0], ['canPassive', 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
462
+ config.addAssociation({ context: [[afterIds[0], 1], ['canPassive', 0], ['beCanPassive', 0], [operator, 0], ['byCanPassive', 0], [beforeIds[0], 0]], choose: 1 })
447
463
  }
448
464
 
449
465
  if (false) {
@@ -473,10 +489,10 @@ class API {
473
489
  config.addGenerator({
474
490
  notes: 'ordering generator for response',
475
491
  match: ({context}) => context.marker == operator && context.evalue && context.isResponse,
476
- apply: async ({context, g, km, flatten}) => {
492
+ apply: async ({context, s, g, km, flatten}) => {
477
493
  const brief = km("dialogues").api.getBrief()
478
494
 
479
- const { evalue } = context
495
+ let { evalue } = context
480
496
  let yesno = ''
481
497
  let hasVariables = false
482
498
  if (context.focusable) {
@@ -510,6 +526,10 @@ class API {
510
526
  if (evalue.truthValueOnly) {
511
527
  return `${yesno}`
512
528
  } else {
529
+ if (context.voice) {
530
+ evalue = await s({ ...evalue, toVoice: context.voice, flatten: false})
531
+ }
532
+
513
533
  const details = await g(Object.assign({}, evalue, { paraphrase: true }))
514
534
  if (yesno) {
515
535
  return `${yesno} ${details}`
@@ -596,7 +616,7 @@ class API {
596
616
  if (relation) {
597
617
  config.addSemantic({
598
618
  notes: `setter for ${operator}`,
599
- match: ({context}) => context.marker == operator,
619
+ match: ({context}) => context.marker == operator && !context.toVoice,
600
620
  apply: ({context, km, hierarchy, config}) => {
601
621
  const api = km('properties').api
602
622
  // add types for arguments
@@ -773,8 +793,7 @@ class API {
773
793
  if (!context) {
774
794
  return;
775
795
  }
776
- return this._km("stm").api.getVariable(context.value);
777
- // return context.value
796
+ return this._km("stm").api.getVariable(context) || context.value;
778
797
  }
779
798
 
780
799
  async getProperty(object, property, g) {