ekms 7.12.8 → 8.0.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/common/animals.instance.json +89 -293
  2. package/common/animals.js +1 -1
  3. package/common/avatar.js +7 -5
  4. package/common/characters.js +12 -5
  5. package/common/crew.instance.json +289 -577
  6. package/common/crew.js +1 -1
  7. package/common/currency.js +0 -2
  8. package/common/dialogues.js +122 -17
  9. package/common/dimension.instance.json +747 -73
  10. package/common/dimension.js +15 -7
  11. package/common/edible.instance.json +243 -435
  12. package/common/edible.js +1 -1
  13. package/common/emotions.instance.json +29 -65
  14. package/common/emotions.js +1 -1
  15. package/common/fastfood.instance.json +1080 -2072
  16. package/common/fastfood.js +1 -1
  17. package/common/formulas.instance.json +992 -0
  18. package/common/formulas.js +19 -6
  19. package/common/formulas.test.json +1187 -3651
  20. package/common/gdefaults.js +2 -0
  21. package/common/help.js +7 -2
  22. package/common/help.test.json +9 -5
  23. package/common/helpers.js +5 -0
  24. package/common/javascript.js +8 -6
  25. package/common/kirk.instance.json +1 -1
  26. package/common/kirk.js +1 -1
  27. package/common/length.instance.json +316 -740
  28. package/common/length.js +1 -1
  29. package/common/math.instance.json +1959 -1
  30. package/common/math.js +17 -5
  31. package/common/meta.instance.json +1 -1
  32. package/common/meta.js +35 -10
  33. package/common/numbers.js +28 -24
  34. package/common/ordering.instance.json +37 -153
  35. package/common/ordering.js +1 -1
  36. package/common/people.instance.json +50 -78
  37. package/common/people.js +1 -1
  38. package/common/pipboy.instance.json +23431 -1082
  39. package/common/pipboy.js +31 -4
  40. package/common/pipboy.test.json +13 -9
  41. package/common/pokemon.instance.json +41 -141
  42. package/common/pokemon.js +1 -1
  43. package/common/pressure.instance.json +93 -33
  44. package/common/pressure.js +1 -1
  45. package/common/properties.instance.json +21 -49
  46. package/common/properties.js +13 -8
  47. package/common/reports.instance.json +23 -63
  48. package/common/reports.js +9 -7
  49. package/common/scorekeeper.instance.json +1 -1
  50. package/common/scorekeeper.js +9 -7
  51. package/common/spock.instance.json +1 -1
  52. package/common/spock.js +1 -1
  53. package/common/tell.js +4 -2
  54. package/common/temperature.instance.json +97 -193
  55. package/common/temperature.js +1 -1
  56. package/common/time.js +36 -20
  57. package/common/time.test.json +66 -44
  58. package/common/tokenize.js +46 -0
  59. package/common/ui.instance.json +9 -1
  60. package/common/weight.instance.json +273 -217
  61. package/common/weight.js +1 -1
  62. package/main.js +4 -8
  63. package/package.json +6 -18
  64. package/common/dimensionTemplate.instance.json +0 -582
  65. package/common/dimensionTemplate.js +0 -35
  66. package/common/formulasTemplate.instance.json +0 -483
  67. package/common/formulasTemplate.js +0 -30
  68. package/common/formulasTemplate.test.json +0 -2
  69. package/common/mathTemplate.instance.json +0 -1635
  70. package/common/mathTemplate.js +0 -32
  71. package/common/mathTemplate.test.json +0 -1422
  72. package/common/pipboyTemplate.instance.json +0 -17420
  73. package/common/pipboyTemplate.js +0 -48
  74. package/common/pipboyTemplate.test.json +0 -2
  75. /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
@@ -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
 
@@ -356,8 +356,9 @@
356
356
  "word": "help"
357
357
  }
358
358
  ],
359
+ "developerTest": false,
359
360
  "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)"
361
+ "( 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\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\n)"
361
362
  ],
362
363
  "metadata": {
363
364
  "opChoices": [
@@ -385,7 +386,8 @@
385
386
  "pos": "pos2",
386
387
  "punctuation": "punctuation2",
387
388
  "sdefaults": "sdefaults2",
388
- "stm": "stm2"
389
+ "stm": "stm2",
390
+ "tokenize": "tokenize2"
389
391
  },
390
392
  "namespaced": {
391
393
  "dialogues2": {
@@ -411,6 +413,8 @@
411
413
  ],
412
414
  "variables": {
413
415
  }
416
+ },
417
+ "tokenize2": {
414
418
  }
415
419
  },
416
420
  "processed": [
@@ -432,11 +436,11 @@
432
436
  "value": "help",
433
437
  "word": "help"
434
438
  },
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)",
439
+ "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\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\n)",
436
440
  "paraphrases": "help",
437
441
  "paraphrasesParenthesized": "(help)",
438
442
  "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"
443
+ " 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\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\n"
440
444
  ]
441
445
  }
442
446
  ]
@@ -449,7 +453,7 @@
449
453
  ],
450
454
  "query": "help",
451
455
  "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"
456
+ " 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\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\n"
453
457
  ]
454
458
  }
455
459
  ]
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": [
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
  };