ekms 8.0.0-beta.4 → 8.0.0-beta.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/common/animals.instance.json +2855 -1363
  2. package/common/animals.js +2 -2
  3. package/common/articles.js +108 -0
  4. package/common/articles.test.json +310 -0
  5. package/common/avatar.js +2 -2
  6. package/common/characters.js +9 -11
  7. package/common/colors.instance.json +6980 -3523
  8. package/common/colors.js +2 -2
  9. package/common/colors.test.json +345 -780
  10. package/common/comparable.js +2 -15
  11. package/common/concept.js +17 -11
  12. package/common/countable.js +5 -5
  13. package/common/crew.instance.json +13032 -6570
  14. package/common/crew.js +4 -4
  15. package/common/crew.test.json +714 -452
  16. package/common/currency.js +7 -7
  17. package/common/dialogues.js +117 -238
  18. package/common/dimension.instance.json +265 -264
  19. package/common/dimension.js +13 -13
  20. package/common/dimension.test.json +446 -1640
  21. package/common/edible.instance.json +19910 -9988
  22. package/common/edible.js +2 -2
  23. package/common/emotions.instance.json +146 -128
  24. package/common/emotions.js +4 -4
  25. package/common/evaluate.instance.json +2 -0
  26. package/common/evaluate.js +55 -0
  27. package/common/evaluate.test.json +574 -0
  28. package/common/events.js +6 -6
  29. package/common/fastfood.instance.json +221110 -111293
  30. package/common/fastfood.js +25 -25
  31. package/common/formulas.instance.json +241 -255
  32. package/common/formulas.js +14 -14
  33. package/common/gdefaults.js +19 -19
  34. package/common/help.js +4 -4
  35. package/common/help.test.json +22 -22
  36. package/common/helpers/concept.js +9 -6
  37. package/common/helpers/dialogues.js +2 -3
  38. package/common/helpers/properties.js +48 -58
  39. package/common/helpers.js +1 -1
  40. package/common/hierarchy.js +12 -16
  41. package/common/javascript.js +8 -8
  42. package/common/kirk.instance.json +583 -289
  43. package/common/kirk.js +2 -2
  44. package/common/length.instance.json +5530 -4754
  45. package/common/length.js +2 -2
  46. package/common/math.instance.json +176 -1168
  47. package/common/math.js +11 -11
  48. package/common/meta.js +22 -29
  49. package/common/nameable.instance.json +2 -0
  50. package/common/nameable.js +136 -0
  51. package/common/nameable.test.json +2121 -0
  52. package/common/negation.instance.json +2 -0
  53. package/common/negation.js +38 -0
  54. package/common/negation.test.json +308 -0
  55. package/common/numbers.js +3 -3
  56. package/common/ordering.instance.json +340 -228
  57. package/common/ordering.js +5 -5
  58. package/common/people.instance.json +2066 -1014
  59. package/common/people.js +4 -5
  60. package/common/percentages.instance.json +2 -0
  61. package/common/percentages.js +57 -0
  62. package/common/percentages.test.json +751 -0
  63. package/common/pipboy.instance.json +7974 -6300
  64. package/common/pipboy.js +29 -32
  65. package/common/pokemon.instance.json +4207 -2069
  66. package/common/pokemon.js +4 -4
  67. package/common/pos.js +1 -1
  68. package/common/pressure.instance.json +1341 -1189
  69. package/common/pressure.js +2 -2
  70. package/common/properties.instance.json +130 -60
  71. package/common/properties.js +54 -125
  72. package/common/punctuation.js +2 -2
  73. package/common/reports.instance.json +595 -557
  74. package/common/reports.js +58 -76
  75. package/common/scorekeeper.js +14 -22
  76. package/common/sdefaults.js +13 -3
  77. package/common/sizeable.js +2 -2
  78. package/common/spock.instance.json +583 -289
  79. package/common/spock.js +2 -2
  80. package/common/stgame.js +13 -9
  81. package/common/stm.js +136 -19
  82. package/common/stm.test.json +1734 -1
  83. package/common/tell.js +10 -10
  84. package/common/temperature.instance.json +1484 -1204
  85. package/common/temperature.js +2 -2
  86. package/common/tester.js +2 -2
  87. package/common/testing.js +5 -5
  88. package/common/time.js +7 -7
  89. package/common/tokenize.js +1 -1
  90. package/common/ui.instance.json +257 -258
  91. package/common/ui.js +9 -9
  92. package/common/weight.instance.json +5212 -4233
  93. package/common/weight.js +2 -2
  94. package/common/yesno.js +1 -1
  95. package/main.js +57 -46
  96. package/package.json +24 -6
package/common/edible.js CHANGED
@@ -74,9 +74,9 @@ const template ={
74
74
  ],
75
75
  }
76
76
 
77
- const createConfig = () => {
77
+ const createConfig = async () => {
78
78
  const config = new Config({ name: 'edible' }, module)
79
- config.add(countable(), hierarchy())
79
+ await config.add(countable, hierarchy)
80
80
  return config
81
81
  }
82
82
 
@@ -7,255 +7,333 @@
7
7
  "hierarchy": [
8
8
  [
9
9
  "a",
10
- "articlePOS"
10
+ "articlePOS",
11
+ false
12
+ ],
13
+ [
14
+ "adjective",
15
+ "adjective",
16
+ false
11
17
  ],
12
18
  [
13
19
  "articlePOS",
14
- "articlePOS"
20
+ "articlePOS",
21
+ false
15
22
  ],
16
23
  [
17
24
  "between",
18
- "preposition"
25
+ "preposition",
26
+ false
19
27
  ],
20
28
  [
21
29
  "canBeDoQuestion",
22
- "canBeDoQuestion"
30
+ "canBeDoQuestion",
31
+ false
23
32
  ],
24
33
  [
25
34
  "canBeQuestion",
26
- "canBeQuestion"
35
+ "canBeQuestion",
36
+ false
27
37
  ],
28
38
  [
29
39
  "concept",
30
- "queryable"
40
+ "queryable",
41
+ false
31
42
  ],
32
43
  [
33
44
  "concept",
34
- "theAble"
45
+ "theAble",
46
+ false
35
47
  ],
36
48
  [
37
49
  "doubleQuote",
38
- "queryable"
50
+ "queryable",
51
+ false
39
52
  ],
40
53
  [
41
54
  "emotion",
42
- "unknown"
55
+ "unknown",
56
+ false
57
+ ],
58
+ [
59
+ "evaluate",
60
+ "verby",
61
+ false
43
62
  ],
44
63
  [
45
64
  "feel",
46
- "canBeDoQuestion"
65
+ "canBeDoQuestion",
66
+ false
47
67
  ],
48
68
  [
49
69
  "feel",
50
- "canBeQuestion"
70
+ "canBeQuestion",
71
+ false
51
72
  ],
52
73
  [
53
74
  "feel",
54
- "ifAble"
75
+ "ifAble",
76
+ false
55
77
  ],
56
78
  [
57
79
  "feel",
58
- "orAble"
80
+ "orAble",
81
+ false
59
82
  ],
60
83
  [
61
84
  "have",
62
- "canBeDoQuestion"
85
+ "canBeDoQuestion",
86
+ false
63
87
  ],
64
88
  [
65
89
  "have",
66
- "canBeQuestion"
90
+ "canBeQuestion",
91
+ false
67
92
  ],
68
93
  [
69
94
  "hierarchyAble",
70
- "queryable"
95
+ "queryable",
96
+ false
71
97
  ],
72
98
  [
73
99
  "ifAble",
74
- "ifAble"
100
+ "ifAble",
101
+ false
75
102
  ],
76
103
  [
77
104
  "is",
78
- "canBeQuestion"
105
+ "canBeQuestion",
106
+ false
79
107
  ],
80
108
  [
81
109
  "is",
82
- "verby"
110
+ "verby",
111
+ false
83
112
  ],
84
113
  [
85
114
  "it",
86
- "pronoun"
115
+ "pronoun",
116
+ false
87
117
  ],
88
118
  [
89
119
  "it",
90
- "queryable"
120
+ "queryable",
121
+ false
91
122
  ],
92
123
  [
93
124
  "it",
94
- "thisitthat"
125
+ "thisitthat",
126
+ false
95
127
  ],
96
128
  [
97
129
  "it",
98
- "toAble"
130
+ "toAble",
131
+ false
99
132
  ],
100
133
  [
101
- "modifies",
102
- "verby"
134
+ "memorable",
135
+ "theAble",
136
+ false
103
137
  ],
104
138
  [
105
- "notAble",
106
- "notAble"
139
+ "modifies",
140
+ "verby",
141
+ false
107
142
  ],
108
143
  [
109
144
  "noun",
110
- "theAble"
145
+ "theAble",
146
+ false
111
147
  ],
112
148
  [
113
149
  "object",
114
- "queryable"
150
+ "queryable",
151
+ false
115
152
  ],
116
153
  [
117
154
  "object",
118
- "theAble"
155
+ "theAble",
156
+ false
119
157
  ],
120
158
  [
121
159
  "orAble",
122
- "ifAble"
160
+ "ifAble",
161
+ false
123
162
  ],
124
163
  [
125
164
  "preposition",
126
- "preposition"
165
+ "preposition",
166
+ false
127
167
  ],
128
168
  [
129
169
  "pronoun",
130
- "pronoun"
170
+ "pronoun",
171
+ false
131
172
  ],
132
173
  [
133
174
  "property",
134
- "queryable"
175
+ "queryable",
176
+ false
135
177
  ],
136
178
  [
137
179
  "property",
138
- "theAble"
180
+ "theAble",
181
+ false
139
182
  ],
140
183
  [
141
184
  "property",
142
- "unknown"
185
+ "unknown",
186
+ false
143
187
  ],
144
188
  [
145
189
  "punctuation",
146
- "punctuation"
190
+ "punctuation",
191
+ false
147
192
  ],
148
193
  [
149
194
  "queryable",
150
- "queryable"
195
+ "queryable",
196
+ false
151
197
  ],
152
198
  [
153
199
  "questionMark",
154
- "punctuation"
200
+ "punctuation",
201
+ false
155
202
  ],
156
203
  [
157
204
  "readonly",
158
- "queryable"
205
+ "queryable",
206
+ false
159
207
  ],
160
208
  [
161
209
  "reason",
162
- "queryable"
210
+ "queryable",
211
+ false
163
212
  ],
164
213
  [
165
214
  "reason",
166
- "theAble"
215
+ "theAble",
216
+ false
217
+ ],
218
+ [
219
+ "remember",
220
+ "verby",
221
+ false
167
222
  ],
168
223
  [
169
224
  "sentientBeing",
170
- "unknown"
225
+ "unknown",
226
+ false
227
+ ],
228
+ [
229
+ "stm_before",
230
+ "adjective",
231
+ false
171
232
  ],
172
233
  [
173
234
  "that",
174
- "thisitthat"
235
+ "thisitthat",
236
+ false
175
237
  ],
176
238
  [
177
239
  "the",
178
- "articlePOS"
240
+ "articlePOS",
241
+ false
179
242
  ],
180
243
  [
181
244
  "theAble",
182
- "theAble"
245
+ "theAble",
246
+ false
183
247
  ],
184
248
  [
185
249
  "this",
186
- "pronoun"
250
+ "pronoun",
251
+ false
187
252
  ],
188
253
  [
189
254
  "this",
190
- "queryable"
255
+ "queryable",
256
+ false
191
257
  ],
192
258
  [
193
259
  "this",
194
- "thisitthat"
260
+ "thisitthat",
261
+ false
195
262
  ],
196
263
  [
197
264
  "thisitthat",
198
- "queryable"
265
+ "queryable",
266
+ false
199
267
  ],
200
268
  [
201
269
  "to",
202
- "preposition"
270
+ "preposition",
271
+ false
203
272
  ],
204
273
  [
205
274
  "toAble",
206
- "toAble"
275
+ "toAble",
276
+ false
207
277
  ],
208
278
  [
209
279
  "type",
210
- "property"
280
+ "property",
281
+ false
211
282
  ],
212
283
  [
213
284
  "type",
214
- "whatAble"
215
- ],
216
- [
217
- "unknown",
218
- "hierarchyAble"
285
+ "whatAble",
286
+ false
219
287
  ],
220
288
  [
221
289
  "unknown",
222
- "notAble"
290
+ "hierarchyAble",
291
+ false
223
292
  ],
224
293
  [
225
294
  "unknown",
226
- "object"
295
+ "object",
296
+ false
227
297
  ],
228
298
  [
229
299
  "unknown",
230
- "queryable"
300
+ "queryable",
301
+ false
231
302
  ],
232
303
  [
233
304
  "unknown",
234
- "theAble"
305
+ "theAble",
306
+ false
235
307
  ],
236
308
  [
237
309
  "verby",
238
- "verby"
310
+ "verby",
311
+ false
239
312
  ],
240
313
  [
241
314
  "what",
242
- "object"
315
+ "object",
316
+ false
243
317
  ],
244
318
  [
245
319
  "what",
246
- "queryable"
320
+ "queryable",
321
+ false
247
322
  ],
248
323
  [
249
324
  "whatAble",
250
- "queryable"
325
+ "queryable",
326
+ false
251
327
  ],
252
328
  [
253
329
  "whose",
254
- "object"
330
+ "object",
331
+ false
255
332
  ],
256
333
  [
257
334
  "xfx",
258
- "queryable"
335
+ "queryable",
336
+ false
259
337
  ]
260
338
  ],
261
339
  "metadata": {
@@ -885,36 +963,6 @@
885
963
  1
886
964
  ]
887
965
  ],
888
- [
889
- [
890
- "feel",
891
- 0
892
- ],
893
- [
894
- "is",
895
- 0
896
- ],
897
- [
898
- "means",
899
- 0
900
- ],
901
- [
902
- "propertyOf",
903
- 0
904
- ],
905
- [
906
- "the",
907
- 0
908
- ],
909
- [
910
- "unknown",
911
- 0
912
- ],
913
- [
914
- "unknown",
915
- 1
916
- ]
917
- ],
918
966
  [
919
967
  [
920
968
  "feel",
@@ -1112,36 +1160,6 @@
1112
1160
  1
1113
1161
  ]
1114
1162
  ],
1115
- [
1116
- [
1117
- "feel",
1118
- 0
1119
- ],
1120
- [
1121
- "is",
1122
- 0
1123
- ],
1124
- [
1125
- "means",
1126
- 0
1127
- ],
1128
- [
1129
- "propertyOf",
1130
- 0
1131
- ],
1132
- [
1133
- "the",
1134
- 0
1135
- ],
1136
- [
1137
- "unknown",
1138
- 0
1139
- ],
1140
- [
1141
- "unknown",
1142
- 1
1143
- ]
1144
- ],
1145
1163
  [
1146
1164
  [
1147
1165
  "feel",
@@ -23,7 +23,7 @@ const template ={
23
23
  ],
24
24
  }
25
25
 
26
- const createConfig = () => {
26
+ const createConfig = async () => {
27
27
  const config = new Config({
28
28
  name: 'emotions',
29
29
  operators: [
@@ -46,8 +46,8 @@ const createConfig = () => {
46
46
  ]
47
47
  }, module)
48
48
  config.stop_auto_rebuild()
49
- config.add(hierarchy())
50
- config.initializer( ({config, apis}) => {
49
+ await config.add(hierarchy)
50
+ await config.initializer( ({config, apis}) => {
51
51
  const api = apis('properties')
52
52
  api.createActionPrefix({
53
53
  operator: 'feel',
@@ -57,7 +57,7 @@ const createConfig = () => {
57
57
  doAble: true,
58
58
  config })
59
59
  })
60
- config.restart_auto_rebuild()
60
+ await config.restart_auto_rebuild()
61
61
  //config.load(template, emotions_instance)
62
62
  return config
63
63
  }
@@ -0,0 +1,2 @@
1
+ {
2
+ }
@@ -0,0 +1,55 @@
1
+ const { Config, knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
2
+ const { defaultContextCheck } = require('./helpers')
3
+ const tests = require('./evaluate.test.json')
4
+ const pos = require('./pos')
5
+ const gdefaults = require('./gdefaults')
6
+
7
+ const configStruct = {
8
+ name: 'evaluate',
9
+ operators: [
10
+ "([evaluate] (value))",
11
+ { pattern: "([value1])", development: true },
12
+ ],
13
+ bridges: [
14
+ {
15
+ id: 'value1',
16
+ evaluator: ({context}) => {
17
+ context.evalue = 'value1 after evaluation'
18
+ },
19
+ development: true,
20
+ },
21
+ {
22
+ id: 'evaluate',
23
+ isA: ['verby'],
24
+ bridge: "{ ...next(operator), postModifiers: ['value'], value: after[0] }",
25
+ semantic: async ({context, e}) => {
26
+ context.response = (await e(context.value)).evalue
27
+ context.isResponse = true
28
+ }
29
+ }
30
+ ],
31
+ };
32
+
33
+ const createConfig = async () => {
34
+ const config = new Config(configStruct, module)
35
+ config.stop_auto_rebuild()
36
+ await config.add(pos, gdefaults)
37
+ await config.restart_auto_rebuild()
38
+ return config
39
+ }
40
+
41
+ knowledgeModule({
42
+ module,
43
+ description: 'Explicit handling of evaluate',
44
+ createConfig,
45
+ test: {
46
+ name: './evaluate.test.json',
47
+ contents: tests,
48
+ include: {
49
+ words: true,
50
+ },
51
+ checks: {
52
+ context: defaultContextCheck,
53
+ },
54
+ },
55
+ })