ekms 8.0.0-beta.6 → 8.0.0-beta.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/common/animals.instance.json +2871 -1379
  2. package/common/animals.js +17 -20
  3. package/common/articles.js +103 -0
  4. package/common/articles.test.json +310 -0
  5. package/common/avatar.js +5 -9
  6. package/common/characters.js +22 -28
  7. package/common/colors.instance.json +7170 -3657
  8. package/common/colors.js +4 -8
  9. package/common/colors.test.json +345 -780
  10. package/common/comparable.instance.json +1738 -0
  11. package/common/comparable.js +46 -27
  12. package/common/comparable.test.json +438 -2
  13. package/common/concept.js +120 -118
  14. package/common/countable.js +19 -13
  15. package/common/countable.test.json +1050 -0
  16. package/common/crew.instance.json +13066 -6598
  17. package/common/crew.js +36 -41
  18. package/common/crew.test.json +714 -452
  19. package/common/currency.js +27 -45
  20. package/common/dialogues.js +161 -285
  21. package/common/dimension.instance.json +474 -253
  22. package/common/dimension.js +16 -22
  23. package/common/dimension.test.json +446 -1640
  24. package/common/edible.instance.json +20059 -10007
  25. package/common/edible.js +3 -8
  26. package/common/emotions.instance.json +147 -129
  27. package/common/emotions.js +35 -38
  28. package/common/evaluate.instance.json +2 -0
  29. package/common/evaluate.js +49 -0
  30. package/common/evaluate.test.json +574 -0
  31. package/common/events.js +10 -14
  32. package/common/fastfood.instance.json +221967 -111264
  33. package/common/fastfood.js +74 -84
  34. package/common/fastfood.test.json +268 -90
  35. package/common/formulas.instance.json +455 -249
  36. package/common/formulas.js +19 -26
  37. package/common/gdefaults.js +24 -26
  38. package/common/help.js +7 -12
  39. package/common/help.test.json +22 -22
  40. package/common/helpers/concept.js +10 -7
  41. package/common/helpers/dialogues.js +2 -3
  42. package/common/helpers/properties.js +54 -62
  43. package/common/helpers.js +6 -5
  44. package/common/hierarchy.js +16 -24
  45. package/common/javascript.js +11 -18
  46. package/common/kirk.instance.json +584 -290
  47. package/common/kirk.js +5 -8
  48. package/common/length.instance.json +8834 -4757
  49. package/common/length.js +4 -8
  50. package/common/listener.js +48 -0
  51. package/common/listener.test.json +104 -0
  52. package/common/math.instance.json +425 -1187
  53. package/common/math.js +16 -20
  54. package/common/meta.js +23 -47
  55. package/common/nameable.instance.json +2 -0
  56. package/common/nameable.js +135 -0
  57. package/common/nameable.test.json +2121 -0
  58. package/common/negation.instance.json +2 -0
  59. package/common/negation.js +38 -0
  60. package/common/negation.test.json +308 -0
  61. package/common/numbers.js +27 -31
  62. package/common/ordering.instance.json +366 -246
  63. package/common/ordering.js +80 -86
  64. package/common/people.instance.json +2134 -1022
  65. package/common/people.js +8 -13
  66. package/common/percentages.instance.json +2 -0
  67. package/common/percentages.js +53 -0
  68. package/common/percentages.test.json +751 -0
  69. package/common/pipboy.instance.json +11777 -6289
  70. package/common/pipboy.js +48 -59
  71. package/common/pokemon.instance.json +4226 -2081
  72. package/common/pokemon.js +7 -20
  73. package/common/pos.js +12 -13
  74. package/common/pressure.instance.json +2208 -1175
  75. package/common/pressure.js +4 -8
  76. package/common/properties.instance.json +131 -61
  77. package/common/properties.js +57 -134
  78. package/common/punctuation.js +6 -6
  79. package/common/reports.instance.json +1018 -530
  80. package/common/reports.js +73 -97
  81. package/common/scorekeeper.js +18 -30
  82. package/common/sdefaults.js +16 -7
  83. package/common/sizeable.js +6 -10
  84. package/common/spock.instance.json +584 -290
  85. package/common/spock.js +5 -8
  86. package/common/stgame.js +19 -19
  87. package/common/stm.js +164 -27
  88. package/common/stm.test.json +1734 -1
  89. package/common/tell.js +14 -18
  90. package/common/temperature.instance.json +2271 -1222
  91. package/common/temperature.js +4 -8
  92. package/common/tester.js +3 -3
  93. package/common/testing.js +8 -12
  94. package/common/time.js +20 -25
  95. package/common/tokenize.js +4 -5
  96. package/common/ui.instance.json +459 -240
  97. package/common/ui.js +16 -22
  98. package/common/weight.instance.json +7646 -4026
  99. package/common/weight.js +4 -8
  100. package/common/yesno.js +5 -5
  101. package/main.js +59 -46
  102. package/package.json +28 -5
package/common/edible.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const hierarchy = require('./hierarchy')
4
4
  const countable = require('./countable')
@@ -74,16 +74,11 @@ const template ={
74
74
  ],
75
75
  }
76
76
 
77
- const createConfig = () => {
78
- const config = new Config({ name: 'edible' }, module)
79
- config.add(countable(), hierarchy())
80
- return config
81
- }
82
-
83
77
  knowledgeModule( {
78
+ config: { name: 'edible' },
79
+ includes: [countable, hierarchy],
84
80
  module,
85
81
  description: 'Edible things',
86
- createConfig,
87
82
  test: {
88
83
  name: './edible.test.json',
89
84
  contents: edible_tests,
@@ -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
+ "verb",
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
+ "verb",
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
+ "verb",
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
+ "verb",
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
- "verby",
238
- "verby"
309
+ "verb",
310
+ "verb",
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",
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const hierarchy = require('./hierarchy')
4
4
  ensureTestFile(module, 'emotions', 'test')
@@ -23,49 +23,46 @@ const template ={
23
23
  ],
24
24
  }
25
25
 
26
- const createConfig = () => {
27
- const config = new Config({
28
- name: 'emotions',
29
- operators: [
30
- "([sentientBeing|])",
31
- "([emotion|])",
32
- ],
33
- bridges: [
34
- { id: 'sentientBeing', level: 0, bridge: '{ ...next(operator) }' },
35
- // just here so it loads and the sentence can make the semantics
36
- // { id: 'feel', level: 0, bridge: '{ ...next(operator) }' },
37
- { id: 'emotion', level: 0, bridge: '{ ...next(operator) }' },
38
- ],
39
- priorities: [
40
- { "context": [['feel', 0], ['means', 0], ], "choose": [0] },
41
- ],
26
+ const config = {
27
+ name: 'emotions',
28
+ operators: [
29
+ "([sentientBeing|])",
30
+ "([emotion|])",
31
+ ],
32
+ bridges: [
33
+ { id: 'sentientBeing', level: 0, bridge: '{ ...next(operator) }' },
34
+ // just here so it loads and the sentence can make the semantics
35
+ // { id: 'feel', level: 0, bridge: '{ ...next(operator) }' },
36
+ { id: 'emotion', level: 0, bridge: '{ ...next(operator) }' },
37
+ ],
38
+ priorities: [
39
+ { "context": [['feel', 0], ['means', 0], ], "choose": [0] },
40
+ ],
42
41
 
43
- hierarchy: [
44
- ['emotion', 'unknown'],
45
- ['sentientBeing', 'unknown'],
46
- ]
47
- }, module)
48
- config.stop_auto_rebuild()
49
- config.add(hierarchy())
50
- config.initializer( ({config, apis}) => {
51
- const api = apis('properties')
52
- api.createActionPrefix({
53
- operator: 'feel',
54
- create: ['feel'/*, 'emotion'*/],
55
- before: [{tag: 'sentientBeing', id: 'sentientBeing'}],
56
- after: [{tag: 'emotion', id: 'emotion'}],
57
- doAble: true,
58
- config })
59
- })
60
- config.restart_auto_rebuild()
61
- //config.load(template, emotions_instance)
62
- return config
42
+ hierarchy: [
43
+ ['emotion', 'unknown'],
44
+ ['sentientBeing', 'unknown'],
45
+ ]
46
+ }
47
+
48
+ const initializer = ({config, apis}) => {
49
+ const api = apis('properties')
50
+ api.createActionPrefix({
51
+ operator: 'feel',
52
+ create: ['feel'/*, 'emotion'*/],
53
+ before: [{tag: 'sentientBeing', id: 'sentientBeing'}],
54
+ after: [{tag: 'emotion', id: 'emotion'}],
55
+ doAble: true,
56
+ config })
63
57
  }
64
58
 
65
59
  knowledgeModule( {
60
+ config,
61
+ includes: [hierarchy],
62
+ initializer,
63
+
66
64
  module,
67
65
  description: 'emotions related concepts',
68
- createConfig,
69
66
  test: {
70
67
  name: './emotions.test.json',
71
68
  contents: emotions_tests
@@ -0,0 +1,2 @@
1
+ {
2
+ }
@@ -0,0 +1,49 @@
1
+ const { 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 config = {
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: ['verb'],
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
+ knowledgeModule({
34
+ config,
35
+ includes: [pos, gdefaults],
36
+
37
+ module,
38
+ description: 'Explicit handling of evaluate',
39
+ test: {
40
+ name: './evaluate.test.json',
41
+ contents: tests,
42
+ include: {
43
+ words: true,
44
+ },
45
+ checks: {
46
+ context: defaultContextCheck,
47
+ },
48
+ },
49
+ })