tpmkms_4wp 9.5.1-beta.30 → 9.5.1-beta.31
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/avatar.test.json +1001 -860
- package/common/concept.js +19 -22
- package/common/dateTimeSelectors.test.json +95954 -55427
- package/common/dimension.instance.json +21348 -552
- package/common/dimension.js +52 -27
- package/common/dimension.test.json +6699 -222
- package/common/{tank.instance.json → drone.instance.json} +13078 -4251
- package/common/{tank.js → drone.js} +47 -26
- package/common/{tank.test.json → drone.test.json} +3467 -2778
- package/common/fastfood.instance.json +681 -201
- package/common/helpers.js +2 -1
- package/common/hierarchy.js +2 -1
- package/common/kirk.test.json +600 -424
- package/common/length.instance.json +19329 -2521
- package/common/length.js +3 -1
- package/common/length.test.json +13943 -339
- package/common/meta.js +1 -0
- package/common/nameable.js +13 -6
- package/common/nameable.test.json +436 -0
- package/common/pressure.instance.json +2745 -745
- package/common/reminders.test.json +57841 -19033
- package/common/reports.instance.json +2 -2
- package/common/spock.test.json +606 -430
- package/common/stm.js +13 -2
- package/common/temperature.instance.json +3377 -1377
- package/common/time.instance.json +6248 -1748
- package/common/weight.instance.json +9577 -3577
- package/main.js +2 -2
- package/package.json +6 -6
package/common/dimension.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
|
2
|
-
const { defaultObjectCheck, defaultContextCheck } = require('./helpers')
|
|
1
|
+
const { debug, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
|
2
|
+
const { defaultObjectCheck, defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
|
|
3
3
|
const hierarchy = require('./hierarchy.js')
|
|
4
4
|
const formulas = require('./formulas.js')
|
|
5
5
|
const testing = require('./testing.js')
|
|
@@ -32,8 +32,21 @@ const instance = require('./dimension.instance.json')
|
|
|
32
32
|
*/
|
|
33
33
|
class API {
|
|
34
34
|
|
|
35
|
-
initialize({ config }) {
|
|
35
|
+
initialize({ config, objects }) {
|
|
36
36
|
this._config = config
|
|
37
|
+
this._objects = objects
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setMeasurementSystem(measurementSystem) {
|
|
41
|
+
this._objects.measurementSystem = measurementSystem
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// if the user says 2 feet deduce english etc
|
|
45
|
+
deduceMeasurementSystem(utterance) {
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getMeasurementSystem() {
|
|
49
|
+
return this._objects.measurementSystem
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
setup( {dimension, units} ) {
|
|
@@ -65,7 +78,6 @@ const config = {
|
|
|
65
78
|
operators: [
|
|
66
79
|
"([quantity])",
|
|
67
80
|
"([unit])",
|
|
68
|
-
// "(([unit]) [kindOfDimension|of] ([dimension]))",
|
|
69
81
|
"((amount/* || number/*) [amountOfCoordinate|] ([unit]))",
|
|
70
82
|
"(([amount]) [unit])",
|
|
71
83
|
"((@<=quantity || context.possession == true) [convertToUnits|in] (unit))",
|
|
@@ -106,15 +118,6 @@ const config = {
|
|
|
106
118
|
scope: "testing"
|
|
107
119
|
},
|
|
108
120
|
{ id: "amount", },
|
|
109
|
-
/*
|
|
110
|
-
{
|
|
111
|
-
id: "kindOfDimension",
|
|
112
|
-
bridge: "{ ...next(operator), subclass: before[0], class: after[0], value: concat(before[0].marker.id, after[0].marker.id) }",
|
|
113
|
-
// bridge: "{ ...next(operator), subclass: before[0], class: after[0], value: concat(before[0].marker, after[0].marker) }",
|
|
114
|
-
isA: ['preposition'],
|
|
115
|
-
generatorp: ({context, gp}) => `${gp(context.subclass)} ${context.word} ${gp(context.class)}`,
|
|
116
|
-
},
|
|
117
|
-
*/
|
|
118
121
|
{
|
|
119
122
|
where: where(),
|
|
120
123
|
id: "degree",
|
|
@@ -126,9 +129,7 @@ const config = {
|
|
|
126
129
|
{
|
|
127
130
|
id: "amountOfCoordinate",
|
|
128
131
|
convolution: true,
|
|
129
|
-
// bridge: "{ marker: next(catch(operator(after[0].dimension), operator('dimension'))), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
|
|
130
132
|
bridge: "{ marker: next(operator('quantity')), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
|
|
131
|
-
// bridge: "{ marker: operator('dimension'), unit: after[0], value: before[0].value, amount: before[0] }"
|
|
132
133
|
},
|
|
133
134
|
{
|
|
134
135
|
where: where(),
|
|
@@ -221,19 +222,14 @@ const config = {
|
|
|
221
222
|
|
|
222
223
|
const template = {
|
|
223
224
|
configs: [
|
|
224
|
-
"
|
|
225
|
+
"measurement modifies unit",
|
|
226
|
+
"dimension and measurement unit are concepts",
|
|
227
|
+
"unit means measurement unit",
|
|
225
228
|
({apis}) => {
|
|
226
229
|
apis('properties').addHierarchyWatcher({
|
|
227
|
-
match: ({parentId, isA}) => isA(parentId, 'unit'),
|
|
228
|
-
apply: ({config, childId, parent}) => {
|
|
230
|
+
match: ({parentId, isA}) => isA(parentId, 'unit') && parentId.startsWith('unit_'),
|
|
231
|
+
apply: ({config, childId, parent, parentId}) => {
|
|
229
232
|
config.updateBridge(childId, ({ bridge }) => {
|
|
230
|
-
// console.log(JSON.stringify(childId, null, 2))
|
|
231
|
-
// console.log(JSON.stringify(parentId, null, 2))
|
|
232
|
-
// debugger
|
|
233
|
-
// if (!bridge) {
|
|
234
|
-
// debugger
|
|
235
|
-
// return
|
|
236
|
-
// }
|
|
237
233
|
if (!bridge.init) {
|
|
238
234
|
bridge.init = {}
|
|
239
235
|
}
|
|
@@ -243,7 +239,32 @@ const template = {
|
|
|
243
239
|
}
|
|
244
240
|
})
|
|
245
241
|
},
|
|
242
|
+
"metric modifies system",
|
|
243
|
+
"imperial modifies system",
|
|
244
|
+
"measurement modifies system",
|
|
245
|
+
"the metric system is a measurement system",
|
|
246
|
+
"the imperial system is a measurement system",
|
|
247
|
+
"imperial modifies unit",
|
|
248
|
+
"metric modifies unit",
|
|
249
|
+
"imperial unit is a unit",
|
|
250
|
+
"metric unit is a unit",
|
|
246
251
|
config,
|
|
252
|
+
{
|
|
253
|
+
operators: [
|
|
254
|
+
"([useMeasurementSystem|use] (measurement_system))",
|
|
255
|
+
],
|
|
256
|
+
bridges: [
|
|
257
|
+
{
|
|
258
|
+
id: 'useMeasurementSystem',
|
|
259
|
+
isA: ['verb'],
|
|
260
|
+
bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
|
|
261
|
+
semantic: ({context, api}) => {
|
|
262
|
+
api.setMeasurementSystem(context.system.value)
|
|
263
|
+
},
|
|
264
|
+
check: defaultContextCheckProperties(['system']),
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
},
|
|
247
268
|
],
|
|
248
269
|
}
|
|
249
270
|
|
|
@@ -259,15 +280,19 @@ knowledgeModule({
|
|
|
259
280
|
name: './dimension.test.json',
|
|
260
281
|
contents: tests,
|
|
261
282
|
checks: {
|
|
262
|
-
objects: [
|
|
283
|
+
objects: [
|
|
284
|
+
{ km: 'properties' },
|
|
285
|
+
{ path: ['measurementSystem'] },
|
|
286
|
+
],
|
|
263
287
|
context: [
|
|
288
|
+
defaultContextCheck({ marker: 'metric_system', exported: true }),
|
|
264
289
|
defaultContextCheck({ marker: 'convertToUnits', exported: true, extra: ['from', 'to'] }),
|
|
265
290
|
defaultContextCheck({
|
|
266
291
|
match: ({context, isA}) => isA(context.marker, 'unit'),
|
|
267
292
|
exported: true,
|
|
268
293
|
extra: ['dimension'],
|
|
269
294
|
}),
|
|
270
|
-
defaultContextCheck(['dimension', 'response']),
|
|
295
|
+
// defaultContextCheck(['dimension', 'response']),
|
|
271
296
|
],
|
|
272
297
|
},
|
|
273
298
|
},
|