ekms 8.0.0-beta.21 → 8.0.0-beta.22
Sign up to get free protection for your applications and to get access to all the features.
- package/common/colors.instance.json +0 -28
- package/common/comparable.js +0 -13
- package/common/concept.js +9 -5
- package/common/countable.js +3 -3
- package/common/crew.js +1 -1
- package/common/currency.js +3 -3
- package/common/dialogues.js +48 -117
- package/common/dimension.instance.json +4 -4
- package/common/dimension.js +8 -8
- package/common/dimension.test.json +242 -1248
- package/common/edible.instance.json +30 -58
- package/common/emotions.js +1 -1
- package/common/events.js +3 -3
- package/common/fastfood.instance.json +873 -1072
- package/common/fastfood.js +20 -20
- package/common/formulas.instance.json +6 -6
- package/common/formulas.js +8 -8
- package/common/gdefaults.js +11 -11
- package/common/help.js +1 -1
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +48 -58
- package/common/hierarchy.js +9 -13
- package/common/javascript.js +5 -5
- package/common/math.instance.json +12 -12
- package/common/math.js +5 -5
- package/common/meta.js +19 -26
- package/common/ordering.js +1 -1
- package/common/people.js +1 -2
- package/common/percentages.js +2 -2
- package/common/pipboy.instance.json +30 -86
- package/common/pipboy.js +25 -28
- package/common/pokemon.js +1 -1
- package/common/properties.js +48 -121
- package/common/punctuation.js +1 -1
- package/common/reports.instance.json +1 -1
- package/common/reports.js +48 -65
- package/common/scorekeeper.js +10 -18
- package/common/sdefaults.js +4 -4
- package/common/stm.js +1 -1
- package/common/tell.js +6 -6
- package/common/temperature.instance.json +0 -84
- package/common/testing.js +3 -3
- package/common/time.js +3 -3
- package/common/ui.js +5 -5
- package/package.json +2 -2
package/common/hierarchy.js
CHANGED
@@ -61,7 +61,7 @@ let configStruct = {
|
|
61
61
|
notes: 'what type is pikachu',
|
62
62
|
where: where(),
|
63
63
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.query && !['what'].includes(context.one.marker) && !['what'].includes(context.two.marker) && (context.one.query || context.two.query),
|
64
|
-
apply: ({context, hierarchy, km, log, e
|
64
|
+
apply: async ({context, hierarchy, km, log, e}) => {
|
65
65
|
const one = context.one;
|
66
66
|
const two = context.two;
|
67
67
|
let concept, value;
|
@@ -72,7 +72,7 @@ let configStruct = {
|
|
72
72
|
concept = two;
|
73
73
|
value = one;
|
74
74
|
}
|
75
|
-
let instance = e(value)
|
75
|
+
let instance = await e(value)
|
76
76
|
if (instance.verbatim) {
|
77
77
|
context.evalue = { verbatim: instance.verbatim }
|
78
78
|
context.isResponse = true
|
@@ -80,9 +80,6 @@ let configStruct = {
|
|
80
80
|
}
|
81
81
|
instance = getTypes(km, concept, instance)
|
82
82
|
|
83
|
-
// instance.focusable = ['one', 'two']
|
84
|
-
// concept = JSON.parse(JSON.stringify(value))
|
85
|
-
// greg
|
86
83
|
concept = _.cloneDeep(value)
|
87
84
|
concept.isQuery = undefined
|
88
85
|
|
@@ -106,10 +103,10 @@ let configStruct = {
|
|
106
103
|
notes: 'type of pikachu', // the types of type is the next one
|
107
104
|
where: where(),
|
108
105
|
match: ({context}) => context.marker == 'type' && context.evaluate && context.object && context.objects[context.objects.length-1].number == 'one' && pluralize.isSingular(context.objects[0].word),
|
109
|
-
apply: ({context, objects, e, gs, km, log
|
106
|
+
apply: async ({context, objects, e, gs, km, log}) => {
|
110
107
|
const concept = context.objects[0];
|
111
108
|
const value = context.objects[1];
|
112
|
-
let instance = e(value)
|
109
|
+
let instance = await e(value)
|
113
110
|
if (instance.verbatim) {
|
114
111
|
context.evalue = { verbatim: instance.verbatim }
|
115
112
|
return
|
@@ -135,14 +132,14 @@ let configStruct = {
|
|
135
132
|
}
|
136
133
|
return hierarchy.isA(context.marker, 'is') && context.query && args( { types: ['hierarchyAble', 'hierarchyAble'], properties: ['one', 'two'] } )
|
137
134
|
},
|
138
|
-
apply: ({context, km, objects, g}) => {
|
135
|
+
apply: async ({context, km, objects, g}) => {
|
139
136
|
const api = km('properties').api
|
140
137
|
const one = context.one
|
141
138
|
const two = context.two
|
142
139
|
const oneId = pluralize.singular(one.value);
|
143
140
|
if (!api.conceptExists(oneId)) {
|
144
141
|
context.evalue = {
|
145
|
-
verbatim: `I don't know about ${g({ ...one, paraphrase: true})}`
|
142
|
+
verbatim: `I don't know about ${await g({ ...one, paraphrase: true})}`
|
146
143
|
}
|
147
144
|
context.isResponse = true
|
148
145
|
return
|
@@ -150,7 +147,7 @@ let configStruct = {
|
|
150
147
|
const twoId = pluralize.singular(two.value);
|
151
148
|
if (!api.conceptExists(twoId)) {
|
152
149
|
context.evalue = {
|
153
|
-
verbatim: `I don't know about ${g({ ...two, paraphrase: true})}`
|
150
|
+
verbatim: `I don't know about ${await g({ ...two, paraphrase: true})}`
|
154
151
|
}
|
155
152
|
context.isResponse = true
|
156
153
|
return
|
@@ -201,7 +198,6 @@ let configStruct = {
|
|
201
198
|
},
|
202
199
|
{
|
203
200
|
notes: 'humans are mammels',
|
204
|
-
// match: ({context, listable}) => listable(context, 'unknown') && context.same,
|
205
201
|
where: where(),
|
206
202
|
match: ({context, listable, hierarchy, isA, callId}) => {
|
207
203
|
if (!context.same) {
|
@@ -270,7 +266,7 @@ let configStruct = {
|
|
270
266
|
notes: 'types of type', // what are the types of animals
|
271
267
|
where: where(),
|
272
268
|
match: ({context}) => context.marker == 'type' && context.evaluate && context.object,
|
273
|
-
apply: ({context, objects,
|
269
|
+
apply: ({context, objects, km, isA}) => {
|
274
270
|
const api = km('properties').api
|
275
271
|
const conceptApi = km('concept').api
|
276
272
|
const type = pluralize.singular(context.object.value);
|
@@ -292,7 +288,7 @@ const createConfig = async () => {
|
|
292
288
|
const config = new Config(configStruct, module)
|
293
289
|
config.stop_auto_rebuild()
|
294
290
|
await config.add(properties)
|
295
|
-
config.initializer( ({apis, hierarchy}) => {
|
291
|
+
await config.initializer( ({apis, hierarchy}) => {
|
296
292
|
apis('stm').addIsA( (child, parent) => {
|
297
293
|
return hierarchy.isA(child, parent)
|
298
294
|
})
|
package/common/javascript.js
CHANGED
@@ -36,14 +36,14 @@ let configStruct = {
|
|
36
36
|
{
|
37
37
|
where: where(),
|
38
38
|
match: ({context}) => context.marker == 'assignment' && context.paraphrase,
|
39
|
-
apply: ({context, g}) => `let ${g(context.variable)} = ${g(context.value)}`
|
39
|
+
apply: async ({context, g}) => `let ${await g(context.variable)} = ${await g(context.value)}`
|
40
40
|
},
|
41
41
|
{
|
42
42
|
where: where(),
|
43
43
|
match: ({context}) => context.marker == 'assignment' && context.isResponse,
|
44
|
-
apply: ({context, g}) => {
|
45
|
-
const value = g(context.variable)
|
46
|
-
return `${g(context.variable)} == ${g(context.value)}`
|
44
|
+
apply: async ({context, g}) => {
|
45
|
+
// const value = await g(context.variable)
|
46
|
+
return `${await g(context.variable)} == ${await g(context.value)}`
|
47
47
|
}
|
48
48
|
},
|
49
49
|
],
|
@@ -65,7 +65,7 @@ const createConfig = async () => {
|
|
65
65
|
config.stop_auto_rebuild()
|
66
66
|
await config.add(dialogues)
|
67
67
|
|
68
|
-
config.initializer( ({objects, uuid}) => {
|
68
|
+
await config.initializer( ({objects, uuid}) => {
|
69
69
|
objects.variables = {}
|
70
70
|
})
|
71
71
|
await config.restart_auto_rebuild()
|
@@ -77,7 +77,7 @@
|
|
77
77
|
"plus",
|
78
78
|
"+"
|
79
79
|
],
|
80
|
-
"generatorp": "({
|
80
|
+
"generatorp": "({context}) => context.word"
|
81
81
|
},
|
82
82
|
{
|
83
83
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
|
@@ -87,8 +87,8 @@
|
|
87
87
|
"isA": [
|
88
88
|
"mathematicalExpression"
|
89
89
|
],
|
90
|
-
"generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
|
91
|
-
"evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
90
|
+
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
91
|
+
"evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
92
92
|
},
|
93
93
|
{
|
94
94
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
|
@@ -109,7 +109,7 @@
|
|
109
109
|
"minus",
|
110
110
|
"-"
|
111
111
|
],
|
112
|
-
"generatorp": "({
|
112
|
+
"generatorp": "({context}) => context.word"
|
113
113
|
},
|
114
114
|
{
|
115
115
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
|
@@ -119,8 +119,8 @@
|
|
119
119
|
"isA": [
|
120
120
|
"mathematicalExpression"
|
121
121
|
],
|
122
|
-
"generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
|
123
|
-
"evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
122
|
+
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
123
|
+
"evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
124
124
|
},
|
125
125
|
{
|
126
126
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
|
@@ -150,7 +150,7 @@
|
|
150
150
|
"times",
|
151
151
|
"*"
|
152
152
|
],
|
153
|
-
"generatorp": "({
|
153
|
+
"generatorp": "({context}) => context.word"
|
154
154
|
},
|
155
155
|
{
|
156
156
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
|
@@ -160,8 +160,8 @@
|
|
160
160
|
"isA": [
|
161
161
|
"mathematicalExpression"
|
162
162
|
],
|
163
|
-
"generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
|
164
|
-
"evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
163
|
+
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
164
|
+
"evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
165
165
|
},
|
166
166
|
{
|
167
167
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
|
@@ -190,7 +190,7 @@
|
|
190
190
|
"words": [
|
191
191
|
"/"
|
192
192
|
],
|
193
|
-
"generatorp": "({
|
193
|
+
"generatorp": "({context}) => context.word"
|
194
194
|
},
|
195
195
|
{
|
196
196
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
|
@@ -200,8 +200,8 @@
|
|
200
200
|
"isA": [
|
201
201
|
"mathematicalExpression"
|
202
202
|
],
|
203
|
-
"generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
|
204
|
-
"evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
203
|
+
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
204
|
+
"evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
|
205
205
|
}
|
206
206
|
]
|
207
207
|
}
|
package/common/math.js
CHANGED
@@ -38,17 +38,17 @@ const mathematicalOperator = (name, words, apply, 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
|
package/common/meta.js
CHANGED
@@ -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
|
}
|
@@ -383,7 +376,7 @@ const createConfig = async () => {
|
|
383
376
|
config.stop_auto_rebuild()
|
384
377
|
await config.add(gdefaults)
|
385
378
|
|
386
|
-
config.initializer( ({config, addGenerator, isModule}) => {
|
379
|
+
await config.initializer( ({config, addGenerator, isModule}) => {
|
387
380
|
if (!isModule) {
|
388
381
|
addGenerator({
|
389
382
|
where: where(),
|
package/common/ordering.js
CHANGED
@@ -39,7 +39,7 @@ const createConfig = async () => {
|
|
39
39
|
await config.add(hierarchy)
|
40
40
|
// config.load(template, ordering_instance)
|
41
41
|
|
42
|
-
config.initializer(({config, km}) => {
|
42
|
+
await config.initializer(({config, km}) => {
|
43
43
|
const oapi = km('ordering').api
|
44
44
|
oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
|
45
45
|
const papi = km('properties').api
|
package/common/people.js
CHANGED
@@ -49,7 +49,7 @@ const createConfig = async () => {
|
|
49
49
|
const config = new Config(configStruct, module)
|
50
50
|
config.stop_auto_rebuild()
|
51
51
|
await config.add(hierarchy)
|
52
|
-
config.initializer( ({baseConfig, context, apis, isModule}) => {
|
52
|
+
await config.initializer( ({baseConfig, context, apis, isModule}) => {
|
53
53
|
// const api = km('properties').api
|
54
54
|
const api = apis('properties')
|
55
55
|
// setup paraphrase
|
@@ -65,7 +65,6 @@ const createConfig = async () => {
|
|
65
65
|
edAble: { operator: 'owned', word: 'owned' },
|
66
66
|
config: baseConfig
|
67
67
|
})
|
68
|
-
|
69
68
|
})
|
70
69
|
await config.restart_auto_rebuild()
|
71
70
|
return config
|
package/common/percentages.js
CHANGED
@@ -20,9 +20,9 @@ let configStruct = {
|
|
20
20
|
id: "percentageOf",
|
21
21
|
words: ['percent', '%'],
|
22
22
|
bridge: "{ ...next(operator), percentage: before[0], isResponse: true, semanticIsEvaluate: true, value: after[0] }",
|
23
|
-
evaluator: ({context, e}) => {
|
23
|
+
evaluator: async ({context, e}) => {
|
24
24
|
const scale = context.percentage.scale
|
25
|
-
const number = e(context.value)
|
25
|
+
const number = await e(context.value)
|
26
26
|
const percentage = number.value * scale.value / 100
|
27
27
|
const result = { ...number, value: percentage, word: null, text: null }
|
28
28
|
context.evalue = result
|