ekms 8.0.0-beta.5 → 8.0.0-beta.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/common/animals.instance.json +2855 -1363
  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 +6978 -3493
  8. package/common/colors.js +4 -8
  9. package/common/colors.test.json +345 -780
  10. package/common/comparable.js +5 -22
  11. package/common/concept.js +120 -118
  12. package/common/countable.js +18 -12
  13. package/common/countable.test.json +1050 -0
  14. package/common/crew.instance.json +13032 -6570
  15. package/common/crew.js +36 -41
  16. package/common/crew.test.json +714 -452
  17. package/common/currency.js +27 -45
  18. package/common/dialogues.js +158 -282
  19. package/common/dimension.instance.json +273 -272
  20. package/common/dimension.js +16 -22
  21. package/common/dimension.test.json +446 -1640
  22. package/common/edible.instance.json +19911 -9877
  23. package/common/edible.js +3 -8
  24. package/common/emotions.instance.json +146 -128
  25. package/common/emotions.js +35 -38
  26. package/common/evaluate.instance.json +2 -0
  27. package/common/evaluate.js +49 -0
  28. package/common/evaluate.test.json +574 -0
  29. package/common/events.js +9 -13
  30. package/common/fastfood.instance.json +221141 -111240
  31. package/common/fastfood.js +70 -80
  32. package/common/formulas.instance.json +251 -265
  33. package/common/formulas.js +17 -24
  34. package/common/gdefaults.js +24 -26
  35. package/common/help.js +7 -12
  36. package/common/help.test.json +22 -22
  37. package/common/helpers/concept.js +9 -6
  38. package/common/helpers/dialogues.js +2 -3
  39. package/common/helpers/properties.js +54 -62
  40. package/common/helpers.js +1 -1
  41. package/common/hierarchy.js +16 -24
  42. package/common/javascript.js +11 -18
  43. package/common/kirk.instance.json +583 -289
  44. package/common/kirk.js +5 -8
  45. package/common/length.instance.json +5530 -4754
  46. package/common/length.js +4 -8
  47. package/common/listener.js +48 -0
  48. package/common/listener.test.json +104 -0
  49. package/common/math.instance.json +192 -1184
  50. package/common/math.js +15 -19
  51. package/common/meta.js +23 -47
  52. package/common/nameable.instance.json +2 -0
  53. package/common/nameable.js +135 -0
  54. package/common/nameable.test.json +2121 -0
  55. package/common/negation.instance.json +2 -0
  56. package/common/negation.js +38 -0
  57. package/common/negation.test.json +308 -0
  58. package/common/numbers.js +6 -10
  59. package/common/ordering.instance.json +340 -160
  60. package/common/ordering.js +80 -86
  61. package/common/people.instance.json +2066 -1014
  62. package/common/people.js +8 -13
  63. package/common/percentages.instance.json +2 -0
  64. package/common/percentages.js +53 -0
  65. package/common/percentages.test.json +751 -0
  66. package/common/pipboy.instance.json +7999 -6269
  67. package/common/pipboy.js +32 -43
  68. package/common/pokemon.instance.json +4207 -2069
  69. package/common/pokemon.js +7 -20
  70. package/common/pos.js +4 -5
  71. package/common/pressure.instance.json +1341 -1189
  72. package/common/pressure.js +4 -8
  73. package/common/properties.instance.json +130 -60
  74. package/common/properties.js +57 -134
  75. package/common/punctuation.js +6 -6
  76. package/common/reports.instance.json +595 -557
  77. package/common/reports.js +64 -89
  78. package/common/scorekeeper.js +18 -30
  79. package/common/sdefaults.js +16 -7
  80. package/common/sizeable.js +5 -9
  81. package/common/spock.instance.json +583 -289
  82. package/common/spock.js +5 -8
  83. package/common/stgame.js +19 -19
  84. package/common/stm.js +163 -26
  85. package/common/stm.test.json +1734 -1
  86. package/common/tell.js +14 -18
  87. package/common/temperature.instance.json +1461 -1293
  88. package/common/temperature.js +4 -8
  89. package/common/tester.js +3 -3
  90. package/common/testing.js +8 -12
  91. package/common/time.js +20 -25
  92. package/common/tokenize.js +4 -5
  93. package/common/ui.instance.json +257 -258
  94. package/common/ui.js +11 -17
  95. package/common/weight.instance.json +5212 -4233
  96. package/common/weight.js +4 -8
  97. package/common/yesno.js +5 -5
  98. package/main.js +59 -46
  99. package/package.json +27 -5
@@ -0,0 +1,574 @@
1
+ [
2
+ {
3
+ "associations": [
4
+ [
5
+ [
6
+ "evaluate",
7
+ 0
8
+ ],
9
+ [
10
+ "value1",
11
+ 0
12
+ ]
13
+ ]
14
+ ],
15
+ "config": {
16
+ "words": {
17
+ "hierarchy": [
18
+ {
19
+ "child": " ",
20
+ "parent": "space"
21
+ },
22
+ {
23
+ "child": "0",
24
+ "parent": "digit"
25
+ },
26
+ {
27
+ "child": "1",
28
+ "parent": "digit"
29
+ },
30
+ {
31
+ "child": "2",
32
+ "parent": "digit"
33
+ },
34
+ {
35
+ "child": "3",
36
+ "parent": "digit"
37
+ },
38
+ {
39
+ "child": "4",
40
+ "parent": "digit"
41
+ },
42
+ {
43
+ "child": "5",
44
+ "parent": "digit"
45
+ },
46
+ {
47
+ "child": "6",
48
+ "parent": "digit"
49
+ },
50
+ {
51
+ "child": "7",
52
+ "parent": "digit"
53
+ },
54
+ {
55
+ "child": "8",
56
+ "parent": "digit"
57
+ },
58
+ {
59
+ "child": "9",
60
+ "parent": "digit"
61
+ },
62
+ {
63
+ "child": "lower",
64
+ "parent": "letter"
65
+ },
66
+ {
67
+ "child": "upper",
68
+ "parent": "letter"
69
+ },
70
+ {
71
+ "child": "a",
72
+ "parent": "lower"
73
+ },
74
+ {
75
+ "child": "b",
76
+ "parent": "lower"
77
+ },
78
+ {
79
+ "child": "c",
80
+ "parent": "lower"
81
+ },
82
+ {
83
+ "child": "d",
84
+ "parent": "lower"
85
+ },
86
+ {
87
+ "child": "e",
88
+ "parent": "lower"
89
+ },
90
+ {
91
+ "child": "f",
92
+ "parent": "lower"
93
+ },
94
+ {
95
+ "child": "g",
96
+ "parent": "lower"
97
+ },
98
+ {
99
+ "child": "h",
100
+ "parent": "lower"
101
+ },
102
+ {
103
+ "child": "i",
104
+ "parent": "lower"
105
+ },
106
+ {
107
+ "child": "j",
108
+ "parent": "lower"
109
+ },
110
+ {
111
+ "child": "k",
112
+ "parent": "lower"
113
+ },
114
+ {
115
+ "child": "l",
116
+ "parent": "lower"
117
+ },
118
+ {
119
+ "child": "m",
120
+ "parent": "lower"
121
+ },
122
+ {
123
+ "child": "n",
124
+ "parent": "lower"
125
+ },
126
+ {
127
+ "child": "o",
128
+ "parent": "lower"
129
+ },
130
+ {
131
+ "child": "p",
132
+ "parent": "lower"
133
+ },
134
+ {
135
+ "child": "q",
136
+ "parent": "lower"
137
+ },
138
+ {
139
+ "child": "r",
140
+ "parent": "lower"
141
+ },
142
+ {
143
+ "child": "s",
144
+ "parent": "lower"
145
+ },
146
+ {
147
+ "child": "t",
148
+ "parent": "lower"
149
+ },
150
+ {
151
+ "child": "u",
152
+ "parent": "lower"
153
+ },
154
+ {
155
+ "child": "v",
156
+ "parent": "lower"
157
+ },
158
+ {
159
+ "child": "w",
160
+ "parent": "lower"
161
+ },
162
+ {
163
+ "child": "x",
164
+ "parent": "lower"
165
+ },
166
+ {
167
+ "child": "y",
168
+ "parent": "lower"
169
+ },
170
+ {
171
+ "child": "z",
172
+ "parent": "lower"
173
+ },
174
+ {
175
+ "child": "A",
176
+ "parent": "upper"
177
+ },
178
+ {
179
+ "child": "B",
180
+ "parent": "upper"
181
+ },
182
+ {
183
+ "child": "C",
184
+ "parent": "upper"
185
+ },
186
+ {
187
+ "child": "D",
188
+ "parent": "upper"
189
+ },
190
+ {
191
+ "child": "E",
192
+ "parent": "upper"
193
+ },
194
+ {
195
+ "child": "F",
196
+ "parent": "upper"
197
+ },
198
+ {
199
+ "child": "G",
200
+ "parent": "upper"
201
+ },
202
+ {
203
+ "child": "H",
204
+ "parent": "upper"
205
+ },
206
+ {
207
+ "child": "I",
208
+ "parent": "upper"
209
+ },
210
+ {
211
+ "child": "J",
212
+ "parent": "upper"
213
+ },
214
+ {
215
+ "child": "K",
216
+ "parent": "upper"
217
+ },
218
+ {
219
+ "child": "L",
220
+ "parent": "upper"
221
+ },
222
+ {
223
+ "child": "M",
224
+ "parent": "upper"
225
+ },
226
+ {
227
+ "child": "N",
228
+ "parent": "upper"
229
+ },
230
+ {
231
+ "child": "O",
232
+ "parent": "upper"
233
+ },
234
+ {
235
+ "child": "P",
236
+ "parent": "upper"
237
+ },
238
+ {
239
+ "child": "Q",
240
+ "parent": "upper"
241
+ },
242
+ {
243
+ "child": "R",
244
+ "parent": "upper"
245
+ },
246
+ {
247
+ "child": "S",
248
+ "parent": "upper"
249
+ },
250
+ {
251
+ "child": "T",
252
+ "parent": "upper"
253
+ },
254
+ {
255
+ "child": "U",
256
+ "parent": "upper"
257
+ },
258
+ {
259
+ "child": "V",
260
+ "parent": "upper"
261
+ },
262
+ {
263
+ "child": "W",
264
+ "parent": "upper"
265
+ },
266
+ {
267
+ "child": "X",
268
+ "parent": "upper"
269
+ },
270
+ {
271
+ "child": "Y",
272
+ "parent": "upper"
273
+ },
274
+ {
275
+ "child": "Z",
276
+ "parent": "upper"
277
+ },
278
+ {
279
+ "child": "letter",
280
+ "parent": "alphanumeric"
281
+ },
282
+ {
283
+ "child": "digit",
284
+ "parent": "alphanumeric"
285
+ },
286
+ {
287
+ "child": "_",
288
+ "parent": "alphanumeric"
289
+ },
290
+ {
291
+ "child": "~",
292
+ "parent": "punctuation"
293
+ },
294
+ {
295
+ "child": "!",
296
+ "parent": "punctuation"
297
+ },
298
+ {
299
+ "child": "@",
300
+ "parent": "punctuation"
301
+ },
302
+ {
303
+ "child": "#",
304
+ "parent": "punctuation"
305
+ },
306
+ {
307
+ "child": "$",
308
+ "parent": "punctuation"
309
+ },
310
+ {
311
+ "child": "%",
312
+ "parent": "punctuation"
313
+ },
314
+ {
315
+ "child": "^",
316
+ "parent": "punctuation"
317
+ },
318
+ {
319
+ "child": "&",
320
+ "parent": "punctuation"
321
+ },
322
+ {
323
+ "child": "*",
324
+ "parent": "punctuation"
325
+ },
326
+ {
327
+ "child": "(",
328
+ "parent": "punctuation"
329
+ },
330
+ {
331
+ "child": ")",
332
+ "parent": "punctuation"
333
+ },
334
+ {
335
+ "child": "+",
336
+ "parent": "punctuation"
337
+ },
338
+ {
339
+ "child": "-",
340
+ "parent": "punctuation"
341
+ },
342
+ {
343
+ "child": "=",
344
+ "parent": "punctuation"
345
+ },
346
+ {
347
+ "child": "[",
348
+ "parent": "punctuation"
349
+ },
350
+ {
351
+ "child": "]",
352
+ "parent": "punctuation"
353
+ },
354
+ {
355
+ "child": "{",
356
+ "parent": "punctuation"
357
+ },
358
+ {
359
+ "child": "}",
360
+ "parent": "punctuation"
361
+ },
362
+ {
363
+ "child": "\\",
364
+ "parent": "punctuation"
365
+ },
366
+ {
367
+ "child": "|",
368
+ "parent": "punctuation"
369
+ },
370
+ {
371
+ "child": ";",
372
+ "parent": "punctuation"
373
+ },
374
+ {
375
+ "child": ":",
376
+ "parent": "punctuation"
377
+ },
378
+ {
379
+ "child": ",",
380
+ "parent": "punctuation"
381
+ },
382
+ {
383
+ "child": "<",
384
+ "parent": "punctuation"
385
+ },
386
+ {
387
+ "child": ">",
388
+ "parent": "punctuation"
389
+ },
390
+ {
391
+ "child": "/",
392
+ "parent": "punctuation"
393
+ },
394
+ {
395
+ "child": "?",
396
+ "parent": "punctuation"
397
+ },
398
+ {
399
+ "child": "'",
400
+ "parent": "punctuation"
401
+ },
402
+ {
403
+ "child": "\"",
404
+ "parent": "punctuation"
405
+ }
406
+ ],
407
+ "literals": {
408
+ },
409
+ "patterns": [
410
+ {
411
+ "defs": [
412
+ {
413
+ "remove": true,
414
+ "uuid": "tokenize2"
415
+ }
416
+ ],
417
+ "pattern": [
418
+ {
419
+ "type": "space"
420
+ },
421
+ {
422
+ "repeat": true
423
+ }
424
+ ]
425
+ },
426
+ {
427
+ "defs": [
428
+ {
429
+ "id": "unknown",
430
+ "initial": "{ value: text, unknown: true }",
431
+ "uuid": "tokenize2"
432
+ }
433
+ ],
434
+ "pattern": [
435
+ {
436
+ "type": "alphanumeric"
437
+ },
438
+ {
439
+ "repeat": true
440
+ }
441
+ ]
442
+ }
443
+ ]
444
+ }
445
+ },
446
+ "contexts": [
447
+ {
448
+ "dead": true,
449
+ "default": true,
450
+ "isResponse": true,
451
+ "level": 1,
452
+ "marker": "evaluate",
453
+ "postModifiers": [
454
+ "value"
455
+ ],
456
+ "range": {
457
+ "end": 14,
458
+ "start": 0
459
+ },
460
+ "response": "value1 after evaluation",
461
+ "text": "evaluate value1",
462
+ "topLevel": true,
463
+ "touchedBy": [
464
+ "evaluate#call2"
465
+ ],
466
+ "value": {
467
+ "default": true,
468
+ "level": 0,
469
+ "marker": "value1",
470
+ "range": {
471
+ "end": 14,
472
+ "start": 9
473
+ },
474
+ "text": "value1",
475
+ "value": "value1",
476
+ "word": "value1"
477
+ },
478
+ "word": "evaluate"
479
+ }
480
+ ],
481
+ "generatedParenthesized": [
482
+ "(value1 after evaluation)"
483
+ ],
484
+ "metadata": {
485
+ "opChoices": [
486
+ {
487
+ "counter": 1,
488
+ "op": [
489
+ "evaluate",
490
+ 0
491
+ ],
492
+ "ops": [
493
+ [
494
+ "evaluate",
495
+ 0
496
+ ],
497
+ [
498
+ "value1",
499
+ 0
500
+ ]
501
+ ]
502
+ }
503
+ ]
504
+ },
505
+ "objects": {
506
+ "nameToUUID": {
507
+ "evaluate": "evaluate1",
508
+ "gdefaults": "gdefaults2",
509
+ "tokenize": "tokenize2"
510
+ },
511
+ "namespaced": {
512
+ "evaluate1": {
513
+ },
514
+ "gdefaults2": {
515
+ },
516
+ "tokenize2": {
517
+ }
518
+ },
519
+ "processed": [
520
+ {
521
+ "context": {
522
+ "dead": true,
523
+ "default": true,
524
+ "isResponse": true,
525
+ "level": 1,
526
+ "marker": "evaluate",
527
+ "postModifiers": [
528
+ "value"
529
+ ],
530
+ "range": {
531
+ "end": 14,
532
+ "start": 0
533
+ },
534
+ "response": "value1 after evaluation",
535
+ "text": "evaluate value1",
536
+ "topLevel": true,
537
+ "touchedBy": [
538
+ "evaluate#call2"
539
+ ],
540
+ "value": {
541
+ "default": true,
542
+ "level": 0,
543
+ "marker": "value1",
544
+ "range": {
545
+ "end": 14,
546
+ "start": 9
547
+ },
548
+ "text": "value1",
549
+ "value": "value1",
550
+ "word": "value1"
551
+ },
552
+ "word": "evaluate"
553
+ },
554
+ "generatedParenthesized": "(value1 after evaluation)",
555
+ "paraphrases": "evaluate value1",
556
+ "paraphrasesParenthesized": "((evaluate) (value1))",
557
+ "responses": [
558
+ "value1 after evaluation"
559
+ ]
560
+ }
561
+ ]
562
+ },
563
+ "paraphrases": [
564
+ "evaluate value1"
565
+ ],
566
+ "paraphrasesParenthesized": [
567
+ "((evaluate) (value1))"
568
+ ],
569
+ "query": "evaluate value1",
570
+ "responses": [
571
+ "value1 after evaluation"
572
+ ]
573
+ }
574
+ ]
package/common/events.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 dialogues = require('./dialogues')
4
4
  const _ = require('lodash')
@@ -19,7 +19,7 @@ class API {
19
19
  }
20
20
  }
21
21
 
22
- let configStruct = {
22
+ let config = {
23
23
  name: 'events',
24
24
  operators: [
25
25
  "([after] ([event]) ([action]))",
@@ -32,7 +32,7 @@ let configStruct = {
32
32
  where: where(),
33
33
  id: "after", level: 0,
34
34
  bridge: "{ ...next(operator), event: after[0], action: after[1] }",
35
- generatorp: ({context, gp}) => `after ${gp(context.event)} ${gp(context.action)}`,
35
+ generatorp: async ({context, gp}) => `after ${await gp(context.event)} ${await gp(context.action)}`,
36
36
  },
37
37
  { id: "action", level: 0, bridge: "{ ...next(operator) }" },
38
38
  { id: "changeable", level: 0, bridge: "{ ...next(operator) }" },
@@ -42,11 +42,11 @@ let configStruct = {
42
42
  level: 0,
43
43
  isA: ['verby'],
44
44
  bridge: "{ ...next(operator), changeable: before[0] }",
45
- generatorp: ({context, g}) => {
45
+ generatorp: async ({context, g}) => {
46
46
  if (!context.changeable) {
47
47
  return 'undefined changes'
48
48
  }
49
- return `${g(context.changeable)} changes`
49
+ return `${await g(context.changeable)} changes`
50
50
  }
51
51
  },
52
52
  {
@@ -117,17 +117,13 @@ let configStruct = {
117
117
  ],
118
118
  };
119
119
 
120
- const createConfig = () => {
121
- const config = new Config(configStruct, module)
122
- config.api = new API()
123
- config.add(dialogues())
124
- return config
125
- }
126
-
127
120
  knowledgeModule({
121
+ config,
122
+ api: () => new API(),
123
+ includes: [dialogues],
124
+
128
125
  module,
129
126
  description: 'do stuff after events',
130
- createConfig,
131
127
  test: {
132
128
  name: './events.test.json',
133
129
  contents: events_tests,