ekms 7.12.8 → 8.0.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
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
package/common/math.js CHANGED
@@ -3,8 +3,11 @@ const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues')
4
4
  const numbers = require('./numbers')
5
5
  const punctuation = require('./punctuation')
6
- const mathTemplate = require('./mathTemplate')
7
- const math_tests = require('./math.test.json')
6
+ const countable = require('./countable')
7
+ const comparable = require('./comparable')
8
+ const tests = require('./math.test.json')
9
+ const instance = require('./math.instance.json')
10
+
8
11
 
9
12
  // TODO 10 dollars times 20
10
13
  /*
@@ -102,9 +105,17 @@ let configStruct = {
102
105
  ],
103
106
  };
104
107
 
108
+ const template = {
109
+ configs: [
110
+ "mathematical modifies operator",
111
+ "* + / and - are mathematical operators",
112
+ configStruct,
113
+ ]
114
+ }
115
+
105
116
  const createConfig = () => {
106
- const config = new Config(configStruct, module)
107
- config.add(numbers(), dialogues(), punctuation(), mathTemplate());
117
+ const config = new Config({ name: 'math' }, module)
118
+ config.add(numbers(), dialogues(), punctuation(), countable(), comparable())
108
119
  return config
109
120
  }
110
121
 
@@ -112,9 +123,10 @@ knowledgeModule( {
112
123
  module,
113
124
  createConfig,
114
125
  description: 'talking about math',
126
+ template: { template, instance },
115
127
  test: {
116
128
  name: './math.test.json',
117
- contents: math_tests,
129
+ contents: tests,
118
130
  checks: {
119
131
  context: defaultContextCheck,
120
132
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [],
2
+ "configs": [],
3
3
  "resultss": [],
4
4
  "fragments": [],
5
5
  "semantics": [],
package/common/meta.js CHANGED
@@ -1,15 +1,16 @@
1
1
  const { Config, knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const _ = require('lodash')
4
+ const gdefaults = require('./gdefaults.js')
4
5
  ensureTestFile(module, 'meta', 'test')
5
6
  ensureTestFile(module, 'meta', 'instance')
6
7
  const meta_tests = require('./meta.test.json')
7
8
  const meta_instance = require('./meta.instance.json')
8
9
  const { hashIndexesGet, hashIndexesSet, translationMapping, translationMappings } = require('./helpers/meta.js')
9
- const { zip } = require('./helpers.js')
10
+ const { zip, words } = require('./helpers.js')
10
11
 
11
12
  const template = {
12
- queries: [
13
+ configs: [
13
14
  // "if f then g",
14
15
  //"if e or f then g",
15
16
  ]
@@ -59,6 +60,21 @@ let configStruct = {
59
60
  { child: 'orAble', parent: 'ifAble' },
60
61
  ],
61
62
  bridges: [
63
+ /*
64
+ {
65
+ id: "synonym",
66
+ // implicit words in singular/plural
67
+ words: words('synonym'),
68
+ operator: "([synonym])",
69
+ },
70
+ {
71
+ id: 'synonymOfWord',
72
+ operator: "((synonym/*) [synonymOfWord|of] (word))",
73
+ bridge: "{ ...next(operator), word: after[0] }",
74
+ evaluator: ({context}) => {
75
+ }
76
+ },
77
+ */
62
78
  {id: "orList", level: 0, selector: {left: [{ marker: 'orAble' }], right: [{ marker: 'orAble' }], passthrough: true}, bridge: "{ ...next(operator), value: append(before, after) }"},
63
79
  {id: "orList", level: 1, selector: {left: [{ marker: 'orAble' }], passthrough: true}, bridge: "{ ...operator, value: append(before, operator.value) }"},
64
80
 
@@ -81,14 +97,16 @@ let configStruct = {
81
97
  ],
82
98
  version: '3',
83
99
  words: {
84
- // 'testWord2': [{"id": "testWord2", "initial": "{ value: 'testWord2Value' }" }],
85
- // TODO make this development and select out for module
86
- // 'x': [{id: "x", initial: "{ value: 'x' }", development: true }],
87
- // 'f': [{id: "ifAble", initial: "{ word: 'f' }", development: true }],
88
- // 'g': [{id: "ifAble", initial: "{ word: 'g' }", development: true }],
89
- 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", development: true }],
90
- 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", development: true }],
91
- 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", development: true }],
100
+ "literals": {
101
+ // 'testWord2': [{"id": "testWord2", "initial": "{ value: 'testWord2Value' }" }],
102
+ // TODO make this development and select out for module
103
+ // 'x': [{id: "x", initial: "{ value: 'x' }", development: true }],
104
+ // 'f': [{id: "ifAble", initial: "{ word: 'f' }", development: true }],
105
+ // 'g': [{id: "ifAble", initial: "{ word: 'g' }", development: true }],
106
+ 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", development: true }],
107
+ 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", development: true }],
108
+ 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", development: true }],
109
+ }
92
110
  },
93
111
  generators: [
94
112
  {
@@ -362,6 +380,9 @@ let configStruct = {
362
380
 
363
381
  const createConfig = () => {
364
382
  const config = new Config(configStruct, module)
383
+ config.stop_auto_rebuild()
384
+ config.add(gdefaults())
385
+
365
386
  config.initializer( ({config, addGenerator, isModule}) => {
366
387
  if (!isModule) {
367
388
  addGenerator({
@@ -371,6 +392,8 @@ const createConfig = () => {
371
392
  })
372
393
  }
373
394
  })
395
+
396
+ config.restart_auto_rebuild()
374
397
  return config
375
398
  }
376
399
 
package/common/numbers.js CHANGED
@@ -20,30 +20,34 @@ let configStruct = {
20
20
  debug: false,
21
21
  version: '3',
22
22
  words: {
23
- // start with a space for regular expressions
24
- " ([0-9]+$)": [{"id": "number", "initial": "{ value: int(group[0]), instance: true }" }],
25
- " ([0-9]+[.][0-9]+$)": [{"id": "number", "initial": "{ value: float(group[0]), instance: true }" }],
26
- " ([.][0-9]+$)": [{"id": "number", "initial": "{ value: float(group[0]), instance: true }" }],
27
- "one": [{"id": "number", "initial": "{ value: 1, instance:true }" }],
28
- "ones": [{"id": "number", "initial": "{ value: 1, number: 'many', instance:true }" }],
29
- "two": [{"id": "number", "initial": "{ value: 2 , instance:true}" }],
30
- "twos": [{"id": "number", "initial": "{ value: 2 , number: 'many', instance:true}" }],
31
- "three": [{"id": "number", "initial": "{ value: 3, instance:true }" }],
32
- "threes": [{"id": "number", "initial": "{ value: 3, number: 'many', instance:true }" }],
33
- "four": [{"id": "number", "initial": "{ value: 4, instance:true }" }],
34
- "fours": [{"id": "number", "initial": "{ value: 4, number: 'many', instance:true }" }],
35
- "five": [{"id": "number", "initial": "{ value: 5, instance:true }" }],
36
- "fives": [{"id": "number", "initial": "{ value: 5, number: 'many', instance:true }" }],
37
- "six": [{"id": "number", "initial": "{ value: 6, instance:true }" }],
38
- "sixes": [{"id": "number", "initial": "{ value: 6, number: 'many', instance:true }" }],
39
- "seven": [{"id": "number", "initial": "{ value: 7, instance:true }" }],
40
- "sevens": [{"id": "number", "initial": "{ value: 7, number: 'many', instance:true }" }],
41
- "eight": [{"id": "number", "initial": "{ value: 8, instance:true }" }],
42
- "eights": [{"id": "number", "initial": "{ value: 8, number: 'many', instance:true }" }],
43
- "nine": [{"id": "number", "initial": "{ value: 9, instance:true }" }],
44
- "nines": [{"id": "number", "initial": "{ value: 9, number: 'many', instance:true }" }],
45
- "ten": [{"id": "number", "initial": "{ value: 10, instance:true }" }],
46
- "tens": [{"id": "number", "initial": "{ value: 10, number: 'many', instance:true }" }],
23
+ "literals": {
24
+ // start with a space for regular expressions
25
+ "one": [{"id": "number", "initial": "{ value: 1, instance:true }" }],
26
+ "ones": [{"id": "number", "initial": "{ value: 1, number: 'many', instance:true }" }],
27
+ "two": [{"id": "number", "initial": "{ value: 2 , instance:true}" }],
28
+ "twos": [{"id": "number", "initial": "{ value: 2 , number: 'many', instance:true}" }],
29
+ "three": [{"id": "number", "initial": "{ value: 3, instance:true }" }],
30
+ "threes": [{"id": "number", "initial": "{ value: 3, number: 'many', instance:true }" }],
31
+ "four": [{"id": "number", "initial": "{ value: 4, instance:true }" }],
32
+ "fours": [{"id": "number", "initial": "{ value: 4, number: 'many', instance:true }" }],
33
+ "five": [{"id": "number", "initial": "{ value: 5, instance:true }" }],
34
+ "fives": [{"id": "number", "initial": "{ value: 5, number: 'many', instance:true }" }],
35
+ "six": [{"id": "number", "initial": "{ value: 6, instance:true }" }],
36
+ "sixes": [{"id": "number", "initial": "{ value: 6, number: 'many', instance:true }" }],
37
+ "seven": [{"id": "number", "initial": "{ value: 7, instance:true }" }],
38
+ "sevens": [{"id": "number", "initial": "{ value: 7, number: 'many', instance:true }" }],
39
+ "eight": [{"id": "number", "initial": "{ value: 8, instance:true }" }],
40
+ "eights": [{"id": "number", "initial": "{ value: 8, number: 'many', instance:true }" }],
41
+ "nine": [{"id": "number", "initial": "{ value: 9, instance:true }" }],
42
+ "nines": [{"id": "number", "initial": "{ value: 9, number: 'many', instance:true }" }],
43
+ "ten": [{"id": "number", "initial": "{ value: 10, instance:true }" }],
44
+ "tens": [{"id": "number", "initial": "{ value: 10, number: 'many', instance:true }" }],
45
+ },
46
+ patterns: [
47
+ { "pattern": [{ type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: int(text), instance: true }" }]},
48
+ { "pattern": [{ type: 'digit' }, { repeat: true }, '.', { type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: float(text), instance: true }" }]},
49
+ { "pattern": ['.', { type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: float(text), instance: true }" }]},
50
+ ],
47
51
  },
48
52
 
49
53
  hierarchy: [