tpmkms_4wp 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/animals.js CHANGED
@@ -25,9 +25,9 @@ const template = {
25
25
  ],
26
26
  }
27
27
 
28
- const createConfig = () => {
28
+ const createConfig = async () => {
29
29
  const config = new Config({ name: 'animals' }, module)
30
- config.add(hierarchy())
30
+ await config.add(hierarchy)
31
31
  return config
32
32
  }
33
33
 
@@ -0,0 +1,108 @@
1
+ const { Config, knowledgeModule, where, stableId } = require('./runtime').theprogrammablemind
2
+ const gdefaults = require('./gdefaults.js')
3
+ const pos = require('./pos.js')
4
+ const { defaultContextCheck } = require('./helpers')
5
+ const tests = require('./articles.test.json')
6
+
7
+ let configStruct = {
8
+ name: 'articles',
9
+ operators: [
10
+ "([thisitthat|])",
11
+ "([it])",
12
+ "([this])",
13
+ "([that])",
14
+ "([queryable])",
15
+ /*
16
+ "(<what> ([whatAble|]))",
17
+ "([what:optional])",
18
+ */
19
+ "(<the|> ([theAble]))",
20
+ "(<a|a,an> ([theAble|]))",
21
+ ],
22
+ bridges: [
23
+ // { id: "what", level: 0, optional: "{ ...next(operator), query: ['what'], determined: true }", bridge: "{ ...after, query: ['what'], modifiers: ['what'], what: operator }" },
24
+ // { id: "whatAble", level: 0, bridge: "{ ...next(operator) }" },
25
+ {
26
+ id: 'the',
27
+ level: 0,
28
+ bridge: '{ ...after[0], focusableForPhrase: true, pullFromContext: true, concept: true, wantsValue: true, determiner: "the", modifiers: append(["determiner"], after[0].modifiers)}'
29
+ },
30
+ {
31
+ id: "a",
32
+ level: 0,
33
+ // bridge: "{ ...after[0], pullFromContext: false, instance: true, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
34
+ bridge: "{ ...after[0], pullFromContext: false, concept: true, number: 'one', wantsValue: true, determiner: operator, modifiers: append(['determiner'], after[0].modifiers) }"
35
+ },
36
+ { id: "queryable" },
37
+ {
38
+ id: "theAble",
39
+ children: ['noun'],
40
+ bridge: "{ ...next(operator) }"
41
+ },
42
+
43
+ {
44
+ id: "thisitthat",
45
+ level: 0,
46
+ isA: ['queryable'],
47
+ before: ['verby'],
48
+ bridge: "{ ...next(operator) }"
49
+ },
50
+ {
51
+ id: "it",
52
+ level: 0,
53
+ isA: ['thisitthat'],
54
+ bridge: "{ ...next(operator), pullFromContext: true, unknown: true, determined: true }"
55
+ },
56
+ {
57
+ id: "this",
58
+ level: 0,
59
+ isA: ['thisitthat'],
60
+ bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
61
+ },
62
+ {
63
+ id: "that",
64
+ level: 0,
65
+ isA: ['thisitthat'],
66
+ bridge: "{ ...next(operator), unknown: true, pullFromContext: true }"
67
+ },
68
+ ],
69
+ words: {
70
+ "literals": {
71
+ "the": [{"id": "the", "initial": "{ modifiers: [] }" }],
72
+ }
73
+ },
74
+ hierarchy: [
75
+ ['it', 'pronoun'],
76
+ ['this', 'pronoun'],
77
+ // ['questionMark', 'isEd'],
78
+ ['a', 'articlePOS'],
79
+ ['the', 'articlePOS'],
80
+ ['it', 'queryable'],
81
+ // ['it', 'toAble'],
82
+ ['this', 'queryable'],
83
+ ],
84
+
85
+ };
86
+
87
+ const createConfig = async () => {
88
+ const config = new Config(configStruct, module)
89
+ config.stop_auto_rebuild()
90
+ await config.add(pos, gdefaults)
91
+ await config.restart_auto_rebuild()
92
+ return config
93
+ }
94
+
95
+ knowledgeModule( {
96
+ module,
97
+ description: 'articles',
98
+ createConfig, newWay: true,
99
+ test: {
100
+ name: './articles.test.json',
101
+ contents: tests,
102
+ checks: {
103
+ objects: ['onNevermindWasCalled', 'nevermindType', 'idSuffix'],
104
+ context: defaultContextCheck,
105
+ },
106
+
107
+ },
108
+ })
@@ -0,0 +1,310 @@
1
+ [
2
+ {
3
+ "associations": [
4
+ [
5
+ [
6
+ "the",
7
+ 0
8
+ ],
9
+ [
10
+ "theAble",
11
+ 0
12
+ ]
13
+ ]
14
+ ],
15
+ "config": {
16
+ },
17
+ "contexts": [
18
+ {
19
+ "concept": true,
20
+ "dead": true,
21
+ "default": true,
22
+ "determiner": "the",
23
+ "focusableForPhrase": true,
24
+ "level": 1,
25
+ "marker": "theAble",
26
+ "modifiers": [
27
+ "determiner"
28
+ ],
29
+ "pullFromContext": true,
30
+ "range": {
31
+ "end": 10,
32
+ "start": 0
33
+ },
34
+ "text": "the theable",
35
+ "topLevel": true,
36
+ "types": [
37
+ "theAble"
38
+ ],
39
+ "value": "theAble",
40
+ "wantsValue": true,
41
+ "word": "theable"
42
+ }
43
+ ],
44
+ "developerTest": false,
45
+ "generatedParenthesized": [
46
+ ""
47
+ ],
48
+ "metadata": {
49
+ "opChoices": [
50
+ {
51
+ "counter": 1,
52
+ "op": [
53
+ "theAble",
54
+ 0
55
+ ],
56
+ "ops": [
57
+ [
58
+ "the",
59
+ 0
60
+ ],
61
+ [
62
+ "theAble",
63
+ 0
64
+ ]
65
+ ]
66
+ },
67
+ {
68
+ "counter": 2,
69
+ "op": [
70
+ "the",
71
+ 0
72
+ ],
73
+ "ops": [
74
+ [
75
+ "the",
76
+ 0
77
+ ]
78
+ ]
79
+ }
80
+ ]
81
+ },
82
+ "objects": {
83
+ "nameToUUID": {
84
+ "articles": "articles1",
85
+ "gdefaults": "gdefaults2",
86
+ "pos": "pos2",
87
+ "tokenize": "tokenize2"
88
+ },
89
+ "namespaced": {
90
+ "articles1": {
91
+ },
92
+ "gdefaults2": {
93
+ },
94
+ "pos2": {
95
+ },
96
+ "tokenize2": {
97
+ }
98
+ },
99
+ "processed": [
100
+ {
101
+ "context": {
102
+ "concept": true,
103
+ "dead": true,
104
+ "default": true,
105
+ "determiner": "the",
106
+ "focusableForPhrase": true,
107
+ "level": 1,
108
+ "marker": "theAble",
109
+ "modifiers": [
110
+ "determiner"
111
+ ],
112
+ "pullFromContext": true,
113
+ "range": {
114
+ "end": 10,
115
+ "start": 0
116
+ },
117
+ "text": "the theable",
118
+ "topLevel": true,
119
+ "types": [
120
+ "theAble"
121
+ ],
122
+ "value": "theAble",
123
+ "wantsValue": true,
124
+ "word": "theable"
125
+ },
126
+ "generatedParenthesized": "",
127
+ "paraphrases": "the theable",
128
+ "paraphrasesParenthesized": "(the (theable))",
129
+ "responses": [
130
+ ""
131
+ ]
132
+ }
133
+ ]
134
+ },
135
+ "paraphrases": [
136
+ "the theable"
137
+ ],
138
+ "paraphrasesParenthesized": [
139
+ "(the (theable))"
140
+ ],
141
+ "query": "the theable",
142
+ "responses": [
143
+ ""
144
+ ]
145
+ },
146
+ {
147
+ "associations": [
148
+ [
149
+ [
150
+ "a",
151
+ 0
152
+ ],
153
+ [
154
+ "theAble",
155
+ 0
156
+ ]
157
+ ]
158
+ ],
159
+ "config": {
160
+ },
161
+ "contexts": [
162
+ {
163
+ "concept": true,
164
+ "dead": true,
165
+ "default": true,
166
+ "determiner": {
167
+ "default": true,
168
+ "level": 0,
169
+ "marker": "a",
170
+ "range": {
171
+ "end": 0,
172
+ "start": 0
173
+ },
174
+ "text": "a",
175
+ "word": "a"
176
+ },
177
+ "level": 1,
178
+ "marker": "theAble",
179
+ "modifiers": [
180
+ "determiner"
181
+ ],
182
+ "number": "one",
183
+ "pullFromContext": false,
184
+ "range": {
185
+ "end": 8,
186
+ "start": 0
187
+ },
188
+ "text": "a theable",
189
+ "topLevel": true,
190
+ "types": [
191
+ "theAble"
192
+ ],
193
+ "value": "theAble",
194
+ "wantsValue": true,
195
+ "word": "theable"
196
+ }
197
+ ],
198
+ "developerTest": false,
199
+ "generatedParenthesized": [
200
+ ""
201
+ ],
202
+ "metadata": {
203
+ "opChoices": [
204
+ {
205
+ "counter": 1,
206
+ "op": [
207
+ "theAble",
208
+ 0
209
+ ],
210
+ "ops": [
211
+ [
212
+ "a",
213
+ 0
214
+ ],
215
+ [
216
+ "theAble",
217
+ 0
218
+ ]
219
+ ]
220
+ },
221
+ {
222
+ "counter": 2,
223
+ "op": [
224
+ "a",
225
+ 0
226
+ ],
227
+ "ops": [
228
+ [
229
+ "a",
230
+ 0
231
+ ]
232
+ ]
233
+ }
234
+ ]
235
+ },
236
+ "objects": {
237
+ "nameToUUID": {
238
+ "articles": "articles1",
239
+ "gdefaults": "gdefaults2",
240
+ "pos": "pos2",
241
+ "tokenize": "tokenize2"
242
+ },
243
+ "namespaced": {
244
+ "articles1": {
245
+ },
246
+ "gdefaults2": {
247
+ },
248
+ "pos2": {
249
+ },
250
+ "tokenize2": {
251
+ }
252
+ },
253
+ "processed": [
254
+ {
255
+ "context": {
256
+ "concept": true,
257
+ "dead": true,
258
+ "default": true,
259
+ "determiner": {
260
+ "default": true,
261
+ "level": 0,
262
+ "marker": "a",
263
+ "range": {
264
+ "end": 0,
265
+ "start": 0
266
+ },
267
+ "text": "a",
268
+ "word": "a"
269
+ },
270
+ "level": 1,
271
+ "marker": "theAble",
272
+ "modifiers": [
273
+ "determiner"
274
+ ],
275
+ "number": "one",
276
+ "pullFromContext": false,
277
+ "range": {
278
+ "end": 8,
279
+ "start": 0
280
+ },
281
+ "text": "a theable",
282
+ "topLevel": true,
283
+ "types": [
284
+ "theAble"
285
+ ],
286
+ "value": "theAble",
287
+ "wantsValue": true,
288
+ "word": "theable"
289
+ },
290
+ "generatedParenthesized": "",
291
+ "paraphrases": "a theable",
292
+ "paraphrasesParenthesized": "((a) (theable))",
293
+ "responses": [
294
+ ""
295
+ ]
296
+ }
297
+ ]
298
+ },
299
+ "paraphrases": [
300
+ "a theable"
301
+ ],
302
+ "paraphrasesParenthesized": [
303
+ "((a) (theable))"
304
+ ],
305
+ "query": "a theable",
306
+ "responses": [
307
+ ""
308
+ ]
309
+ }
310
+ ]
package/common/avatar.js CHANGED
@@ -68,9 +68,9 @@ let configStruct = {
68
68
 
69
69
  };
70
70
 
71
- const createConfig = () => {
71
+ const createConfig = async () => {
72
72
  const config = new Config(configStruct, module)
73
- config.add(hierarchy(), emotions())
73
+ await config.add(hierarchy, emotions)
74
74
  return config
75
75
  }
76
76
 
@@ -173,27 +173,25 @@ const initializeApi = (config, api) => {
173
173
  }
174
174
 
175
175
 
176
- const createConfig = () => {
177
- const timeKM = createTimeKM()
178
- const currencyKM = createCurrencyKM()
176
+ const createConfig = async () => {
177
+ const timeKM = await createTimeKM()
178
+ const currencyKM = await createCurrencyKM()
179
179
  const api = new Sally(timeKM)
180
180
  const api2 = new Bob(currencyKM)
181
181
 
182
182
  const config = new Config(configStruct, module)
183
183
  config.stop_auto_rebuild()
184
- config.add(gdefaults())
184
+ await config.add(gdefaults)
185
185
 
186
- config.multiApi = initializeApi
187
- config.initializer( ({isModule, config, km}) => {
186
+ await config.setMultiApi(initializeApi)
187
+ config.initializer( async ({isModule, km}) => {
188
188
  if (!isModule) {
189
- // config.api = api2
190
- // config.api = api
191
189
  const config = km('characters')
192
- config.api = api2
193
- config.api = api
190
+ await config.setApi(api2)
191
+ await config.setApi(api)
194
192
  }
195
193
  })
196
- config.restart_auto_rebuild()
194
+ await config.restart_auto_rebuild()
197
195
  return config
198
196
  }
199
197