tpmkms 7.12.8-beta.1 → 7.12.8-beta.10

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 (62) hide show
  1. package/common/animals.instance.json +89 -249
  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 +16 -14
  9. package/common/dimension.instance.json +13 -13
  10. package/common/dimension.js +1 -1
  11. package/common/edible.instance.json +293 -297
  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 +517 -1473
  16. package/common/fastfood.js +1 -1
  17. package/common/formulas.instance.json +9 -9
  18. package/common/formulas.js +2 -2
  19. package/common/gdefaults.js +2 -0
  20. package/common/help.js +7 -2
  21. package/common/help.test.json +9 -5
  22. package/common/helpers.js +5 -0
  23. package/common/javascript.js +8 -6
  24. package/common/kirk.instance.json +1 -1
  25. package/common/kirk.js +1 -1
  26. package/common/length.instance.json +49 -229
  27. package/common/length.js +1 -1
  28. package/common/math.instance.json +21 -41
  29. package/common/math.js +1 -1
  30. package/common/meta.instance.json +1 -1
  31. package/common/meta.js +35 -10
  32. package/common/numbers.js +28 -24
  33. package/common/ordering.instance.json +37 -101
  34. package/common/ordering.js +1 -1
  35. package/common/people.instance.json +50 -78
  36. package/common/people.js +1 -1
  37. package/common/pipboy.instance.json +197 -201
  38. package/common/pipboy.js +1 -1
  39. package/common/pokemon.instance.json +41 -97
  40. package/common/pokemon.js +1 -1
  41. package/common/pressure.instance.json +13 -33
  42. package/common/pressure.js +1 -1
  43. package/common/properties.instance.json +21 -49
  44. package/common/properties.js +13 -8
  45. package/common/reports.instance.json +7 -63
  46. package/common/reports.js +9 -7
  47. package/common/scorekeeper.instance.json +1 -1
  48. package/common/scorekeeper.js +9 -7
  49. package/common/spock.instance.json +1 -1
  50. package/common/spock.js +1 -1
  51. package/common/tell.js +4 -2
  52. package/common/temperature.instance.json +17 -133
  53. package/common/temperature.js +1 -1
  54. package/common/time.js +36 -20
  55. package/common/time.test.json +66 -44
  56. package/common/tokenize.js +46 -0
  57. package/common/tokenize.test.json +2 -0
  58. package/common/ui.instance.json +1 -1
  59. package/common/weight.instance.json +33 -201
  60. package/common/weight.js +1 -1
  61. package/main.js +2 -0
  62. package/package.json +7 -3
@@ -35,7 +35,7 @@ const fastfood_instance = require('./fastfood.instance.json')
35
35
  */
36
36
 
37
37
  const template = {
38
- "queries": [
38
+ configs: [
39
39
  "food is countable",
40
40
  "drinks are countable",
41
41
  "bacon modifies deluxe",
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [
2
+ "configs": [
3
3
  "formulas are concepts",
4
4
  {
5
5
  "name": "formulas",
@@ -756,15 +756,15 @@
756
756
  },
757
757
  "one": {
758
758
  "number": "many",
759
+ "value": "formulas",
760
+ "unknown": true,
761
+ "text": "formulas",
759
762
  "marker": "unknown",
763
+ "word": "formulas",
760
764
  "range": {
761
765
  "start": 0,
762
766
  "end": 20
763
767
  },
764
- "word": "formulas",
765
- "text": "formulas",
766
- "value": "formulas",
767
- "unknown": true,
768
768
  "dead": true,
769
769
  "types": [
770
770
  "unknown"
@@ -772,15 +772,15 @@
772
772
  "level": 1
773
773
  },
774
774
  "two": {
775
+ "value": "concepts",
776
+ "unknown": true,
777
+ "text": "concepts",
775
778
  "marker": "unknown",
779
+ "word": "concepts",
776
780
  "range": {
777
781
  "start": 13,
778
782
  "end": 20
779
783
  },
780
- "word": "concepts",
781
- "text": "concepts",
782
- "value": "concepts",
783
- "unknown": true,
784
784
  "dead": true,
785
785
  "types": [
786
786
  "unknown"
@@ -12,7 +12,7 @@ const instance = require('./formulas.instance.json')
12
12
 
13
13
  /*
14
14
  const template = {
15
- queries: [
15
+ configs: [
16
16
  // { query: "x equals y + 4", development: true },
17
17
  ]
18
18
  }
@@ -186,7 +186,7 @@ let configStruct = {
186
186
  };
187
187
 
188
188
  const template = {
189
- queries: [
189
+ configs: [
190
190
  "formulas are concepts",
191
191
  configStruct,
192
192
  ]
@@ -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
  };