tpmkms_4wp 9.5.1 → 9.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/animals.instance.json +151 -61
- package/common/animals.js +3 -5
- package/common/asking.js +116 -106
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2194 -0
- package/common/can.js +251 -0
- package/common/can.test.json +51307 -0
- package/common/characters.js +5 -5
- package/common/colors.instance.json +152 -12
- package/common/colors.js +3 -6
- package/common/comparable.instance.json +33 -3
- package/common/comparable.js +3 -6
- package/common/concept.js +25 -27
- package/common/concept.test.json +180 -144
- package/common/conjunction.js +13 -5
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +433 -173
- package/common/crew.js +4 -7
- package/common/crew.test.json +4148 -3324
- package/common/currency.js +1 -1
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +6 -9
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +53 -3
- package/common/dates.js +3 -6
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +43 -122
- package/common/dialogues.test.json +1248 -1152
- package/common/dimension.instance.json +21493 -561
- package/common/dimension.js +150 -55
- package/common/dimension.test.json +10979 -4625
- package/common/drone.instance.json +24709 -0
- package/common/drone.js +662 -0
- package/common/drone.test.json +30522 -0
- package/common/drone_v1.instance.json +24703 -0
- package/common/drone_v1.js +596 -0
- package/common/drone_v1.test.json +115538 -0
- package/common/edible.instance.json +388 -32
- package/common/edible.js +3 -5
- package/common/emotions.instance.json +85 -76
- package/common/emotions.js +4 -7
- package/common/emotions.test.json +242 -174
- package/common/english_helpers.js +336 -0
- package/common/errors.js +6 -6
- package/common/evaluate.js +2 -2
- package/common/events.js +8 -8
- package/common/fastfood.instance.json +1071 -393
- package/common/fastfood.js +14 -16
- package/common/fastfood.test.json +6970 -6829
- package/common/formulas.instance.json +11 -1
- package/common/formulas.js +3 -2
- package/common/gdefaults.js +111 -17
- package/common/help.js +12 -12
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +10 -2
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +9 -9
- package/common/helpers/properties.js +186 -64
- package/common/helpers.js +167 -48
- package/common/hierarchy.js +12 -10
- package/common/kirk.instance.json +11 -1
- package/common/kirk.js +4 -6
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +12 -12
- package/common/latin.js +12 -14
- package/common/length.instance.json +34660 -3158
- package/common/length.js +11 -6
- package/common/length.test.json +54357 -2557
- package/common/math.instance.json +39 -29
- package/common/math.js +49 -47
- package/common/menus.instance.json +77 -10
- package/common/menus.js +4 -13
- package/common/meta.js +80 -65
- package/common/nameable.js +36 -22
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +107 -19
- package/common/ordering.js +4 -6
- package/common/ordering.test.json +835 -417
- package/common/people.instance.json +176 -348
- package/common/people.js +9 -9
- package/common/people.test.json +4135 -3606
- package/common/pipboy.instance.json +187 -17
- package/common/pipboy.js +4 -4
- package/common/pokemon.instance.json +143 -13
- package/common/pokemon.js +4 -6
- package/common/pressure.instance.json +3610 -1601
- package/common/pressure.js +3 -5
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +16 -17
- package/common/properties.js +32 -13
- package/common/properties.test.json +9565 -6951
- package/common/rates.instance.json +59 -0
- package/common/rates.js +95 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.instance.json +4 -4
- package/common/reminders.js +8 -11
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +23 -3
- package/common/reports.js +21 -21
- package/common/scorekeeper.js +9 -12
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +11 -1
- package/common/spock.js +4 -7
- package/common/spock.test.json +606 -430
- package/common/stgame.js +1 -1
- package/common/stm.js +41 -24
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +3163 -1154
- package/common/temperature.js +3 -5
- package/common/temperature.test.json +433 -477
- package/common/tester.js +3 -3
- package/common/time.instance.json +24852 -0
- package/common/time.js +138 -141
- package/common/time.test.json +31876 -3757
- package/common/tokenize.js +5 -2
- package/common/ui.instance.json +12 -5
- package/common/ui.js +4 -13
- package/common/weight.instance.json +10501 -4099
- package/common/weight.js +3 -5
- package/common/weight.test.json +2601 -2263
- package/common/words.instance.json +9 -0
- package/common/words.js +50 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +548 -8
- package/common/wp.js +10 -8
- package/common/wp.test.json +7385 -6906
- package/main.js +6 -2
- package/package.json +25 -6
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/helpers.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const pluralize = require('pluralize')
|
|
2
|
+
const { flatten } = require('./runtime').theprogrammablemind
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
function unshiftL(list, element, max) {
|
|
4
5
|
if (list.length >= max) {
|
|
5
6
|
list.pop()
|
|
6
7
|
}
|
|
7
8
|
list.unshift(element)
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
function pushL(list, element, max) {
|
|
11
12
|
if (list.length >= max) {
|
|
12
13
|
list.shift()
|
|
13
14
|
}
|
|
@@ -15,11 +16,11 @@ const pushL = (list, element, max) => {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
// X pm today or tomorrow
|
|
18
|
-
|
|
19
|
+
function millisecondsUntilHourOfDay(newDate, hour) {
|
|
19
20
|
const now = newDate()
|
|
20
21
|
const target = newDate(now)
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
function addHours(date, h) {
|
|
23
24
|
date.setTime(date.getTime() + (h*60*60*1000));
|
|
24
25
|
}
|
|
25
26
|
const hours = target.getHours()
|
|
@@ -34,11 +35,11 @@ const millisecondsUntilHourOfDay = (newDate, hour) => {
|
|
|
34
35
|
return diff;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
function indent(string, indent) {
|
|
38
39
|
return string.replace(/^/gm, ' '.repeat(indent));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
function getCount(context) {
|
|
42
43
|
if (context.quantity) {
|
|
43
44
|
return context.quantity.value
|
|
44
45
|
}
|
|
@@ -47,13 +48,23 @@ const getCount = (context) => {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
function words(word, additional = {}) {
|
|
51
52
|
return [{ word: pluralize.singular(word), number: 'one', ...additional }, { word: pluralize.plural(word), number: 'many', ...additional }]
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
55
|
+
function isMany(context) {
|
|
56
|
+
if (!context) {
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
// if (((context || {}).value || {}).marker == 'list' && (((context || {}).value || {}).value || []).length > 1) {
|
|
60
|
+
const isList = context.marker == 'list' || context.value?.marker == 'list'
|
|
61
|
+
if (isList) {
|
|
62
|
+
if (context.value?.length > 1) {
|
|
63
|
+
return true
|
|
64
|
+
}
|
|
65
|
+
if (context.value?.value?.length > 1) {
|
|
66
|
+
return true
|
|
67
|
+
}
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
let number = context.number
|
|
@@ -77,13 +88,13 @@ const isMany = (context) => {
|
|
|
77
88
|
return false
|
|
78
89
|
}
|
|
79
90
|
|
|
80
|
-
|
|
91
|
+
function requiredArgument(value, name) {
|
|
81
92
|
if (!value) {
|
|
82
93
|
throw new Error(`${name} is a required argument`)
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
function chooseNumber(context, one, many) {
|
|
87
98
|
if (isMany(context)) {
|
|
88
99
|
return many;
|
|
89
100
|
} else {
|
|
@@ -91,7 +102,7 @@ const chooseNumber = (context, one, many) => {
|
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
function zip(...arrays) {
|
|
95
106
|
if (arrays == []) {
|
|
96
107
|
return []
|
|
97
108
|
}
|
|
@@ -107,15 +118,21 @@ const zip = (...arrays) => {
|
|
|
107
118
|
}
|
|
108
119
|
|
|
109
120
|
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
function focus(context) {
|
|
122
|
+
function helper(context) {
|
|
112
123
|
if (!context || !context.focusable) {
|
|
113
124
|
return null
|
|
114
125
|
}
|
|
115
126
|
for (const property of context.focusable) {
|
|
116
127
|
let focus = helper(context[property])
|
|
117
|
-
if (!focus
|
|
118
|
-
|
|
128
|
+
if (!focus) {
|
|
129
|
+
const flat = flatten(['list'], context[property])[0]
|
|
130
|
+
for (const element of flat) {
|
|
131
|
+
if (element.focus) {
|
|
132
|
+
focus = context[property]
|
|
133
|
+
break
|
|
134
|
+
}
|
|
135
|
+
}
|
|
119
136
|
}
|
|
120
137
|
return focus
|
|
121
138
|
}
|
|
@@ -126,7 +143,7 @@ const focus = (context) => {
|
|
|
126
143
|
|
|
127
144
|
// if property is a list make array of elements of the list, if not return an array with the property value
|
|
128
145
|
// fromList
|
|
129
|
-
|
|
146
|
+
function propertyToArray(value) {
|
|
130
147
|
if (Array.isArray(value)) {
|
|
131
148
|
return value
|
|
132
149
|
} else if (value.marker == 'list') {
|
|
@@ -136,7 +153,23 @@ const propertyToArray = (value) => {
|
|
|
136
153
|
}
|
|
137
154
|
}
|
|
138
155
|
|
|
139
|
-
|
|
156
|
+
// values is marker: 'list' or some context
|
|
157
|
+
function concats(values) {
|
|
158
|
+
combined = []
|
|
159
|
+
for (const value of values) {
|
|
160
|
+
if (value.marker == 'list') {
|
|
161
|
+
combined = combined.concat(value.value)
|
|
162
|
+
} else {
|
|
163
|
+
combined.push(value)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
marker: 'list',
|
|
168
|
+
value: combined
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function wordNumber(word, toPlural) {
|
|
140
173
|
if (toPlural) {
|
|
141
174
|
return pluralize.plural(word)
|
|
142
175
|
} else {
|
|
@@ -144,17 +177,18 @@ wordNumber = (word, toPlural) => {
|
|
|
144
177
|
}
|
|
145
178
|
}
|
|
146
179
|
|
|
147
|
-
|
|
180
|
+
function toEValue(context) {
|
|
148
181
|
while( context.evalue ) {
|
|
149
182
|
context = context.evalue
|
|
150
183
|
}
|
|
151
184
|
return context;
|
|
152
185
|
}
|
|
153
186
|
|
|
154
|
-
|
|
187
|
+
function defaultObjectCheck(extra = []) {
|
|
155
188
|
return {
|
|
156
189
|
objects: [
|
|
157
190
|
{
|
|
191
|
+
extra,
|
|
158
192
|
match: ({objects}) => true,
|
|
159
193
|
apply: () => extra
|
|
160
194
|
},
|
|
@@ -162,57 +196,62 @@ const defaultObjectCheck = (extra = []) => {
|
|
|
162
196
|
}
|
|
163
197
|
}
|
|
164
198
|
|
|
165
|
-
|
|
199
|
+
function defaultContextCheckProperties(extra) {
|
|
166
200
|
return ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra]
|
|
167
201
|
}
|
|
168
202
|
|
|
169
|
-
|
|
203
|
+
function defaultContextCheck({marker, extra = [], exported = false} = {}) {
|
|
170
204
|
let match
|
|
171
205
|
if (marker) {
|
|
172
206
|
match = ({context}) => context.marker == marker
|
|
173
207
|
} else {
|
|
174
|
-
match = ({context}) => !Array.isArray(context)
|
|
175
208
|
}
|
|
176
209
|
return {
|
|
210
|
+
marker,
|
|
177
211
|
match,
|
|
178
212
|
exported,
|
|
179
213
|
apply: () => ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra],
|
|
180
214
|
}
|
|
181
215
|
}
|
|
182
216
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (strict) {
|
|
189
|
-
if (child.marker) {
|
|
190
|
-
child = child.marker
|
|
191
|
-
}
|
|
192
|
-
if (parent.marker) {
|
|
193
|
-
parent = parent.marker
|
|
194
|
-
}
|
|
195
|
-
return hierarchy.isA(child, parent)
|
|
196
|
-
} else {
|
|
197
|
-
if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
|
|
198
|
-
return true
|
|
217
|
+
function isA(hierarchy) {
|
|
218
|
+
return (child, parent, { strict=false } = {}) => {
|
|
219
|
+
if (!child || !parent) {
|
|
220
|
+
return false
|
|
199
221
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
222
|
+
|
|
223
|
+
if (strict) {
|
|
224
|
+
if (child.marker) {
|
|
225
|
+
child = child.marker
|
|
226
|
+
}
|
|
227
|
+
if (parent.marker) {
|
|
228
|
+
parent = parent.marker
|
|
229
|
+
}
|
|
230
|
+
return hierarchy.isA(child, parent)
|
|
231
|
+
} else {
|
|
232
|
+
if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
|
|
233
|
+
return true
|
|
234
|
+
}
|
|
235
|
+
for (const childT of child.types || [child]) {
|
|
236
|
+
for (const parentT of parent.types || [parent]) {
|
|
237
|
+
if (hierarchy.isA(childT, parentT)) {
|
|
238
|
+
return true
|
|
239
|
+
}
|
|
204
240
|
}
|
|
205
241
|
}
|
|
242
|
+
return false
|
|
206
243
|
}
|
|
207
|
-
return false
|
|
208
244
|
}
|
|
209
245
|
}
|
|
210
246
|
|
|
211
|
-
|
|
247
|
+
function getValue(propertyPath, object) {
|
|
212
248
|
if (!propertyPath) {
|
|
213
249
|
return
|
|
214
250
|
}
|
|
215
|
-
|
|
251
|
+
let path = propertyPath
|
|
252
|
+
if (typeof path == 'string') {
|
|
253
|
+
path = propertyPath.split('.')
|
|
254
|
+
}
|
|
216
255
|
let value = object
|
|
217
256
|
for (const name of path) {
|
|
218
257
|
if (!value) {
|
|
@@ -223,7 +262,30 @@ const getValue = (propertyPath, object) => {
|
|
|
223
262
|
return value
|
|
224
263
|
}
|
|
225
264
|
|
|
226
|
-
|
|
265
|
+
function setValue(propertyPath, object, newValue) {
|
|
266
|
+
if (!propertyPath) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
let path = propertyPath;
|
|
270
|
+
if (typeof path === 'string') {
|
|
271
|
+
path = propertyPath.split('.');
|
|
272
|
+
}
|
|
273
|
+
let current = object;
|
|
274
|
+
for (let i = 0; i < path.length; i++) {
|
|
275
|
+
const name = path[i];
|
|
276
|
+
if (i === path.length - 1) {
|
|
277
|
+
// Set the value at the final step
|
|
278
|
+
current[name] = newValue;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
if (current[name] === undefined || current[name] === null) {
|
|
282
|
+
current[name] = {}; // Create a plain object for nesting
|
|
283
|
+
}
|
|
284
|
+
current = current[name];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
async function processTemplateString(template, evaluate) {
|
|
227
289
|
async function resolveWithCallback(strings, ...keys) {
|
|
228
290
|
// const resolvedValues = await Promise.all(keys.map(key => lookupVariable(key)));
|
|
229
291
|
const resolvedValues = await Promise.all(keys.map(async (key) => {
|
|
@@ -263,11 +325,66 @@ const processTemplateString = async (template, evaluate) => {
|
|
|
263
325
|
return await processTemplateString(template)
|
|
264
326
|
}
|
|
265
327
|
|
|
328
|
+
// removeProp.js
|
|
329
|
+
function removeProp(obj, testFn, { maxDepth = Infinity, seen = new WeakSet() } = {}) {
|
|
330
|
+
if (!obj || typeof obj !== 'object' || maxDepth <= 0) return obj;
|
|
331
|
+
if (seen.has(obj)) return obj;
|
|
332
|
+
seen.add(obj);
|
|
333
|
+
|
|
334
|
+
if (Array.isArray(obj)) {
|
|
335
|
+
// ---- ARRAY: process each element (but don't remove elements unless testFn says so)
|
|
336
|
+
let writeIdx = 0;
|
|
337
|
+
for (let i = 0; i < obj.length; i++) {
|
|
338
|
+
const element = obj[i];
|
|
339
|
+
const shouldRemoveElement = testFn(element, i, obj);
|
|
340
|
+
|
|
341
|
+
if (shouldRemoveElement) {
|
|
342
|
+
// Remove the whole array element
|
|
343
|
+
if (element && typeof element === 'object') {
|
|
344
|
+
// Still walk inside it in case testFn wants side effects
|
|
345
|
+
removeProp(element, testFn, { maxDepth: maxDepth - 1, seen });
|
|
346
|
+
}
|
|
347
|
+
// Skip writing it back
|
|
348
|
+
} else {
|
|
349
|
+
// Keep element, but walk into it to remove inner props
|
|
350
|
+
removeProp(element, testFn, { maxDepth: maxDepth - 1, seen });
|
|
351
|
+
if (writeIdx !== i) {
|
|
352
|
+
obj[writeIdx] = element;
|
|
353
|
+
}
|
|
354
|
+
writeIdx++;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
obj.length = writeIdx;
|
|
358
|
+
return obj;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// ---- OBJECT: iterate over own keys
|
|
362
|
+
const keys = Reflect.ownKeys(obj);
|
|
363
|
+
for (const key of keys) {
|
|
364
|
+
const val = obj[key];
|
|
365
|
+
const shouldRemove = testFn(val, key, obj);
|
|
366
|
+
|
|
367
|
+
if (shouldRemove) {
|
|
368
|
+
delete obj[key];
|
|
369
|
+
if (val && typeof val === 'object') {
|
|
370
|
+
removeProp(val, testFn, { maxDepth: maxDepth - 1, seen });
|
|
371
|
+
}
|
|
372
|
+
} else {
|
|
373
|
+
removeProp(val, testFn, { maxDepth: maxDepth - 1, seen });
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return obj;
|
|
378
|
+
}
|
|
379
|
+
|
|
266
380
|
module.exports = {
|
|
267
381
|
processTemplateString,
|
|
268
382
|
unshiftL,
|
|
269
383
|
pushL,
|
|
384
|
+
|
|
270
385
|
getValue,
|
|
386
|
+
setValue,
|
|
387
|
+
|
|
271
388
|
defaultContextCheck,
|
|
272
389
|
defaultContextCheckProperties,
|
|
273
390
|
defaultObjectCheck,
|
|
@@ -284,4 +401,6 @@ module.exports = {
|
|
|
284
401
|
wordNumber,
|
|
285
402
|
requiredArgument,
|
|
286
403
|
isA,
|
|
404
|
+
removeProp,
|
|
405
|
+
concats
|
|
287
406
|
}
|
package/common/hierarchy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
1
|
+
const { debug, knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const properties = require('./properties')
|
|
4
4
|
const hierarchy_tests = require('./hierarchy.test.json')
|
|
@@ -6,14 +6,14 @@ const pluralize = require('pluralize')
|
|
|
6
6
|
const _ = require('lodash')
|
|
7
7
|
const { isMany } = require('./helpers')
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const propertiesAPI = km('properties').api;
|
|
9
|
+
function getTypes( km, digraph, concept, instance ) {
|
|
10
|
+
// const propertiesAPI = km('properties').api;
|
|
11
11
|
const conceptAPI = km('concept').api;
|
|
12
|
-
const digraph = propertiesAPI.digraph;
|
|
13
|
-
|
|
12
|
+
// const digraph = propertiesAPI.digraph;
|
|
13
|
+
function intersect(set1, set2) {
|
|
14
14
|
return new Set([...set1].filter(x => set2.has(x)))
|
|
15
15
|
}
|
|
16
|
-
const descendants = digraph.descendants(concept.value)
|
|
16
|
+
const descendants = digraph.descendants(concept.value || concept.marker)
|
|
17
17
|
const ancestors = digraph.ancestors(instance.evalue)
|
|
18
18
|
const common = intersect(ancestors, descendants)
|
|
19
19
|
const answer = Array.from(digraph.minima(common))
|
|
@@ -79,7 +79,7 @@ const config = {
|
|
|
79
79
|
context.isResponse = true
|
|
80
80
|
return
|
|
81
81
|
}
|
|
82
|
-
instance = getTypes(km, concept, instance)
|
|
82
|
+
instance = getTypes(km, hierarchy, concept, instance)
|
|
83
83
|
|
|
84
84
|
concept = _.cloneDeep(value)
|
|
85
85
|
concept.isQuery = undefined
|
|
@@ -104,7 +104,7 @@ const config = {
|
|
|
104
104
|
notes: 'type of pikachu', // the types of type is the next one
|
|
105
105
|
where: where(),
|
|
106
106
|
match: ({context}) => context.marker == 'type' && context.evaluate && context.object && context.objects[context.objects.length-1].number == 'one' && pluralize.isSingular(context.objects[0].word),
|
|
107
|
-
apply: async ({context, objects, e, gs, km, log}) => {
|
|
107
|
+
apply: async ({context, hierarchy, objects, e, gs, km, log}) => {
|
|
108
108
|
const concept = context.objects[0];
|
|
109
109
|
const value = context.objects[1];
|
|
110
110
|
let instance = await e(value)
|
|
@@ -112,7 +112,7 @@ const config = {
|
|
|
112
112
|
context.evalue = { verbatim: instance.verbatim }
|
|
113
113
|
return
|
|
114
114
|
}
|
|
115
|
-
instance = getTypes(km, concept, instance)
|
|
115
|
+
instance = getTypes(km, hierarchy, concept, instance)
|
|
116
116
|
context.evalue = instance
|
|
117
117
|
if (context.evalue.value.length > 1) {
|
|
118
118
|
context.number = 'many'
|
|
@@ -253,9 +253,11 @@ const config = {
|
|
|
253
253
|
const twoConcepts = asList(context.same);
|
|
254
254
|
for (const oneConcept of oneConcepts.value) {
|
|
255
255
|
for (const twoConcept of twoConcepts.value) {
|
|
256
|
+
// debug.counter('greg23', { breakAt: 39 })
|
|
256
257
|
oneConceptId = await api.makeObject({...args, context: oneConcept})
|
|
257
258
|
twoConceptId = await api.makeObject({...args, context: twoConcept})
|
|
258
259
|
api.rememberIsA(oneConceptId, twoConceptId)
|
|
260
|
+
api.seenHierarchyWatcher({ childId: oneConceptId, child: oneConcept, parentId: twoConceptId, parent: twoConcept })
|
|
259
261
|
context.sameWasProcessed = true
|
|
260
262
|
}
|
|
261
263
|
}
|
|
@@ -286,7 +288,7 @@ const config = {
|
|
|
286
288
|
]
|
|
287
289
|
};
|
|
288
290
|
|
|
289
|
-
|
|
291
|
+
function initializer({apis, hierarchy}) {
|
|
290
292
|
apis('stm').addIsA( (child, parent) => {
|
|
291
293
|
return hierarchy.isA(child, parent)
|
|
292
294
|
})
|
|
@@ -1405,6 +1405,16 @@
|
|
|
1405
1405
|
"adjective",
|
|
1406
1406
|
false
|
|
1407
1407
|
],
|
|
1408
|
+
[
|
|
1409
|
+
"stm_current",
|
|
1410
|
+
"adjective",
|
|
1411
|
+
false
|
|
1412
|
+
],
|
|
1413
|
+
[
|
|
1414
|
+
"stm_previous",
|
|
1415
|
+
"adjective",
|
|
1416
|
+
false
|
|
1417
|
+
],
|
|
1408
1418
|
[
|
|
1409
1419
|
"that",
|
|
1410
1420
|
"thisitthat",
|
|
@@ -1666,7 +1676,7 @@
|
|
|
1666
1676
|
"dead": true,
|
|
1667
1677
|
"range": {
|
|
1668
1678
|
"start": 0,
|
|
1669
|
-
"end":
|
|
1679
|
+
"end": 2
|
|
1670
1680
|
},
|
|
1671
1681
|
"types": [
|
|
1672
1682
|
"self"
|
package/common/kirk.js
CHANGED
|
@@ -2,7 +2,7 @@ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const crew = require('./crew')
|
|
4
4
|
const kirk_tests = require('./kirk.test.json')
|
|
5
|
-
const
|
|
5
|
+
const instance = require('./kirk.instance.json')
|
|
6
6
|
|
|
7
7
|
const template = {
|
|
8
8
|
configs: [
|
|
@@ -14,7 +14,7 @@ const template = {
|
|
|
14
14
|
// TODO what is the name of you
|
|
15
15
|
// TODO crew members -> who are the crew members
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
instance.base = 'crew'
|
|
18
18
|
|
|
19
19
|
// config.load(template, kirk_instance)
|
|
20
20
|
knowledgeModule( {
|
|
@@ -30,8 +30,6 @@ knowledgeModule( {
|
|
|
30
30
|
context: [defaultContextCheck()],
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
instance: kirk_instance,
|
|
36
|
-
},
|
|
33
|
+
instance,
|
|
34
|
+
template,
|
|
37
35
|
})
|