tpmkms_4wp 7.12.8 → 8.0.0-beta.1

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 (95) hide show
  1. package/common/animals.instance.json +192 -406
  2. package/common/animals.js +1 -1
  3. package/common/avatar.js +7 -5
  4. package/common/characters.js +12 -6
  5. package/common/{pipboyTemplate.instance.json → colors.instance.json} +13784 -8900
  6. package/common/colors.js +71 -0
  7. package/common/colors.test.json +4860 -0
  8. package/common/concept.js +2 -2
  9. package/common/crew.instance.json +3945 -3636
  10. package/common/crew.js +5 -3
  11. package/common/currency.js +0 -2
  12. package/common/dialogues.js +152 -20
  13. package/common/dialogues.test.json +1053 -33
  14. package/common/dimension.instance.json +750 -86
  15. package/common/dimension.js +15 -7
  16. package/common/dimension.test.json +289 -312
  17. package/common/edible.instance.json +446 -578
  18. package/common/edible.js +1 -1
  19. package/common/emotions.instance.json +67 -39
  20. package/common/emotions.js +1 -1
  21. package/common/fastfood.instance.json +1769 -2136
  22. package/common/fastfood.js +2 -2
  23. package/common/fastfood.test.json +7941 -3647
  24. package/common/formulas.instance.json +996 -0
  25. package/common/formulas.js +19 -6
  26. package/common/formulas.test.json +504 -2896
  27. package/common/gdefaults.js +2 -0
  28. package/common/help.js +7 -2
  29. package/common/help.test.json +18 -10
  30. package/common/helpers/concept.js +29 -9
  31. package/common/helpers/dialogues.js +17 -1
  32. package/common/helpers/formulas.js +0 -14
  33. package/common/helpers/meta.js +0 -1
  34. package/common/helpers/properties.js +6 -13
  35. package/common/helpers.js +5 -0
  36. package/common/javascript.js +8 -6
  37. package/common/kirk.instance.json +5 -1
  38. package/common/kirk.js +1 -1
  39. package/common/length.instance.json +417 -811
  40. package/common/length.js +1 -1
  41. package/common/math.instance.json +1938 -1
  42. package/common/math.js +17 -5
  43. package/common/meta.instance.json +1 -1
  44. package/common/meta.js +33 -10
  45. package/common/numbers.js +28 -24
  46. package/common/ordering.instance.json +98 -138
  47. package/common/ordering.js +1 -1
  48. package/common/people.instance.json +68 -121
  49. package/common/people.js +1 -1
  50. package/common/pipboy.instance.json +23411 -1076
  51. package/common/pipboy.js +31 -4
  52. package/common/pipboy.test.json +13 -9
  53. package/common/pokemon.instance.json +172 -223
  54. package/common/pokemon.js +1 -1
  55. package/common/pressure.instance.json +131 -81
  56. package/common/pressure.js +1 -1
  57. package/common/properties.instance.json +25 -49
  58. package/common/properties.js +20 -15
  59. package/common/properties.test.json +17605 -4030
  60. package/common/punctuation.js +8 -0
  61. package/common/punctuation.test.json +233 -5
  62. package/common/reports.instance.json +33 -65
  63. package/common/reports.js +9 -9
  64. package/common/scorekeeper.instance.json +1 -1
  65. package/common/scorekeeper.js +9 -7
  66. package/common/sizeable.js +7 -2
  67. package/common/spock.instance.json +5 -1
  68. package/common/spock.js +1 -1
  69. package/common/stm.js +16 -5
  70. package/common/tell.js +4 -2
  71. package/common/temperature.instance.json +142 -252
  72. package/common/temperature.js +1 -1
  73. package/common/testing.js +0 -1
  74. package/common/time.js +36 -20
  75. package/common/time.test.json +66 -44
  76. package/common/tokenize.js +47 -0
  77. package/common/tokenize.test.json +87 -0
  78. package/common/ui.instance.json +13 -1
  79. package/common/ui.js +0 -1
  80. package/common/weight.instance.json +335 -228
  81. package/common/weight.js +1 -1
  82. package/common/weight.test.json +242 -238
  83. package/main.js +6 -8
  84. package/package.json +10 -18
  85. package/common/dimensionTemplate.instance.json +0 -582
  86. package/common/dimensionTemplate.js +0 -35
  87. package/common/dimensionTemplate.test.json +0 -2
  88. package/common/formulasTemplate.instance.json +0 -483
  89. package/common/formulasTemplate.js +0 -30
  90. package/common/formulasTemplate.test.json +0 -2
  91. package/common/mathTemplate.instance.json +0 -1635
  92. package/common/mathTemplate.js +0 -32
  93. package/common/mathTemplate.test.json +0 -1422
  94. package/common/pipboyTemplate.js +0 -48
  95. package/common/pipboyTemplate.test.json +0 -2
@@ -1,6 +1,7 @@
1
1
  const pluralize = require('pluralize')
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
4
+ const tokenize = require('./tokenize.js')
4
5
  const gdefaults_tests = require('./gdefaults.test.json')
5
6
  const { isMany } = require('./helpers.js')
6
7
 
@@ -182,6 +183,7 @@ let configStruct = {
182
183
 
183
184
  const createConfig = () => {
184
185
  const config = new Config(configStruct, module)
186
+ config.add(tokenize())
185
187
  config.initializer( ({config}) => {
186
188
  config.addArgs((args) => {
187
189
  return {
package/common/help.js CHANGED
@@ -7,6 +7,9 @@ const helpers = require('./helpers')
7
7
  const getHelp = (config, indent=2) => {
8
8
  indent = ' '.repeat(indent)
9
9
  let help = ''
10
+ if (config.tests.length == 0) {
11
+ return ''
12
+ }
10
13
  help += `${indent}NAME: ${config.name}\n`
11
14
  help += `${indent}DESCRIPTION: ${config.description}\n\n`
12
15
  help += `${indent}SAMPLE SENTENCES\n\n`
@@ -72,8 +75,10 @@ const configStruct = {
72
75
  debug: false,
73
76
  version: '3',
74
77
  words: {
75
- // "km1": { "the": [{"id": "the", "initial": "{ modifiers: [] }" }],
76
- 'km1': [{id: "km", initial: "{ value: 'km1', word: 'km1' }", development: true }],
78
+ "literals": {
79
+ // "km1": { "the": [{"id": "the", "initial": "{ modifiers: [] }" }],
80
+ 'km1': [{id: "km", initial: "{ value: 'km1', word: 'km1' }", development: true }],
81
+ }
77
82
  },
78
83
  };
79
84
 
@@ -120,7 +120,7 @@
120
120
  }
121
121
  ],
122
122
  "generatedParenthesized": [
123
- "( 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n)"
123
+ "( 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)"
124
124
  ],
125
125
  "metadata": {
126
126
  "opChoices": [
@@ -219,10 +219,12 @@
219
219
  "pos": "pos2",
220
220
  "punctuation": "punctuation2",
221
221
  "sdefaults": "sdefaults2",
222
- "stm": "stm2"
222
+ "stm": "stm2",
223
+ "tokenize": "tokenize2"
223
224
  },
224
225
  "namespaced": {
225
226
  "dialogues2": {
227
+ "idSuffix": "",
226
228
  "mentioned": [
227
229
  ],
228
230
  "variables": {
@@ -245,6 +247,8 @@
245
247
  ],
246
248
  "variables": {
247
249
  }
250
+ },
251
+ "tokenize2": {
248
252
  }
249
253
  },
250
254
  "processed": [
@@ -312,11 +316,11 @@
312
316
  "value": "help",
313
317
  "word": "help"
314
318
  },
315
- "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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n)",
319
+ "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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)",
316
320
  "paraphrases": "help",
317
321
  "paraphrasesParenthesized": "(help)",
318
322
  "responses": [
319
- " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n"
323
+ " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
320
324
  ]
321
325
  }
322
326
  ]
@@ -329,7 +333,7 @@
329
333
  ],
330
334
  "query": "help with help and dialogues",
331
335
  "responses": [
332
- " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n"
336
+ " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
333
337
  ]
334
338
  },
335
339
  {
@@ -357,7 +361,7 @@
357
361
  }
358
362
  ],
359
363
  "generatedParenthesized": [
360
- "( 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n\n NAME: sdefaults\n DESCRIPTION: defaults for semantics\n\n SAMPLE SENTENCES\n\n\n NAME: pos\n DESCRIPTION: parts of speech\n\n SAMPLE SENTENCES\n\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n NAME: gdefaults\n DESCRIPTION: defaults for generators\n\n SAMPLE SENTENCES\n\n)"
364
+ "( 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n\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: 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)"
361
365
  ],
362
366
  "metadata": {
363
367
  "opChoices": [
@@ -385,10 +389,12 @@
385
389
  "pos": "pos2",
386
390
  "punctuation": "punctuation2",
387
391
  "sdefaults": "sdefaults2",
388
- "stm": "stm2"
392
+ "stm": "stm2",
393
+ "tokenize": "tokenize2"
389
394
  },
390
395
  "namespaced": {
391
396
  "dialogues2": {
397
+ "idSuffix": "",
392
398
  "mentioned": [
393
399
  ],
394
400
  "variables": {
@@ -411,6 +417,8 @@
411
417
  ],
412
418
  "variables": {
413
419
  }
420
+ },
421
+ "tokenize2": {
414
422
  }
415
423
  },
416
424
  "processed": [
@@ -432,11 +440,11 @@
432
440
  "value": "help",
433
441
  "word": "help"
434
442
  },
435
- "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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n\n NAME: sdefaults\n DESCRIPTION: defaults for semantics\n\n SAMPLE SENTENCES\n\n\n NAME: pos\n DESCRIPTION: parts of speech\n\n SAMPLE SENTENCES\n\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n NAME: gdefaults\n DESCRIPTION: defaults for generators\n\n SAMPLE SENTENCES\n\n)",
443
+ "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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n\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: 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)",
436
444
  "paraphrases": "help",
437
445
  "paraphrasesParenthesized": "(help)",
438
446
  "responses": [
439
- " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n\n NAME: sdefaults\n DESCRIPTION: defaults for semantics\n\n SAMPLE SENTENCES\n\n\n NAME: pos\n DESCRIPTION: parts of speech\n\n SAMPLE SENTENCES\n\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n NAME: gdefaults\n DESCRIPTION: defaults for generators\n\n SAMPLE SENTENCES\n\n"
447
+ " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n\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: 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"
440
448
  ]
441
449
  }
442
450
  ]
@@ -449,7 +457,7 @@
449
457
  ],
450
458
  "query": "help",
451
459
  "responses": [
452
- " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n\n NAME: sdefaults\n DESCRIPTION: defaults for semantics\n\n SAMPLE SENTENCES\n\n\n NAME: pos\n DESCRIPTION: parts of speech\n\n SAMPLE SENTENCES\n\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n NAME: gdefaults\n DESCRIPTION: defaults for generators\n\n SAMPLE SENTENCES\n\n"
460
+ " 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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n\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: 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"
453
461
  ]
454
462
  }
455
463
  ]
@@ -1,6 +1,6 @@
1
1
  const pluralize = require('pluralize')
2
2
  const deepEqual = require('deep-equal')
3
- const { chooseNumber } = require('../helpers.js')
3
+ const { chooseNumber, zip } = require('../helpers.js')
4
4
  const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
5
5
 
6
6
  class API {
@@ -31,13 +31,25 @@ class API {
31
31
  // for example, "crew member" or "photon torpedo"
32
32
  // TODO account for modifier a complex phrase for example "hot (chicken strips)"
33
33
  kindOfConcept({ config, modifiers, object }) {
34
- const objectId = pluralize.singular(object)
34
+ // TODO make the modifiers objects then below for add words for modifiers only do if !unknown
35
+ // const objectId = pluralize.singular(object)
36
+ const objectId = this.args.kms.dialogues.api.toScopedId(object)
37
+
35
38
  // const modifierIds = modifiers.map( (modifier) => pluralize.singular(modifier) )
36
- const modifierIds = modifiers
37
- const modifiersObjectId = `${modifierIds.join("_")}_${objectId}`
39
+ const modifierIds = modifiers.map( (modifier) => this.args.kms.dialogues.api.toScopedId(modifier) )
40
+ const modifiersObjectId = `${modifiers.join("_")}_${objectId}`
38
41
 
39
- const objectSingular = pluralize.singular(object)
40
- const objectPlural = pluralize.plural(object)
42
+ const toWord = (object) => {
43
+ if (typeof object == 'string') {
44
+ return object
45
+ }
46
+ return object.text
47
+ }
48
+ const objectWord = toWord(object)
49
+ // const objectWord = object
50
+ // TODO call evaluator to pick up overrides
51
+ const objectSingular = pluralize.singular(objectWord)
52
+ const objectPlural = pluralize.plural(objectWord)
41
53
  // config.addOperator({ pattern: `(${modifierIds.map((modifierId) => `(${modifierId}/*)`).join(' ')} [${modifiersObjectId}] (${objectId}/0))`, allowDups: true })
42
54
  config.addOperator({ pattern: `(${modifierIds.map((modifierId) => `(${modifierId}/*)`).join(' ')} [${modifiersObjectId}] (${objectId}/*))`, allowDups: true })
43
55
  // config.addOperator({ pattern: `(<${modifierId}|> ([${objectId}|]))`, allowDups: true })
@@ -59,10 +71,18 @@ class API {
59
71
  config.addOperator({ pattern: `([${objectId}|])`, allowDups: true })
60
72
  }
61
73
 
74
+ if (object.unknown) {
75
+ config.addWord(objectSingular, { id: objectId, initial: `{ value: '${objectId}', number: 'one' }`})
76
+ config.addWord(objectPlural, { id: objectId, initial: `{ value: '${objectId}', number: 'many' }`})
77
+ }
62
78
 
63
- config.addWord(objectSingular, { id: objectId, initial: `{ value: '${objectId}', number: 'one' }`})
64
- config.addWord(objectPlural, { id: objectId, initial: `{ value: '${objectId}', number: 'many' }`})
65
- modifierIds.forEach((modifierId) => config.addWord(modifierId, { id: modifierId, initial: `{ value: '${modifierId}' }`}))
79
+ zip(modifiers, modifierIds).forEach(([modifierWord, modifierId]) => {
80
+ // config.addWord(modifier, { id: modifierId, initial: `{ value: '${modifierId}' }`})
81
+ // TODO call evaluator to pick up overrides
82
+ config.addWord(pluralize.singular(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'one' }`})
83
+ config.addWord(pluralize.plural(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'many' }`})
84
+ })
85
+ // modifierds.forEach((modifierId) => config.addWord(modifierId, { id: modifierId, initial: `{ value: '${modifierId}' }`}))
66
86
 
67
87
  modifierIds.forEach((modifierId) => config.addBridge({ id: modifierId, level: 0, bridge: `{ ...next(operator), value: '${modifierId}' }`, allowDups: true }))
68
88
  config.addBridge({ id: objectId, level: 0, bridge: `{ ...next(operator), value: '${objectId}' }`, allowDups: true })
@@ -4,6 +4,21 @@ const { indent, focus } = require('../helpers')
4
4
  class API {
5
5
  initialize({ objects }) {
6
6
  this._objects = objects
7
+ this._objects.idSuffix = ''
8
+ }
9
+
10
+ setIdSuffix(idSuffix) {
11
+ this._objects.idSuffix = idSuffix
12
+ }
13
+
14
+ toScopedId(context) {
15
+ if (typeof context == 'string') {
16
+ return pluralize.singular(context) + this._objects.idSuffix
17
+ } else {
18
+ const { unknown, value, word } = context;
19
+ // return unknown ? pluralize.singular(word) + this._objects.idSuffix : pluralize.singular(value || word)
20
+ return unknown ? pluralize.singular(word) + this._objects.idSuffix : value || pluralize.singular(word)
21
+ }
7
22
  }
8
23
 
9
24
  warningNotEvaluated(log, value) {
@@ -64,7 +79,8 @@ class API {
64
79
  if (!value) {
65
80
  return
66
81
  }
67
- const concept = pluralize.singular(value)
82
+ // const concept = pluralize.singular(value)
83
+ const concept = this.toScopedId(context)
68
84
  if (config.exists(concept)) {
69
85
  return concept
70
86
  }
@@ -42,11 +42,9 @@ const unify = (rule, value) => {
42
42
 
43
43
  const f = (values, variable) => (value) => {
44
44
  if (!value) {
45
- debugger
46
45
  throw new Error("Value not present")
47
46
  }
48
47
  if (values[variable] && values[variable] != value) {
49
- debugger
50
48
  throw new Error("Variable already set to different value")
51
49
  }
52
50
  values[variable] = value
@@ -80,18 +78,6 @@ function solveFor(expression, variable, isVariable = (expression) => typeof expr
80
78
  return c1.value == c2.value
81
79
  }
82
80
 
83
- /*
84
- for (let rule of rules) {
85
- debugger
86
- const body = unify(rule, expression)
87
- const lVars = getVariables(body.left, isVariable)
88
- const rVars = getVariables(body.right, isVariable)
89
- if (lVars.length == 1 && sameVar(lVars[0], variable) && !rVars.some((c) => sameVar(c, variable))) {
90
- return body
91
- }
92
- }
93
- */
94
-
95
81
  const lVars = getVariables(expression.left, isVariable)
96
82
  const rVars = getVariables(expression.right, isVariable)
97
83
  if (lVars.length == 1 && sameVar(lVars[0], variable) && !rVars.some((c) => sameVar(c, variable))) {
@@ -104,7 +104,6 @@ const translationMappingToInstantiatorMappings = (translationMapping, from , to
104
104
  match: ({context}) => context[tm.to],
105
105
  apply: ({context}) => {
106
106
  // Object.assign(context[tm.to], from[tm.from])
107
- // debugger;
108
107
  context[tm.to] = from[tm.from]
109
108
  if (context[tm.to]) {
110
109
  context[tm.to].instantiated = true
@@ -81,7 +81,6 @@ class API {
81
81
  match: ({context}) => context[tm.to],
82
82
  apply: ({context}) => {
83
83
  // Object.assign(context[tm.to], from[tm.from])
84
- // debugger;
85
84
  context[tm.to] = from[tm.from]
86
85
  if (context[tm.to]) {
87
86
  context[tm.to].instantiated = true
@@ -501,12 +500,6 @@ class API {
501
500
  for (let argument of context.focusable || []) {
502
501
  const value = api.toValue(context[argument])
503
502
  if (value) {
504
- /*
505
- if (value == 'cleo') {
506
- debugger;
507
- hierarchy.isA()
508
- }
509
- */
510
503
  const minimas = hierarchy.minima(context[argument].types)
511
504
  for (let type of minimas) {
512
505
  if (config.exists(value)) {
@@ -689,7 +682,7 @@ class API {
689
682
  }
690
683
 
691
684
  getPropertyDirectly(object, property, g) {
692
- if (property == 'properties') {
685
+ if (property == 'property') {
693
686
  const objectProps = this.propertiesFH.getValue([object])
694
687
  const values = []
695
688
  for (let key of Object.keys(objectProps)) {
@@ -734,7 +727,7 @@ class API {
734
727
  }
735
728
 
736
729
  knownObject(object) {
737
- if (object == 'properties') {
730
+ if (object == 'property') {
738
731
  return object
739
732
  }
740
733
  if ((object || {}).value) {
@@ -746,7 +739,7 @@ class API {
746
739
  }
747
740
 
748
741
  hasProperty(object, property) {
749
- if (property == 'properties') {
742
+ if (property == 'property') {
750
743
  return true;
751
744
  }
752
745
 
@@ -773,8 +766,9 @@ class API {
773
766
  knownProperty(object, property) {
774
767
  object = this.toValue(object)
775
768
  property = this.toValue(property)
776
- if (property == 'properties') {
777
- return true;
769
+ if (property == 'property') {
770
+ const objectProps = this.propertiesFH.getValue([object])
771
+ return !_.isEmpty(objectProps)
778
772
  }
779
773
 
780
774
  // go up the hierarchy
@@ -916,7 +910,6 @@ class API {
916
910
  }
917
911
 
918
912
  set config(config) {
919
- debugger
920
913
  this._config = config
921
914
  /*
922
915
  const toJSON = (h) => {
package/common/helpers.js CHANGED
@@ -33,6 +33,10 @@ const getCount = (context) => {
33
33
  }
34
34
  }
35
35
 
36
+ const words = (base, additional = {}) => {
37
+ return [{ word: pluralize.singular(base), number: 'one', ...additional }, { word: pluralize.plural(base), number: 'many', ...additional }]
38
+ }
39
+
36
40
  const isMany = (context) => {
37
41
  if (((context || {}).value || {}).marker == 'list' && (((context || {}).value || {}).value || []).length > 1) {
38
42
  return true
@@ -160,6 +164,7 @@ module.exports = {
160
164
  chooseNumber,
161
165
  zip,
162
166
  focus,
167
+ words,
163
168
  propertyToArray,
164
169
  wordNumber,
165
170
  }
@@ -18,12 +18,14 @@ let configStruct = {
18
18
  debug: false,
19
19
  version: '3',
20
20
  words: {
21
- "=": [{"id": "assignment", "initial": "{ value: 1 }" }],
22
- /*
23
- " ([0-9]+)": [{"id": "number", "initial": "{ value: int(group[0]) }" }],
24
- "one": [{"id": "number", "initial": "{ value: 1 }" }],
25
- "ten": [{"id": "number", "initial": "{ value: 10 }" }],
26
- */
21
+ "literals": {
22
+ "=": [{"id": "assignment", "initial": "{ value: 1 }" }],
23
+ /*
24
+ " ([0-9]+)": [{"id": "number", "initial": "{ value: int(group[0]) }" }],
25
+ "one": [{"id": "number", "initial": "{ value: 1 }" }],
26
+ "ten": [{"id": "number", "initial": "{ value: 10 }" }],
27
+ */
28
+ }
27
29
  },
28
30
 
29
31
  hierarchy: [
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [
2
+ "configs": [
3
3
  "you are kirk"
4
4
  ],
5
5
  "resultss": [
@@ -353,6 +353,10 @@
353
353
  "dog",
354
354
  "theAble"
355
355
  ],
356
+ [
357
+ "doubleQuote",
358
+ "queryable"
359
+ ],
356
360
  [
357
361
  "eagle",
358
362
  "bird"
package/common/kirk.js CHANGED
@@ -5,7 +5,7 @@ const kirk_tests = require('./kirk.test.json')
5
5
  const kirk_instance = require('./kirk.instance.json')
6
6
 
7
7
  const template = {
8
- "queries": [
8
+ configs: [
9
9
  "you are kirk",
10
10
  ]
11
11
  };