tpmkms_4wp 7.12.8-beta.0 → 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 (70) 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 +747 -73
  10. package/common/dimension.js +15 -7
  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 +992 -0
  18. package/common/formulas.js +19 -6
  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 +199 -683
  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 +23431 -1082
  38. package/common/pipboy.js +31 -4
  39. package/common/pokemon.instance.json +41 -97
  40. package/common/pokemon.js +1 -1
  41. package/common/pressure.instance.json +61 -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 +65 -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/ui.instance.json +1 -1
  58. package/common/weight.instance.json +177 -201
  59. package/common/weight.js +1 -1
  60. package/main.js +2 -6
  61. package/package.json +6 -14
  62. package/common/dimensionTemplate.instance.json +0 -582
  63. package/common/dimensionTemplate.js +0 -35
  64. package/common/formulasTemplate.instance.json +0 -483
  65. package/common/formulasTemplate.js +0 -30
  66. package/common/formulasTemplate.test.json +0 -2
  67. package/common/pipboyTemplate.instance.json +0 -17420
  68. package/common/pipboyTemplate.js +0 -48
  69. package/common/pipboyTemplate.test.json +0 -2
  70. /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
@@ -3,15 +3,20 @@ const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues.js')
4
4
  const pos = require('./pos.js')
5
5
  const math = require('./math.js')
6
- const formulasTemplate = require('./formulasTemplate.js')
6
+ const hierarchy = require('./hierarchy.js')
7
+ const comparable = require('./comparable.js')
8
+ const countable = require('./countable.js')
7
9
  const { API, getVariables, solveFor } = require('./helpers/formulas.js')
8
- const formulas_tests = require('./formulas.test.json')
10
+ const tests = require('./formulas.test.json')
11
+ const instance = require('./formulas.instance.json')
9
12
 
13
+ /*
10
14
  const template = {
11
- queries: [
15
+ configs: [
12
16
  // { query: "x equals y + 4", development: true },
13
17
  ]
14
18
  }
19
+ */
15
20
  /* TODO
16
21
  10 feet in inches -> 1 foot equals 12 inches => 120 inches
17
22
 
@@ -180,11 +185,18 @@ let configStruct = {
180
185
  ]
181
186
  };
182
187
 
188
+ const template = {
189
+ configs: [
190
+ "formulas are concepts",
191
+ configStruct,
192
+ ]
193
+ }
194
+
183
195
  const createConfig = () => {
184
196
  const api = new API()
185
- config = new Config(configStruct, module)
197
+ config = new Config({ name: 'formulas' }, module)
186
198
  config.stop_auto_rebuild()
187
- config.add(dialogues(), pos(), math(), formulasTemplate())
199
+ config.add(dialogues(), pos(), math(), hierarchy(), comparable(), countable())
188
200
  config.api = api
189
201
  config.restart_auto_rebuild()
190
202
  return config
@@ -194,9 +206,10 @@ knowledgeModule({
194
206
  module,
195
207
  description: 'Formulas using math',
196
208
  createConfig,
209
+ template: { template, instance },
197
210
  test: {
198
211
  name: './formulas.test.json',
199
- contents: formulas_tests,
212
+ contents: tests,
200
213
  checks: {
201
214
  objects: ['formulas'],
202
215
  context: defaultContextCheck,
@@ -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
  };