tpmkms 9.5.1-beta.11 → 9.5.1-beta.14
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/can.instance.json +2168 -5
- package/common/can.js +99 -35
- package/common/colors.instance.json +28 -0
- package/common/crew.instance.json +138 -124
- package/common/dates.instance.json +84 -0
- package/common/dialogues.js +12 -9
- package/common/dimension.instance.json +15 -11
- package/common/dimension.js +23 -4
- package/common/dimension.test.json +1758 -2351
- package/common/edible.instance.json +56 -0
- package/common/emotions.instance.json +47 -70
- package/common/fastfood.instance.json +542 -210
- package/common/gdefaults.js +49 -10
- package/common/help.test.json +65 -11
- package/common/helpers/properties.js +32 -12
- package/common/hierarchy.js +1 -0
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +18 -0
- package/common/length.test.json +2241 -1801
- package/common/ordering.instance.json +4 -2
- package/common/people.instance.json +54 -1
- package/common/pipboy.instance.json +56 -0
- package/common/pressure.instance.json +4 -0
- package/common/properties.instance.json +3 -11
- package/common/reports.instance.json +2 -2
- package/common/temperature.instance.json +4 -0
- package/common/weight.instance.json +17 -0
- package/common/words.instance.json +2 -0
- package/common/words.js +53 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +56 -0
- package/main.js +0 -2
- package/package.json +6 -5
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/dialogues.js
CHANGED
|
@@ -16,8 +16,6 @@ const dialogues_tests = require('./dialogues.test.json')
|
|
|
16
16
|
const { defaultObjectCheck, defaultContextCheck, indent, focus } = require('./helpers')
|
|
17
17
|
const pluralize = require('pluralize')
|
|
18
18
|
|
|
19
|
-
const api = new API()
|
|
20
|
-
|
|
21
19
|
function warningIsANotImplemented(log, context) {
|
|
22
20
|
const description = 'WARNING from Dialogues KM: For semantics in order to handle sentences of type "x is y?", set the response to what you like.'
|
|
23
21
|
const match = `({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.query && <other conditions as you like>`
|
|
@@ -59,10 +57,6 @@ const config = {
|
|
|
59
57
|
// who is the car owned by
|
|
60
58
|
"(([queryable]) [(<isEd|> ([isEdAble|]))])",
|
|
61
59
|
|
|
62
|
-
/* TODO investigate this:
|
|
63
|
-
{"pattern":"(([ownee])^ <owned|owned> ([by] ([owner])?))","uuid":"people1"}
|
|
64
|
-
{"pattern":"(([isEdee])^ <isEdAble|> ([by] ([isEder])?))","uuid":"dialogues2"}
|
|
65
|
-
*/
|
|
66
60
|
"(([isEdee])^ <isEdAble|> ([by] ([isEder])?))",
|
|
67
61
|
"([isEdee|])",
|
|
68
62
|
"([isEder|])",
|
|
@@ -175,7 +169,16 @@ const config = {
|
|
|
175
169
|
},
|
|
176
170
|
{ id: "toAble" },
|
|
177
171
|
|
|
178
|
-
{
|
|
172
|
+
{
|
|
173
|
+
id: "be",
|
|
174
|
+
level: 0,
|
|
175
|
+
bridge: `{
|
|
176
|
+
...next(operator),
|
|
177
|
+
form: 'infinitive',
|
|
178
|
+
type: after[0]
|
|
179
|
+
}`
|
|
180
|
+
},
|
|
181
|
+
|
|
179
182
|
{ id: "briefOrWordy" },
|
|
180
183
|
|
|
181
184
|
{ id: "yesno" },
|
|
@@ -231,7 +234,6 @@ const config = {
|
|
|
231
234
|
words: {
|
|
232
235
|
"literals": {
|
|
233
236
|
"?": [{"id": "questionMark", "initial": "{}" }],
|
|
234
|
-
// "the": [{"id": "the", "initial": "{ modifiers: [] }" }],
|
|
235
237
|
"who": [{"id": "what", "initial": "{ modifiers: [], query: true }" }],
|
|
236
238
|
"yes": [{"id": "yesno", "initial": "{ value: true }" }],
|
|
237
239
|
"no": [{"id": "yesno", "initial": "{ value: false }" }],
|
|
@@ -240,6 +242,7 @@ const config = {
|
|
|
240
242
|
"does": [{"id": "does", "initial": "{ number: 'one' }" }],
|
|
241
243
|
"do": [{"id": "does", "initial": "{ number: 'many' }" }],
|
|
242
244
|
"is": [
|
|
245
|
+
{"id": "be", "initial": "{ form: 'infinitive' }" },
|
|
243
246
|
{"id": "is", "initial": "{ number: 'one' }" },
|
|
244
247
|
{"id": "isQuery", "initial": "{ number: 'one' }" },
|
|
245
248
|
{"id": "isEd", "initial": "{ number: 'one' }" }
|
|
@@ -473,7 +476,7 @@ const config = {
|
|
|
473
476
|
} else {
|
|
474
477
|
// TODO fix this using the assumed and that whole mess. change isResponse to useValue
|
|
475
478
|
if (context.isResponse) {
|
|
476
|
-
return `${await gp(context.one, { responding: true })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
|
|
479
|
+
return `${await gp(context.one, { assumed: { responding: true } })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
|
|
477
480
|
} else {
|
|
478
481
|
return `${await gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gr(context.two)}`
|
|
479
482
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"configs": [
|
|
3
3
|
"dimension and unit are concepts",
|
|
4
|
+
{
|
|
5
|
+
"apply": "({apis}) => {\n apis('properties').addHierarchyWatcher({\n match: ({parentId}) => parentId == 'unit',\n apply: ({config, childId, parent}) => {\n config.updateBridge(childId, ({ bridge }) => {\n // console.log(JSON.stringify(childId, null, 2))\n // console.log(JSON.stringify(parentId, null, 2))\n // debugger\n // if (!bridge) {\n // debugger\n // return\n // }\n if (!bridge.init) {\n bridge.init = {}\n }\n // bridge.init['dimension'] = parent.object.marker\n bridge.init['dimension'] = parent.object.value\n })\n }\n })\n }"
|
|
6
|
+
},
|
|
4
7
|
{
|
|
5
8
|
"name": "dimension",
|
|
6
9
|
"operators": [
|
|
@@ -47,10 +50,9 @@
|
|
|
47
50
|
],
|
|
48
51
|
"bridges": [
|
|
49
52
|
{
|
|
50
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
53
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:82",
|
|
51
54
|
"id": "dimension",
|
|
52
55
|
"bridge": "{ ...next(operator) }",
|
|
53
|
-
"isA": [],
|
|
54
56
|
"generatorpr": {}
|
|
55
57
|
},
|
|
56
58
|
{
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"id": "amount"
|
|
66
68
|
},
|
|
67
69
|
{
|
|
68
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
70
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:107",
|
|
69
71
|
"id": "degree",
|
|
70
72
|
"words": [
|
|
71
73
|
{
|
|
@@ -82,10 +84,10 @@
|
|
|
82
84
|
{
|
|
83
85
|
"id": "amountOfDimension",
|
|
84
86
|
"convolution": true,
|
|
85
|
-
"bridge": "{ marker: operator('dimension'), unit: after[0], value: before[0].value, amount: before[0] }"
|
|
87
|
+
"bridge": "{ marker: next(catch(operator(after[0].dimension), operator('dimension'))), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
90
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:121",
|
|
89
91
|
"id": "convertToUnits",
|
|
90
92
|
"bridge": "{ ...next(operator), from: before[0], to: after[0] }",
|
|
91
93
|
"isA": [
|
|
@@ -1546,6 +1548,9 @@
|
|
|
1546
1548
|
"query": "dimension and unit are concepts"
|
|
1547
1549
|
}
|
|
1548
1550
|
},
|
|
1551
|
+
{
|
|
1552
|
+
"apply": "({apis}) => {\n apis('properties').addHierarchyWatcher({\n match: ({parentId}) => parentId == 'unit',\n apply: ({config, childId, parent}) => {\n config.updateBridge(childId, ({ bridge }) => {\n // console.log(JSON.stringify(childId, null, 2))\n // console.log(JSON.stringify(parentId, null, 2))\n // debugger\n // if (!bridge) {\n // debugger\n // return\n // }\n if (!bridge.init) {\n bridge.init = {}\n }\n // bridge.init['dimension'] = parent.object.marker\n bridge.init['dimension'] = parent.object.value\n })\n }\n })\n }"
|
|
1553
|
+
},
|
|
1549
1554
|
{
|
|
1550
1555
|
"extraConfig": true,
|
|
1551
1556
|
"name": "dimension",
|
|
@@ -1587,15 +1592,14 @@
|
|
|
1587
1592
|
],
|
|
1588
1593
|
"generators": [
|
|
1589
1594
|
{
|
|
1590
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
1595
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:75"
|
|
1591
1596
|
}
|
|
1592
1597
|
],
|
|
1593
1598
|
"bridges": [
|
|
1594
1599
|
{
|
|
1595
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
1600
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:82",
|
|
1596
1601
|
"id": "dimension",
|
|
1597
1602
|
"bridge": "{ ...next(operator) }",
|
|
1598
|
-
"isA": [],
|
|
1599
1603
|
"generatorpr": {}
|
|
1600
1604
|
},
|
|
1601
1605
|
{
|
|
@@ -1610,7 +1614,7 @@
|
|
|
1610
1614
|
"id": "amount"
|
|
1611
1615
|
},
|
|
1612
1616
|
{
|
|
1613
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
1617
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:107",
|
|
1614
1618
|
"id": "degree",
|
|
1615
1619
|
"words": [
|
|
1616
1620
|
{
|
|
@@ -1626,10 +1630,10 @@
|
|
|
1626
1630
|
{
|
|
1627
1631
|
"id": "amountOfDimension",
|
|
1628
1632
|
"convolution": true,
|
|
1629
|
-
"bridge": "{ marker: operator('dimension'), unit: after[0], value: before[0].value, amount: before[0] }"
|
|
1633
|
+
"bridge": "{ marker: next(catch(operator(after[0].dimension), operator('dimension'))), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
|
|
1630
1634
|
},
|
|
1631
1635
|
{
|
|
1632
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
1636
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:121",
|
|
1633
1637
|
"id": "convertToUnits",
|
|
1634
1638
|
"bridge": "{ ...next(operator), from: before[0], to: after[0] }",
|
|
1635
1639
|
"isA": [
|
package/common/dimension.js
CHANGED
|
@@ -50,8 +50,6 @@ class API {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const api = new API()
|
|
54
|
-
|
|
55
53
|
const config = {
|
|
56
54
|
name: 'dimension',
|
|
57
55
|
operators: [
|
|
@@ -84,7 +82,6 @@ const config = {
|
|
|
84
82
|
where: where(),
|
|
85
83
|
id: "dimension",
|
|
86
84
|
bridge: "{ ...next(operator) }",
|
|
87
|
-
isA: [],
|
|
88
85
|
generatorpr: {
|
|
89
86
|
match: ({context}) => context.amount,
|
|
90
87
|
apply: async ({context, gp, gr}) => `${await gr(context.amount)} ${await gp(context.unit)}`,
|
|
@@ -117,7 +114,8 @@ const config = {
|
|
|
117
114
|
{
|
|
118
115
|
id: "amountOfDimension",
|
|
119
116
|
convolution: true,
|
|
120
|
-
bridge: "{ marker: operator('dimension'), unit: after[0], value: before[0].value, amount: before[0] }"
|
|
117
|
+
bridge: "{ marker: next(catch(operator(after[0].dimension), operator('dimension'))), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
|
|
118
|
+
// bridge: "{ marker: operator('dimension'), unit: after[0], value: before[0].value, amount: before[0] }"
|
|
121
119
|
},
|
|
122
120
|
{
|
|
123
121
|
where: where(),
|
|
@@ -180,6 +178,27 @@ const config = {
|
|
|
180
178
|
const template = {
|
|
181
179
|
configs: [
|
|
182
180
|
"dimension and unit are concepts",
|
|
181
|
+
({apis}) => {
|
|
182
|
+
apis('properties').addHierarchyWatcher({
|
|
183
|
+
match: ({parentId}) => parentId == 'unit',
|
|
184
|
+
apply: ({config, childId, parent}) => {
|
|
185
|
+
config.updateBridge(childId, ({ bridge }) => {
|
|
186
|
+
// console.log(JSON.stringify(childId, null, 2))
|
|
187
|
+
// console.log(JSON.stringify(parentId, null, 2))
|
|
188
|
+
// debugger
|
|
189
|
+
// if (!bridge) {
|
|
190
|
+
// debugger
|
|
191
|
+
// return
|
|
192
|
+
// }
|
|
193
|
+
if (!bridge.init) {
|
|
194
|
+
bridge.init = {}
|
|
195
|
+
}
|
|
196
|
+
// bridge.init['dimension'] = parent.object.marker
|
|
197
|
+
bridge.init['dimension'] = parent.object.value
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
},
|
|
183
202
|
config,
|
|
184
203
|
],
|
|
185
204
|
}
|