ekms 9.8.0 → 9.9.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/actions.instance.json +12 -10
- package/common/actions.js +14 -12
- package/common/angle.instance.json +37 -17
- package/common/animals.instance.json +54 -28
- package/common/askfor.instance.json +89 -192
- package/common/askfor.js +49 -12
- package/common/asking.js +13 -5
- package/common/avatar.js +3 -3
- package/common/can.instance.json +32 -20
- package/common/can.js +2 -2
- package/common/colors.instance.json +44 -16
- package/common/colors.js +1 -1
- package/common/comparable.instance.json +25 -22
- package/common/compass.instance.json +9 -3
- package/common/compass.js +1 -1
- package/common/concept.instance.json +14 -6
- package/common/concept.js +2 -0
- package/common/conjunction.js +20 -12
- package/common/control.js +10 -18
- package/common/countable.js +4 -3
- package/common/crew.instance.json +95 -27
- package/common/dateTimeSelectors.instance.json +4 -4
- package/common/dateTimeSelectors.js +4 -7
- package/common/dates.instance.json +52 -28
- package/common/dates.js +16 -11
- package/common/debug.instance.json +52 -0
- package/common/debug.js +52 -0
- package/common/debug.test.json +1 -0
- package/common/dialogues.js +126 -70
- package/common/dimension.instance.json +259 -492
- package/common/dimension.js +72 -12
- package/common/drone.instance.json +441 -84
- package/common/drone.js +57 -56
- package/common/drone_v1.instance.json +36 -12
- package/common/drone_v1.js +20 -15
- package/common/edible.instance.json +96 -32
- package/common/emotions.instance.json +15 -1
- package/common/evaluate.js +10 -13
- package/common/fastfood.instance.json +282 -100
- package/common/fastfood.js +30 -15
- package/common/formulas.instance.json +162 -24
- package/common/formulas.js +18 -9
- package/common/gdefaults.js +20 -96
- package/common/helpers/concept.js +2 -9
- package/common/helpers/conjunction.js +11 -1
- package/common/helpers/dialogues.js +48 -24
- package/common/helpers/gdefaults.js +15 -5
- package/common/helpers/properties.js +132 -326
- package/common/helpers.js +28 -58
- package/common/hierarchy.js +71 -41
- package/common/kirk.instance.json +3 -1
- package/common/latin.instance.json +14 -14
- package/common/latin.js +7 -7
- package/common/length.instance.json +331 -61
- package/common/linear_orderings.instance.json +1 -0
- package/common/linear_orderings.js +90 -0
- package/common/linear_orderings.test.json +1 -0
- package/common/math.instance.json +144 -5
- package/common/math.js +18 -7
- package/common/menus.instance.json +29 -11
- package/common/menus.js +8 -5
- package/common/meta.js +14 -13
- package/common/nameable.js +9 -5
- package/common/numbers.instance.json +8 -3
- package/common/numbers.js +59 -35
- package/common/ordering.instance.json +53 -4
- package/common/ordinals.js +25 -25
- package/common/people.instance.json +66 -12
- package/common/percentages.js +4 -2
- package/common/pipboy.instance.json +89 -44
- package/common/pipboy.js +21 -14
- package/common/pokemon.instance.json +39 -13
- package/common/pressure.instance.json +20 -6
- package/common/properties.instance.json +2648 -501
- package/common/properties.js +561 -82
- package/common/punctuation.js +1 -0
- package/common/rates.instance.json +2 -2
- package/common/rates.js +3 -3
- package/common/reminders.instance.json +16 -0
- package/common/reminders.js +24 -20
- package/common/reports.instance.json +11 -12
- package/common/reports.js +12 -12
- package/common/scorekeeper.js +20 -10
- package/common/sdefaults.js +30 -9
- package/common/spock.instance.json +3 -1
- package/common/stm.js +16 -21
- package/common/temperature.instance.json +40 -11
- package/common/testing.js +2 -2
- package/common/time.instance.json +149 -47
- package/common/time.js +9 -8
- package/common/ui.instance.json +4 -2
- package/common/ui.js +5 -5
- package/common/weight.instance.json +113 -21
- package/common/weight.js +5 -1
- package/common/words.js +113 -2
- package/common/wp.instance.json +125 -18
- package/common/wp.js +6 -2
- package/main.js +2 -0
- package/package.json +10 -3
package/common/dimension.js
CHANGED
|
@@ -79,6 +79,7 @@ class API {
|
|
|
79
79
|
config.addOperator(`([${dimension}])`)
|
|
80
80
|
config.addBridge({
|
|
81
81
|
id: dimension,
|
|
82
|
+
where: where(),
|
|
82
83
|
isA: ['dimension'],
|
|
83
84
|
generatorp: async ({context, g}) => context.amount ? `${await g(context.amount)} ${await g(context.unit)}` : context.word,
|
|
84
85
|
})
|
|
@@ -98,7 +99,7 @@ class API {
|
|
|
98
99
|
let evalue;
|
|
99
100
|
let efrom = from
|
|
100
101
|
if (!from.unit) {
|
|
101
|
-
efrom = (await e(from)).evalue
|
|
102
|
+
efrom = (await e(from, where())).evalue
|
|
102
103
|
}
|
|
103
104
|
async function convert(to) {
|
|
104
105
|
if (to.value == efrom.unit.value) {
|
|
@@ -112,7 +113,7 @@ class API {
|
|
|
112
113
|
error(reason)
|
|
113
114
|
}
|
|
114
115
|
kms.stm.api.setVariable(efrom.unit.value, efrom.amount)
|
|
115
|
-
evalue = await e(formula)
|
|
116
|
+
evalue = await e(formula, where())
|
|
116
117
|
}
|
|
117
118
|
return evalue
|
|
118
119
|
}
|
|
@@ -147,7 +148,7 @@ class API {
|
|
|
147
148
|
marker: 'quantity',
|
|
148
149
|
level: 1,
|
|
149
150
|
unit: evalue.to,
|
|
150
|
-
amount:
|
|
151
|
+
amount: evalue.value,
|
|
151
152
|
}
|
|
152
153
|
})
|
|
153
154
|
if (evalues.length > 1) {
|
|
@@ -201,14 +202,15 @@ const config = {
|
|
|
201
202
|
id: "preferredUnits",
|
|
202
203
|
isA: ['verb'],
|
|
203
204
|
bridge: "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
|
|
204
|
-
|
|
205
|
+
check: defaultContextCheckProperties(['quantity']),
|
|
206
|
+
semantic: async ({context, e, api, toArray, resolveEvaluate}) => {
|
|
205
207
|
const preferredUnits = await api.getPreferredUnits(context.quantity)
|
|
206
208
|
if (!preferredUnits) {
|
|
207
209
|
return
|
|
208
210
|
}
|
|
209
211
|
const from = context.quantity;
|
|
210
|
-
const value = await e({ marker: 'convertToUnits', from, to: preferredUnits })
|
|
211
|
-
|
|
212
|
+
const value = await e({ marker: 'convertToUnits', from, to: preferredUnits }, where())
|
|
213
|
+
resolveEvaluate(context, value.evalue)
|
|
212
214
|
}
|
|
213
215
|
},
|
|
214
216
|
{
|
|
@@ -216,6 +218,7 @@ const config = {
|
|
|
216
218
|
id: "useUnits",
|
|
217
219
|
isA: ['verb'],
|
|
218
220
|
bridge: "{ ...next(operator), units: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'units' }] }",
|
|
221
|
+
check: defaultContextCheckProperties(['units']),
|
|
219
222
|
semantic: ({context, api}) => {
|
|
220
223
|
api.setPreferredUnits(context.units)
|
|
221
224
|
}
|
|
@@ -227,7 +230,7 @@ const config = {
|
|
|
227
230
|
{
|
|
228
231
|
where: where(),
|
|
229
232
|
id: "quantity",
|
|
230
|
-
isA: ['noun'],
|
|
233
|
+
isA: ['noun', 'linearlyOrdered'],
|
|
231
234
|
check: defaultContextCheckProperties(['amount', 'unit']),
|
|
232
235
|
// bridge: "{ ...next(operator) }",
|
|
233
236
|
generatorp: {
|
|
@@ -252,19 +255,28 @@ const config = {
|
|
|
252
255
|
convolution: true,
|
|
253
256
|
before: ['preposition', 'propertyMarker'],
|
|
254
257
|
after: ['mathematical_operator'],
|
|
255
|
-
|
|
256
|
-
bridge:
|
|
258
|
+
localHierarchy: [['linearOrderedRange', 'number']],
|
|
259
|
+
bridge: `{
|
|
260
|
+
marker: next(operator('quantity')),
|
|
261
|
+
dead: true,
|
|
262
|
+
instance: true,
|
|
263
|
+
rangeableWith: ['quantity'],
|
|
264
|
+
unit: after[0],
|
|
265
|
+
amount: before[0],
|
|
266
|
+
interpolate: [ { property: 'amount' }, { property: 'unit' } ]
|
|
267
|
+
}`,
|
|
268
|
+
check: defaultContextCheckProperties(['unit', 'amount']),
|
|
257
269
|
},
|
|
258
270
|
{
|
|
259
271
|
where: where(),
|
|
260
272
|
id: "convertToUnits",
|
|
261
273
|
bridge: "{ ...next(operator), from: before[0], to: after[0] }",
|
|
274
|
+
check: defaultContextCheckProperties(['from', 'to']),
|
|
262
275
|
isA: ['expression', 'queryable'],
|
|
263
276
|
localHierarchy: [['unknown', 'dimension']],
|
|
264
277
|
after: [['possession', 0], ['possession', 1]],
|
|
265
278
|
generatorp: async ({context, g}) => `${await g(context.from)} ${context.word} ${await g(context.to)}`,
|
|
266
|
-
|
|
267
|
-
evaluator: async ({context, api, toArray, resolveEvaluate}) => {
|
|
279
|
+
semantic: async ({context, api, toArray, callId, resolveEvaluate}) => {
|
|
268
280
|
const from = context.from;
|
|
269
281
|
const tos = toArray(context.to);
|
|
270
282
|
resolveEvaluate(context, await api.convertToUnits(context, from, tos))
|
|
@@ -273,6 +285,7 @@ const config = {
|
|
|
273
285
|
{
|
|
274
286
|
id: "unit",
|
|
275
287
|
isA: ['mathematicalExpression'],
|
|
288
|
+
before: ['mathematical_operator'],
|
|
276
289
|
},
|
|
277
290
|
],
|
|
278
291
|
};
|
|
@@ -282,7 +295,7 @@ const template = {
|
|
|
282
295
|
"amount is a concept",
|
|
283
296
|
"measurement modifies unit",
|
|
284
297
|
"dimension and measurement unit are concepts",
|
|
285
|
-
"unit means measurement unit",
|
|
298
|
+
// "unit means measurement unit",
|
|
286
299
|
({apis}) => {
|
|
287
300
|
apis('properties').addHierarchyWatcher({
|
|
288
301
|
match: ({parentId, isA}) => isA(parentId, 'unit') && parentId.startsWith('unit_'),
|
|
@@ -313,6 +326,7 @@ const template = {
|
|
|
313
326
|
bridges: [
|
|
314
327
|
{
|
|
315
328
|
id: 'useMeasurementSystem',
|
|
329
|
+
where: where(),
|
|
316
330
|
isA: ['verb'],
|
|
317
331
|
bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
|
|
318
332
|
semantic: ({context, api}) => {
|
|
@@ -322,6 +336,51 @@ const template = {
|
|
|
322
336
|
},
|
|
323
337
|
],
|
|
324
338
|
},
|
|
339
|
+
{
|
|
340
|
+
semantics: [
|
|
341
|
+
{
|
|
342
|
+
where: where(),
|
|
343
|
+
match: ({context, isA}) => {
|
|
344
|
+
if (context.marker == 'linearlyOrderedCompare') {
|
|
345
|
+
const terms = [context.left, context.right]
|
|
346
|
+
return terms.every((term) => isA(term, 'quantity')) && terms.every((term) => term.instance)
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
apply: async ({context, toFinalValue, toEValue, compare, resolveEvaluate, e}) => {
|
|
350
|
+
const { left, right } = context
|
|
351
|
+
if (left.propertyType !== right.propertyType) {
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
const convert = await e({ marker: 'convertToUnits', from: right, to: left.unit }, where())
|
|
355
|
+
const rightInLeftUnits = await toEValue(convert)
|
|
356
|
+
resolveEvaluate(context, await compare(left.amount, await rightInLeftUnits.amount))
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
{
|
|
361
|
+
where: where(),
|
|
362
|
+
match: ({context, isA, debug}) => {
|
|
363
|
+
if (context.marker !== 'unify') {
|
|
364
|
+
return
|
|
365
|
+
}
|
|
366
|
+
if (context.terms[0].marker == 'linearOrderedRange') {
|
|
367
|
+
} else {
|
|
368
|
+
return context.terms.every((term) => isA(term, 'quantity')) && context.terms.every((term) => term.instance)
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
apply: async ({context, e, debug, unify, resolveEvaluate, toEValue}) => {
|
|
372
|
+
const t1 = context.terms[0]
|
|
373
|
+
const t2 = context.terms[1]
|
|
374
|
+
if (t1.propertyType !== t2.propertyType) {
|
|
375
|
+
return
|
|
376
|
+
}
|
|
377
|
+
const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit }, where())
|
|
378
|
+
const t2InT1Units = await toEValue(convert)
|
|
379
|
+
resolveEvaluate(context, await unify(t1.amount, await t2InT1Units.amount))
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
},
|
|
325
384
|
],
|
|
326
385
|
}
|
|
327
386
|
|
|
@@ -346,6 +405,7 @@ knowledgeModule({
|
|
|
346
405
|
context: [
|
|
347
406
|
defaultContextCheck({ marker: 'metric_system', exported: true }),
|
|
348
407
|
defaultContextCheck({ marker: 'convertToUnits', exported: true, extra: ['from', 'to'] }),
|
|
408
|
+
defaultContextCheck({ marker: 'noconversion', exported: true, extra: ['from', 'to'] }),
|
|
349
409
|
defaultContextCheck({
|
|
350
410
|
match: ({context, isA}) => isA(context.marker, 'unit'),
|
|
351
411
|
exported: true,
|