ekms 8.0.0-beta.9 → 8.0.0-beta.91
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 +2915 -1553
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/asking.instance.json +2 -0
- package/common/asking.js +253 -0
- package/common/asking.test.json +2290 -0
- package/common/avatar.js +6 -10
- package/common/characters.js +23 -29
- package/common/colors.instance.json +7487 -4114
- package/common/colors.js +5 -9
- package/common/colors.test.json +345 -780
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +1196 -2
- package/common/concept.js +121 -119
- package/common/conjunction.instance.json +2 -0
- package/common/conjunction.js +104 -0
- package/common/conjunction.test.json +322 -0
- package/common/countable.js +20 -14
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +13553 -7026
- package/common/crew.js +37 -42
- package/common/crew.test.json +714 -452
- package/common/currency.js +28 -46
- package/common/dialogues.js +150 -426
- package/common/dialogues.test.json +0 -786
- package/common/dimension.instance.json +491 -262
- package/common/dimension.js +22 -24
- package/common/dimension.test.json +508 -1702
- package/common/edible.instance.json +20446 -10806
- package/common/edible.js +4 -9
- package/common/emotions.instance.json +192 -124
- package/common/emotions.js +36 -39
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +53 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +11 -15
- package/common/fastfood.instance.json +222642 -113618
- package/common/fastfood.js +76 -86
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +443 -247
- package/common/formulas.js +20 -27
- package/common/gdefaults.js +40 -27
- package/common/help.js +9 -14
- package/common/help.test.json +65 -16
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +5 -3
- package/common/helpers/properties.js +67 -64
- package/common/helpers.js +35 -24
- package/common/hierarchy.js +17 -25
- package/common/javascript.js +12 -19
- package/common/kirk.instance.json +583 -299
- package/common/kirk.js +6 -9
- package/common/length.instance.json +9005 -5001
- package/common/length.js +5 -9
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +406 -1178
- package/common/math.js +17 -21
- package/common/meta.js +24 -48
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.js +11 -7
- package/common/numbers.js +28 -32
- package/common/ordering.instance.json +443 -343
- package/common/ordering.js +81 -87
- package/common/ordinals.instance.json +2 -0
- package/common/ordinals.js +60 -0
- package/common/ordinals.test.json +306 -0
- package/common/people.instance.json +2210 -1150
- package/common/people.js +9 -14
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +53 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +11845 -6590
- package/common/pipboy.js +53 -62
- package/common/pipboy.test.json +2835 -0
- package/common/pokemon.instance.json +4300 -2285
- package/common/pokemon.js +8 -21
- package/common/pos.js +16 -14
- package/common/pressure.instance.json +2325 -1340
- package/common/pressure.js +5 -9
- package/common/properties.instance.json +148 -88
- package/common/properties.js +149 -160
- package/common/punctuation.js +16 -8
- package/common/reports.instance.json +1019 -551
- package/common/reports.js +77 -101
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +19 -31
- package/common/sdefaults.js +17 -8
- package/common/sizeable.js +7 -11
- package/common/spock.instance.json +582 -298
- package/common/spock.js +6 -9
- package/common/stgame.js +20 -20
- package/common/stm.js +173 -31
- package/common/stm.test.json +1734 -1
- package/common/tell.js +15 -19
- package/common/temperature.instance.json +2430 -1429
- package/common/temperature.js +5 -9
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +21 -26
- package/common/tokenize.js +6 -7
- package/common/ui.instance.json +150 -463
- package/common/ui.js +22 -33
- package/common/ui.test.json +641 -5357
- package/common/weight.instance.json +8034 -4503
- package/common/weight.js +5 -9
- package/common/yesno.js +6 -6
- package/main.js +20 -4
- package/package.json +37 -6
package/common/math.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const dialogues = require('./dialogues')
|
4
4
|
const numbers = require('./numbers')
|
@@ -33,22 +33,22 @@ const mathematicalOperator = (name, words, apply, before = []) => [
|
|
33
33
|
id: `${name}Operator`, level: 0,
|
34
34
|
bridge: `{ ...next(operator), marker: next(operator('${name}Expression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }` ,
|
35
35
|
// bridge: `{ ...next(operator), marker: next(operator('${name}Expression')), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }` ,
|
36
|
-
isA: ['
|
36
|
+
isA: ['mathematical_operator'],
|
37
37
|
before,
|
38
38
|
localHierarchy: [ ['unknown', 'number'] ],
|
39
39
|
// levelSpecificHierarchy: [[1, 'mathematicalExpression']],
|
40
40
|
words,
|
41
|
-
generatorp: ({
|
41
|
+
generatorp: ({context}) => context.word,
|
42
42
|
},
|
43
43
|
{
|
44
44
|
where: where(),
|
45
45
|
id: `${name}Expression`, level: 0,
|
46
46
|
bridge: "{ ...next(operator) }" ,
|
47
47
|
isA: ['mathematicalExpression'],
|
48
|
-
generatorp: ({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`,
|
49
|
-
evaluator: ({e, context}) => {
|
50
|
-
const x = toValue(e(context.x))
|
51
|
-
const y = toValue(e(context.y))
|
48
|
+
generatorp: async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`,
|
49
|
+
evaluator: async ({e, context}) => {
|
50
|
+
const x = toValue(await e(context.x))
|
51
|
+
const y = toValue(await e(context.y))
|
52
52
|
if (!x || !y) {
|
53
53
|
// context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
|
54
54
|
context.isResponse = false
|
@@ -69,11 +69,11 @@ const mathematicalOperator = (name, words, apply, before = []) => [
|
|
69
69
|
}
|
70
70
|
]
|
71
71
|
|
72
|
-
let
|
72
|
+
let config = {
|
73
73
|
name: 'math',
|
74
74
|
operators: [
|
75
75
|
"([mathematicalExpression])",
|
76
|
-
"([
|
76
|
+
"([mathematical_operator])",
|
77
77
|
"(([number|]) [plusOperator] ([number|]))",
|
78
78
|
"(([number|]) [minusOperator] ([number|]))",
|
79
79
|
"(([number|]) [timesOperator] ([number|]))",
|
@@ -92,8 +92,8 @@ let configStruct = {
|
|
92
92
|
isA: ['concept', 'number'],
|
93
93
|
},
|
94
94
|
{
|
95
|
-
id: "
|
96
|
-
before: ['
|
95
|
+
id: "mathematical_operator",
|
96
|
+
before: ['verb'],
|
97
97
|
after: ['adjective'],
|
98
98
|
},
|
99
99
|
{ id: "x", isA: ['number'], level: 0, bridge: '{ ...next(operator) }', development: true},
|
@@ -108,27 +108,23 @@ let configStruct = {
|
|
108
108
|
const template = {
|
109
109
|
configs: [
|
110
110
|
"mathematical modifies operator",
|
111
|
-
|
112
|
-
|
111
|
+
config,
|
112
|
+
// "* + / and - are mathematical operators",
|
113
113
|
]
|
114
114
|
}
|
115
115
|
|
116
|
-
const createConfig = () => {
|
117
|
-
const config = new Config({ name: 'math' }, module)
|
118
|
-
config.add(numbers(), dialogues(), punctuation(), countable(), comparable())
|
119
|
-
return config
|
120
|
-
}
|
121
|
-
|
122
116
|
knowledgeModule( {
|
117
|
+
config: { name: 'math' },
|
118
|
+
includes: [numbers, dialogues, punctuation, countable, comparable],
|
119
|
+
|
123
120
|
module,
|
124
|
-
createConfig,
|
125
121
|
description: 'talking about math',
|
126
122
|
template: { template, instance },
|
127
123
|
test: {
|
128
124
|
name: './math.test.json',
|
129
125
|
contents: tests,
|
130
126
|
checks: {
|
131
|
-
context: defaultContextCheck,
|
127
|
+
context: defaultContextCheck(),
|
132
128
|
},
|
133
129
|
|
134
130
|
},
|
package/common/meta.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const _ = require('lodash')
|
4
4
|
const gdefaults = require('./gdefaults.js')
|
@@ -17,7 +17,7 @@ const template = {
|
|
17
17
|
};
|
18
18
|
|
19
19
|
// TODO -> if a car's top speed is over 200 mph then the car is fast
|
20
|
-
let
|
20
|
+
let config = {
|
21
21
|
name: 'meta',
|
22
22
|
operators: [
|
23
23
|
"((phrase) [means] (phrase))",
|
@@ -130,8 +130,8 @@ let configStruct = {
|
|
130
130
|
{
|
131
131
|
where: where(),
|
132
132
|
match: ({context}) => context.marker == 'orList' && context.paraphrase,
|
133
|
-
apply: ({context, gs}) => {
|
134
|
-
return gs(context.value, ', ', ' or ')
|
133
|
+
apply: async ({context, gs}) => {
|
134
|
+
return await gs(context.value, ', ', ' or ')
|
135
135
|
},
|
136
136
|
priority: -1,
|
137
137
|
},
|
@@ -139,10 +139,8 @@ let configStruct = {
|
|
139
139
|
priority: -1,
|
140
140
|
where: where(),
|
141
141
|
match: ({context}) => context.marker == 'means' && context.paraphrase,
|
142
|
-
apply: ({context, g}) => {
|
143
|
-
|
144
|
-
const before = g({ ...context.from, paraphrase: true})
|
145
|
-
return `${g({ ...context.from, paraphrase: true})} means ${g(context.to)}`
|
142
|
+
apply: async ({context, g}) => {
|
143
|
+
return `${await g({ ...context.from, paraphrase: true})} means ${await g(context.to)}`
|
146
144
|
}
|
147
145
|
},
|
148
146
|
{
|
@@ -160,8 +158,8 @@ let configStruct = {
|
|
160
158
|
{
|
161
159
|
where: where(),
|
162
160
|
match: ({context}) => context.marker === 'if',
|
163
|
-
apply: ({context, g}) => {
|
164
|
-
return `if ${g(context.antecedant)} then ${g(context.consequence)}`
|
161
|
+
apply: async ({context, g}) => {
|
162
|
+
return `if ${await g(context.antecedant)} then ${await g(context.consequence)}`
|
165
163
|
},
|
166
164
|
priority: -1,
|
167
165
|
},
|
@@ -182,10 +180,10 @@ let configStruct = {
|
|
182
180
|
{
|
183
181
|
where: where(),
|
184
182
|
match: ({context}) => context.marker == 'orList',
|
185
|
-
apply: ({context, s}) => {
|
183
|
+
apply: async ({context, s}) => {
|
186
184
|
const response = []
|
187
185
|
for (const value of context.value) {
|
188
|
-
response.push(s(value))
|
186
|
+
response.push(await s(value))
|
189
187
|
}
|
190
188
|
context.evalue = {
|
191
189
|
marker: 'orList',
|
@@ -205,7 +203,7 @@ let configStruct = {
|
|
205
203
|
const apply = (DEFINITIONs, DERIVED) => {
|
206
204
|
const mappingss = translationMappings(DEFINITIONs, DERIVED)
|
207
205
|
const invertMappings = (mappings) => mappings.map( ({ from, to }) => { return { to: from, from: to } } )
|
208
|
-
return ({context, s,
|
206
|
+
return async ({context, s, config}) => {
|
209
207
|
DEFINITIONs = _.cloneDeep(DEFINITIONs)
|
210
208
|
//const mappings = mappingss[0]
|
211
209
|
let toPrimes = []
|
@@ -215,8 +213,7 @@ let configStruct = {
|
|
215
213
|
}
|
216
214
|
// next move add debug arg to s and g
|
217
215
|
TO.query = true
|
218
|
-
toPrimes.push([s(TO), mappings])
|
219
|
-
// toPrime = s(TO, { debug: { apply: true } })
|
216
|
+
toPrimes.push([await s(TO), mappings])
|
220
217
|
}
|
221
218
|
|
222
219
|
let hasResponse = false
|
@@ -271,7 +268,7 @@ let configStruct = {
|
|
271
268
|
// match: match(context),
|
272
269
|
where: where(),
|
273
270
|
match: match(context),
|
274
|
-
apply: apply(antecedants, _.cloneDeep(context.consequence))
|
271
|
+
apply: apply(antecedants, _.cloneDeep(context.consequence)),
|
275
272
|
}
|
276
273
|
config.addSemantic(semantic)
|
277
274
|
}
|
@@ -280,17 +277,14 @@ let configStruct = {
|
|
280
277
|
notes: 'from means to where from is unknown',
|
281
278
|
where: where(),
|
282
279
|
match: ({context}) => context.marker == 'means' && context.from.marker == 'unknown',
|
283
|
-
apply: ({config, context, kms, e, isTest}) => {
|
280
|
+
apply: async ({config, context, kms, e, isTest}) => {
|
284
281
|
if (false && isTest) {
|
285
282
|
return
|
286
283
|
} else if (kms.dialogues) {
|
287
284
|
if (context.to.value) {
|
288
285
|
kms.stm.api.setVariable(context.from.value, context.to.value)
|
289
286
|
} else {
|
290
|
-
// config.addWord(context.from.word,
|
291
287
|
kms.dialogues.api.makeObject({ context: context.from, types: context.to.types || [], config });
|
292
|
-
// kms.dialogues.api.makeObject({ context: context.from, types: [], config });
|
293
|
-
// const r = e(context.to)
|
294
288
|
kms.stm.api.setVariable(context.from.value, context.to)
|
295
289
|
}
|
296
290
|
}
|
@@ -300,17 +294,17 @@ let configStruct = {
|
|
300
294
|
notes: 'x means y where x and y have known markers',
|
301
295
|
where: where(),
|
302
296
|
match: ({context}) => context.marker == 'means',
|
303
|
-
apply: ({config, context, g}) => {
|
297
|
+
apply: async ({config, context, g}) => {
|
304
298
|
// setup the write semantic
|
305
299
|
{
|
306
300
|
const matchByMarker = (defContext) => ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
|
307
301
|
const matchByValue = (defContext) => ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
|
308
|
-
const apply = (mappings, TO) => ({context, s}) => {
|
302
|
+
const apply = (mappings, TO) => async ({context, s}) => {
|
309
303
|
TO = _.cloneDeep(TO)
|
310
304
|
for (let { from, to } of mappings) {
|
311
305
|
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
312
306
|
}
|
313
|
-
toPrime = s(TO)
|
307
|
+
toPrime = await s(TO)
|
314
308
|
context.result = toPrime.result
|
315
309
|
}
|
316
310
|
const mappings = translationMapping(context.from, context.to)
|
@@ -332,7 +326,7 @@ let configStruct = {
|
|
332
326
|
{
|
333
327
|
const matchByMarker = (defContext) => ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
|
334
328
|
const matchByValue = (defContext) => ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
|
335
|
-
const apply = (mappings, TO) => ({uuid, context, s, g, config}) => {
|
329
|
+
const apply = (mappings, TO) => async ({uuid, context, s, g, config}) => {
|
336
330
|
TO = _.cloneDeep(TO)
|
337
331
|
for (let { from, to } of mappings) {
|
338
332
|
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
@@ -345,8 +339,7 @@ let configStruct = {
|
|
345
339
|
TO.evaluate = context.evaluate
|
346
340
|
}
|
347
341
|
TO[`disable${uuid}`] = true
|
348
|
-
|
349
|
-
toPrime = s(TO)
|
342
|
+
toPrime = await s(TO)
|
350
343
|
if (context.query) {
|
351
344
|
if (toPrime.evalue) {
|
352
345
|
context.evalue = toPrime.evalue
|
@@ -359,7 +352,7 @@ let configStruct = {
|
|
359
352
|
}
|
360
353
|
const mappings = translationMapping(context.from, context.to)
|
361
354
|
let match = matchByMarker(context)
|
362
|
-
context.metaInfo = `The mapping from from the expression being defined "${g({...context.from, paraphrase: true})}" to the definition phrase "${g({...context.to, paraphrase: true})}" is ${JSON.stringify(mappings)}`
|
355
|
+
context.metaInfo = `The mapping from from the expression being defined "${await g({...context.from, paraphrase: true})}" to the definition phrase "${await g({...context.to, paraphrase: true})}" is ${JSON.stringify(mappings)}`
|
363
356
|
if (context.from.value) {
|
364
357
|
match = matchByValue(context)
|
365
358
|
}
|
@@ -378,29 +371,12 @@ let configStruct = {
|
|
378
371
|
],
|
379
372
|
};
|
380
373
|
|
381
|
-
const createConfig = () => {
|
382
|
-
const config = new Config(configStruct, module)
|
383
|
-
config.stop_auto_rebuild()
|
384
|
-
config.add(gdefaults())
|
385
|
-
|
386
|
-
config.initializer( ({config, addGenerator, isModule}) => {
|
387
|
-
if (!isModule) {
|
388
|
-
addGenerator({
|
389
|
-
where: where(),
|
390
|
-
match: ({context}) => context.marker == 'unknown',
|
391
|
-
apply: ({context}) => `${context.word}`
|
392
|
-
})
|
393
|
-
}
|
394
|
-
})
|
395
|
-
|
396
|
-
config.restart_auto_rebuild()
|
397
|
-
return config
|
398
|
-
}
|
399
|
-
|
400
374
|
knowledgeModule({
|
375
|
+
config,
|
376
|
+
includes: [gdefaults],
|
377
|
+
|
401
378
|
module,
|
402
379
|
description: 'Ways of defining new language elements',
|
403
|
-
createConfig,
|
404
380
|
test: {
|
405
381
|
name: './meta.test.json',
|
406
382
|
contents: meta_tests,
|
@@ -408,7 +384,7 @@ knowledgeModule({
|
|
408
384
|
words: true,
|
409
385
|
},
|
410
386
|
checks: {
|
411
|
-
context: defaultContextCheck,
|
387
|
+
context: defaultContextCheck(),
|
412
388
|
},
|
413
389
|
|
414
390
|
},
|
@@ -0,0 +1,144 @@
|
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
|
+
const { defaultContextCheck } = require('./helpers')
|
3
|
+
const helpers = require('./helpers')
|
4
|
+
const stm = require('./stm')
|
5
|
+
const nameable_tests = require('./nameable.test.json')
|
6
|
+
|
7
|
+
// TODO but "remember the m1\n call the m1 banana" <- the on the first one
|
8
|
+
|
9
|
+
class API {
|
10
|
+
initialize({ objects, km, kms }) {
|
11
|
+
this.objects = objects
|
12
|
+
this.objects.named = {}
|
13
|
+
}
|
14
|
+
|
15
|
+
// report is a context
|
16
|
+
setName(context, name) {
|
17
|
+
if (!context.stm) {
|
18
|
+
context.stm = {}
|
19
|
+
}
|
20
|
+
if (!context.stm.names) {
|
21
|
+
context.stm.names = []
|
22
|
+
}
|
23
|
+
context.stm.names.push(name)
|
24
|
+
}
|
25
|
+
|
26
|
+
get(type, name) {
|
27
|
+
return this.args.kms.stm.api.mentions({
|
28
|
+
context: type,
|
29
|
+
condition: (context) => {
|
30
|
+
if (context.stm && context.stm.names) {
|
31
|
+
return context.stm.names.includes(name)
|
32
|
+
}
|
33
|
+
}
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
getNamesByType(type) {
|
38
|
+
const contexts = this.args.kms.stm.api.getByType(type)
|
39
|
+
const names = new Set()
|
40
|
+
for (const context of contexts) {
|
41
|
+
if (context.stm.names) {
|
42
|
+
for (const name of context.stm.names) {
|
43
|
+
names.add(name)
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return [...names]
|
48
|
+
}
|
49
|
+
|
50
|
+
getNames(nameable) {
|
51
|
+
return (nameable.stm && nameable.stm.names) || []
|
52
|
+
}
|
53
|
+
|
54
|
+
/*
|
55
|
+
getNames() {
|
56
|
+
const current = this.current()
|
57
|
+
console.log('getReportNames current', JSON.stringify(current, null, 2))
|
58
|
+
return Object.keys(this.objects.namedReports).map( (name) => {
|
59
|
+
const selected = (current.names || []).includes(name)
|
60
|
+
return { name, selected, id: name }
|
61
|
+
})
|
62
|
+
}
|
63
|
+
*/
|
64
|
+
|
65
|
+
setCurrent(name) {
|
66
|
+
const context = this.objects.named[name]
|
67
|
+
if (context) {
|
68
|
+
this.args.km('stm').api.mentioned({ context })
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
const api = new API()
|
74
|
+
|
75
|
+
const config = {
|
76
|
+
name: 'nameable',
|
77
|
+
operators: [
|
78
|
+
// "([call] ([nameable]) (name))",
|
79
|
+
"([call] ([nameable]) (!@<=endOfSentence)*)",
|
80
|
+
{ pattern: "([getNamesByType] (type))", development: true },
|
81
|
+
{ pattern: "([m1])", development: true },
|
82
|
+
// { pattern: "([testPullFromContext] ([memorable]))", development: true }
|
83
|
+
],
|
84
|
+
words: {
|
85
|
+
literals: {
|
86
|
+
// "m1": [{"id": "memorable", development: true, "initial": "{ value: 'm1' }" }],
|
87
|
+
// "m2": [{"id": "memorable", development: true, "initial": "{ value: 'm2' }" }],
|
88
|
+
},
|
89
|
+
},
|
90
|
+
bridges: [
|
91
|
+
{
|
92
|
+
id: 'm1',
|
93
|
+
isA: ['memorable', 'nameable'],
|
94
|
+
development: true,
|
95
|
+
},
|
96
|
+
{
|
97
|
+
id: 'getNamesByType',
|
98
|
+
development: true,
|
99
|
+
isA: ['verb'],
|
100
|
+
bridge: "{ ...next(operator), type: after[0] }",
|
101
|
+
semantic: async ({context, api}) => {
|
102
|
+
context.response = api.getNamesByType(context.type.value).join(" ")
|
103
|
+
context.isResponse = true
|
104
|
+
}
|
105
|
+
},
|
106
|
+
{
|
107
|
+
id: 'call',
|
108
|
+
isA: ['verb'],
|
109
|
+
bridge: "{ ...next(operator), nameable: after[0], name: after[1:] }",
|
110
|
+
// bridge: "{ ...next(operator), nameable: after[0], name: after[1] }",
|
111
|
+
// generatorp: async ({context, g}) => `call ${await g(context.nameable)} ${await g(context.name)}`,
|
112
|
+
generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
|
113
|
+
semantic: async ({config, context, api, e}) => {
|
114
|
+
// TODO find report being referred to
|
115
|
+
const nameable = (await e(context.nameable)).evalue
|
116
|
+
const name = context.name.map((n) => n.text).join(' ')
|
117
|
+
// const name = context.name.text
|
118
|
+
config.addWord(name, { id: nameable.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
|
119
|
+
api.setName(nameable, name)
|
120
|
+
}
|
121
|
+
},
|
122
|
+
{ id: 'nameable', words: helpers.words('nameable')},
|
123
|
+
]
|
124
|
+
}
|
125
|
+
|
126
|
+
knowledgeModule( {
|
127
|
+
config,
|
128
|
+
api: () => new API(),
|
129
|
+
includes: [stm],
|
130
|
+
|
131
|
+
module,
|
132
|
+
description: 'namable objects',
|
133
|
+
test: {
|
134
|
+
name: './nameable.test.json',
|
135
|
+
contents: nameable_tests,
|
136
|
+
checks: {
|
137
|
+
context: [...defaultContextCheck(), 'pullFromContext'],
|
138
|
+
objects: ['mentioned', { km: 'stm' }],
|
139
|
+
},
|
140
|
+
include: {
|
141
|
+
words: [ "peter james chunkington", "banana" ],
|
142
|
+
}
|
143
|
+
},
|
144
|
+
})
|