tpmkms_4wp 9.5.1-beta.2 → 9.5.1-beta.20
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 +21 -61
- package/common/asking.js +102 -100
- package/common/can.instance.json +2180 -0
- package/common/can.js +254 -0
- package/common/can.test.json +50706 -0
- package/common/characters.js +3 -3
- package/common/colors.instance.json +38 -10
- package/common/comparable.instance.json +2 -2
- package/common/concept.test.json +54 -40
- package/common/conjunction.js +13 -5
- package/common/crew.instance.json +241 -123
- package/common/crew.js +1 -1
- package/common/currency.js +1 -1
- package/common/dates.instance.json +87 -3
- package/common/dialogues.js +41 -119
- package/common/dimension.instance.json +16 -12
- package/common/dimension.js +23 -4
- package/common/dimension.test.json +1758 -2351
- package/common/edible.instance.json +79 -95
- package/common/emotions.instance.json +53 -80
- package/common/emotions.js +1 -1
- package/common/english_helpers.js +277 -67
- package/common/fastfood.instance.json +35 -663
- package/common/fastfood.js +4 -4
- package/common/formulas.instance.json +1 -1
- package/common/gdefaults.js +85 -14
- package/common/help.js +2 -2
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +1 -1
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +8 -8
- package/common/helpers/properties.js +102 -21
- package/common/helpers.js +82 -46
- package/common/hierarchy.js +4 -3
- package/common/kirk.instance.json +1 -1
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +20 -2
- package/common/length.test.json +2241 -1801
- package/common/math.instance.json +20 -20
- package/common/math.js +45 -44
- package/common/menus.instance.json +3 -3
- package/common/menus.js +1 -1
- package/common/meta.js +49 -33
- package/common/ordering.instance.json +20 -30
- package/common/ordering.js +1 -1
- package/common/ordering.test.json +354 -296
- package/common/people.instance.json +56 -258
- package/common/people.js +1 -1
- package/common/people.test.json +952 -681
- package/common/pipboy.instance.json +72 -16
- package/common/pokemon.instance.json +8 -8
- package/common/pokemon.js +1 -1
- package/common/pressure.instance.json +6 -2
- package/common/properties.instance.json +4 -12
- package/common/properties.js +16 -3
- package/common/reminders.js +1 -1
- package/common/reports.instance.json +3 -3
- package/common/reports.js +18 -16
- package/common/scorekeeper.js +4 -4
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +1 -1
- package/common/stgame.js +1 -1
- package/common/stm.js +2 -2
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +6 -2
- package/common/tester.js +3 -3
- package/common/time.js +3 -3
- package/common/tokenize.js +1 -1
- package/common/weight.instance.json +19 -2
- package/common/words.instance.json +9 -0
- package/common/words.js +53 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +320 -8
- package/common/wp.js +8 -4
- package/common/wp.test.json +3469 -0
- package/main.js +0 -2
- package/package.json +9 -5
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"scope": "testing"
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
62
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
63
63
|
"id": "plusOperator",
|
|
64
64
|
"level": 0,
|
|
65
65
|
"bridge": "{ ...next(operator), marker: next(operator('plusExpression')), 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 }",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"generatorp": "({context}) => context.word"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
83
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
84
84
|
"id": "plusExpression",
|
|
85
85
|
"level": 0,
|
|
86
86
|
"bridge": "{ ...next(operator) }",
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"mathematicalExpression"
|
|
89
89
|
],
|
|
90
90
|
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
|
91
|
-
"evaluator": "async ({e, context}) => {\n
|
|
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
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
94
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
95
95
|
"id": "minusOperator",
|
|
96
96
|
"level": 0,
|
|
97
97
|
"bridge": "{ ...next(operator), marker: next(operator('minusExpression')), 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 }",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"generatorp": "({context}) => context.word"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
115
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
116
116
|
"id": "minusExpression",
|
|
117
117
|
"level": 0,
|
|
118
118
|
"bridge": "{ ...next(operator) }",
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
"mathematicalExpression"
|
|
121
121
|
],
|
|
122
122
|
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
|
123
|
-
"evaluator": "async ({e, context}) => {\n
|
|
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
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
126
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
127
127
|
"id": "timesOperator",
|
|
128
128
|
"level": 0,
|
|
129
129
|
"bridge": "{ ...next(operator), marker: next(operator('timesExpression')), 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 }",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"generatorp": "({context}) => context.word"
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
156
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
157
157
|
"id": "timesExpression",
|
|
158
158
|
"level": 0,
|
|
159
159
|
"bridge": "{ ...next(operator) }",
|
|
@@ -161,10 +161,10 @@
|
|
|
161
161
|
"mathematicalExpression"
|
|
162
162
|
],
|
|
163
163
|
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
|
164
|
-
"evaluator": "async ({e, context}) => {\n
|
|
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
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
167
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
168
168
|
"id": "divideByOperator",
|
|
169
169
|
"level": 0,
|
|
170
170
|
"bridge": "{ ...next(operator), marker: next(operator('divideByExpression')), 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 }",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"generatorp": "({context}) => context.word"
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
196
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
197
197
|
"id": "divideByExpression",
|
|
198
198
|
"level": 0,
|
|
199
199
|
"bridge": "{ ...next(operator) }",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"mathematicalExpression"
|
|
202
202
|
],
|
|
203
203
|
"generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
|
|
204
|
-
"evaluator": "async ({e, context}) => {\n
|
|
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
|
}
|
|
@@ -1131,7 +1131,7 @@
|
|
|
1131
1131
|
"scope": "testing"
|
|
1132
1132
|
},
|
|
1133
1133
|
{
|
|
1134
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1134
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1135
1135
|
"id": "plusOperator",
|
|
1136
1136
|
"level": 0,
|
|
1137
1137
|
"bridge": "{ ...next(operator), marker: next(operator('plusExpression')), 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 }",
|
|
@@ -1151,7 +1151,7 @@
|
|
|
1151
1151
|
]
|
|
1152
1152
|
},
|
|
1153
1153
|
{
|
|
1154
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1154
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1155
1155
|
"id": "plusExpression",
|
|
1156
1156
|
"level": 0,
|
|
1157
1157
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1160,7 +1160,7 @@
|
|
|
1160
1160
|
]
|
|
1161
1161
|
},
|
|
1162
1162
|
{
|
|
1163
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1163
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1164
1164
|
"id": "minusOperator",
|
|
1165
1165
|
"level": 0,
|
|
1166
1166
|
"bridge": "{ ...next(operator), marker: next(operator('minusExpression')), 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 }",
|
|
@@ -1180,7 +1180,7 @@
|
|
|
1180
1180
|
]
|
|
1181
1181
|
},
|
|
1182
1182
|
{
|
|
1183
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1183
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1184
1184
|
"id": "minusExpression",
|
|
1185
1185
|
"level": 0,
|
|
1186
1186
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1189,7 +1189,7 @@
|
|
|
1189
1189
|
]
|
|
1190
1190
|
},
|
|
1191
1191
|
{
|
|
1192
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1192
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1193
1193
|
"id": "timesOperator",
|
|
1194
1194
|
"level": 0,
|
|
1195
1195
|
"bridge": "{ ...next(operator), marker: next(operator('timesExpression')), 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 }",
|
|
@@ -1218,7 +1218,7 @@
|
|
|
1218
1218
|
]
|
|
1219
1219
|
},
|
|
1220
1220
|
{
|
|
1221
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1221
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1222
1222
|
"id": "timesExpression",
|
|
1223
1223
|
"level": 0,
|
|
1224
1224
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1227,7 +1227,7 @@
|
|
|
1227
1227
|
]
|
|
1228
1228
|
},
|
|
1229
1229
|
{
|
|
1230
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1230
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1231
1231
|
"id": "divideByOperator",
|
|
1232
1232
|
"level": 0,
|
|
1233
1233
|
"bridge": "{ ...next(operator), marker: next(operator('divideByExpression')), 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 }",
|
|
@@ -1255,7 +1255,7 @@
|
|
|
1255
1255
|
]
|
|
1256
1256
|
},
|
|
1257
1257
|
{
|
|
1258
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1258
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1259
1259
|
"id": "divideByExpression",
|
|
1260
1260
|
"level": 0,
|
|
1261
1261
|
"bridge": "{ ...next(operator) }",
|
package/common/math.js
CHANGED
|
@@ -18,7 +18,7 @@ const instance = require('./math.instance.json')
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
// TODO need to deal with value vs evalue
|
|
21
|
-
|
|
21
|
+
function toValue(context) {
|
|
22
22
|
while( true ) {
|
|
23
23
|
if (typeof context == 'number' || !context) {
|
|
24
24
|
return context
|
|
@@ -27,48 +27,49 @@ const toValue = (context) => {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
context.
|
|
65
|
-
|
|
30
|
+
function mathematicalOperator(name, words, apply, before = []) {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
where: where(),
|
|
34
|
+
id: `${name}Operator`, level: 0,
|
|
35
|
+
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 }` ,
|
|
36
|
+
// bridge: `{ ...next(operator), marker: next(operator('${name}Expression')), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }` ,
|
|
37
|
+
isA: ['mathematical_operator'],
|
|
38
|
+
before,
|
|
39
|
+
localHierarchy: [ ['unknown', 'number'] ],
|
|
40
|
+
// levelSpecificHierarchy: [[1, 'mathematicalExpression']],
|
|
41
|
+
words,
|
|
42
|
+
generatorp: ({context}) => context.word,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
where: where(),
|
|
46
|
+
id: `${name}Expression`, level: 0,
|
|
47
|
+
bridge: "{ ...next(operator) }" ,
|
|
48
|
+
isA: ['mathematicalExpression'],
|
|
49
|
+
generatorp: async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`,
|
|
50
|
+
evaluator: async ({e, context}) => {
|
|
51
|
+
const x = toValue(await e(context.x))
|
|
52
|
+
const y = toValue(await e(context.y))
|
|
53
|
+
if (!x || !y) {
|
|
54
|
+
// context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
|
|
55
|
+
context.isResponse = false
|
|
56
|
+
} else {
|
|
57
|
+
context.evalue = apply(x, y)
|
|
58
|
+
context.evalue.isResponse = true
|
|
59
|
+
context.evalue.paraphrase = false
|
|
60
|
+
// context.paraphrase = false
|
|
61
|
+
// context.isResponse = true
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
if (!context.value) {
|
|
65
|
+
context.isResponse = false
|
|
66
|
+
context.paraphrase = true
|
|
67
|
+
}
|
|
68
|
+
*/
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]
|
|
71
|
-
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
72
73
|
const config = {
|
|
73
74
|
name: 'math',
|
|
74
75
|
operators: [
|
|
@@ -96,8 +97,8 @@ const config = {
|
|
|
96
97
|
before: ['verb'],
|
|
97
98
|
after: ['adjective'],
|
|
98
99
|
},
|
|
99
|
-
{ id: "x", isA: ['number'], level: 0, bridge: '{ ...next(operator) }', scope: "testing"},
|
|
100
|
-
{ id: "y", isA: ['number'], level: 0, bridge: '{ ...next(operator) }', scope: "testing"},
|
|
100
|
+
{ id: "x", isA: ['number'], level: 0, bridge: '{ ...next(operator) }', scope: "testing" },
|
|
101
|
+
{ id: "y", isA: ['number'], level: 0, bridge: '{ ...next(operator) }', scope: "testing" },
|
|
101
102
|
...mathematicalOperator('plus', ['plus', '+'], (x, y) => x + y),
|
|
102
103
|
...mathematicalOperator('minus', ['minus', '-'], (x, y) => x - y),
|
|
103
104
|
...mathematicalOperator('times', ['times', '*'], (x, y) => x * y, [['plusOperator', 0], ['minusOperator', 0]]),
|
|
@@ -2075,7 +2075,7 @@
|
|
|
2075
2075
|
"word": "menu",
|
|
2076
2076
|
"range": {
|
|
2077
2077
|
"start": 0,
|
|
2078
|
-
"end":
|
|
2078
|
+
"end": 3
|
|
2079
2079
|
},
|
|
2080
2080
|
"dead": true,
|
|
2081
2081
|
"types": [
|
|
@@ -3353,7 +3353,7 @@
|
|
|
3353
3353
|
"word": "item",
|
|
3354
3354
|
"range": {
|
|
3355
3355
|
"start": 0,
|
|
3356
|
-
"end":
|
|
3356
|
+
"end": 3
|
|
3357
3357
|
},
|
|
3358
3358
|
"dead": true,
|
|
3359
3359
|
"types": [
|
|
@@ -6017,7 +6017,7 @@
|
|
|
6017
6017
|
"text": "menus and menu items",
|
|
6018
6018
|
"range": {
|
|
6019
6019
|
"start": 0,
|
|
6020
|
-
"end":
|
|
6020
|
+
"end": 19
|
|
6021
6021
|
},
|
|
6022
6022
|
"types": [
|
|
6023
6023
|
"list",
|
package/common/menus.js
CHANGED
|
@@ -214,7 +214,7 @@ class UIAPI {
|
|
|
214
214
|
file (<- instance of menu) menu (<- concept of menu)
|
|
215
215
|
*/
|
|
216
216
|
// called for the non-module load to setup fixtures
|
|
217
|
-
|
|
217
|
+
async function fixtures({api, fragment, s, config, objects, kms, isModule}) {
|
|
218
218
|
const fileMenuId = api.addMenu('file')
|
|
219
219
|
const objectMenuId = api.addMenu('object')
|
|
220
220
|
|
package/common/meta.js
CHANGED
|
@@ -206,10 +206,14 @@ const config = {
|
|
|
206
206
|
// setup the read semantic
|
|
207
207
|
|
|
208
208
|
// !topLevel or maybe !value??!?!
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
function match(defContext) {
|
|
210
|
+
return ({context}) => context.marker == (defContext.consequence || {}).marker && context.query // && !context.value
|
|
211
|
+
}
|
|
212
|
+
function apply(DEFINITIONs, DERIVED) {
|
|
211
213
|
const mappingss = translationMappings(DEFINITIONs, DERIVED)
|
|
212
|
-
|
|
214
|
+
function invertMappings(mappings) {
|
|
215
|
+
return mappings.map( ({ from, to }) => { return { to: from, from: to } } )
|
|
216
|
+
}
|
|
213
217
|
return async ({context, s, config}) => {
|
|
214
218
|
DEFINITIONs = _.cloneDeep(DEFINITIONs)
|
|
215
219
|
//const mappings = mappingss[0]
|
|
@@ -306,15 +310,21 @@ const config = {
|
|
|
306
310
|
apply: async ({config, context, g}) => {
|
|
307
311
|
// setup the write semantic
|
|
308
312
|
{
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
function matchByMarker(defContext) {
|
|
314
|
+
return ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
|
|
315
|
+
}
|
|
316
|
+
function matchByValue(defContext) {
|
|
317
|
+
return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
|
|
318
|
+
}
|
|
319
|
+
function apply(mappings, TO) {
|
|
320
|
+
return async ({context, s}) => {
|
|
321
|
+
TO = _.cloneDeep(TO)
|
|
322
|
+
for (const { from, to } of mappings) {
|
|
323
|
+
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
|
324
|
+
}
|
|
325
|
+
toPrime = await s(TO)
|
|
326
|
+
context.result = toPrime.result
|
|
315
327
|
}
|
|
316
|
-
toPrime = await s(TO)
|
|
317
|
-
context.result = toPrime.result
|
|
318
328
|
}
|
|
319
329
|
const mappings = translationMapping(context.from, context.to)
|
|
320
330
|
let match = matchByMarker(context)
|
|
@@ -333,30 +343,36 @@ const config = {
|
|
|
333
343
|
|
|
334
344
|
// setup the read semantic
|
|
335
345
|
{
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
346
|
+
function matchByMarker(defContext) {
|
|
347
|
+
return ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
|
|
348
|
+
}
|
|
349
|
+
function matchByValue(defContext) {
|
|
350
|
+
return ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
|
|
351
|
+
}
|
|
352
|
+
function apply(mappings, TO) {
|
|
353
|
+
return async ({uuid, context, s, g, config}) => {
|
|
354
|
+
TO = _.cloneDeep(TO)
|
|
355
|
+
for (const { from, to } of mappings) {
|
|
356
|
+
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
|
357
|
+
}
|
|
358
|
+
// next move add debug arg to s and g
|
|
359
|
+
// TODO why is there query and evaluate?
|
|
360
|
+
if (context.query) {
|
|
361
|
+
TO.query = context.query
|
|
362
|
+
} else {
|
|
363
|
+
TO.evaluate = context.evaluate
|
|
364
|
+
}
|
|
365
|
+
TO[`disable${uuid}`] = true
|
|
366
|
+
toPrime = await s(TO)
|
|
367
|
+
if (context.query) {
|
|
368
|
+
if (toPrime.evalue) {
|
|
369
|
+
context.evalue = toPrime.evalue
|
|
370
|
+
} else {
|
|
371
|
+
context.evalue = toPrime
|
|
372
|
+
}
|
|
355
373
|
} else {
|
|
356
|
-
context.evalue = toPrime
|
|
374
|
+
context.evalue = toPrime.evalue
|
|
357
375
|
}
|
|
358
|
-
} else {
|
|
359
|
-
context.evalue = toPrime.evalue
|
|
360
376
|
}
|
|
361
377
|
}
|
|
362
378
|
const mappings = translationMapping(context.from, context.to)
|
|
@@ -594,7 +594,7 @@
|
|
|
594
594
|
"word": "wants",
|
|
595
595
|
"range": {
|
|
596
596
|
"start": 0,
|
|
597
|
-
"end":
|
|
597
|
+
"end": 4
|
|
598
598
|
},
|
|
599
599
|
"dead": true,
|
|
600
600
|
"types": [
|
|
@@ -2197,6 +2197,7 @@
|
|
|
2197
2197
|
"value": [
|
|
2198
2198
|
{
|
|
2199
2199
|
"value": "like",
|
|
2200
|
+
"isVerb": true,
|
|
2200
2201
|
"number": "one",
|
|
2201
2202
|
"text": "x likes y",
|
|
2202
2203
|
"marker": "like",
|
|
@@ -2207,12 +2208,7 @@
|
|
|
2207
2208
|
},
|
|
2208
2209
|
"do": {
|
|
2209
2210
|
"left": "liker",
|
|
2210
|
-
"right": "likee"
|
|
2211
|
-
"range": {
|
|
2212
|
-
"start": 3,
|
|
2213
|
-
"end": 11
|
|
2214
|
-
},
|
|
2215
|
-
"text": "ikes y"
|
|
2211
|
+
"right": "likee"
|
|
2216
2212
|
},
|
|
2217
2213
|
"liker": {
|
|
2218
2214
|
"value": "x",
|
|
@@ -2248,17 +2244,17 @@
|
|
|
2248
2244
|
},
|
|
2249
2245
|
"operator": {
|
|
2250
2246
|
"value": "like",
|
|
2247
|
+
"isVerb": true,
|
|
2251
2248
|
"number": "one",
|
|
2252
2249
|
"text": "likes",
|
|
2253
2250
|
"marker": "like",
|
|
2254
2251
|
"word": "likes",
|
|
2255
2252
|
"range": {
|
|
2256
|
-
"start":
|
|
2257
|
-
"end":
|
|
2253
|
+
"start": 5,
|
|
2254
|
+
"end": 9
|
|
2258
2255
|
},
|
|
2259
2256
|
"evaluateWord": true,
|
|
2260
2257
|
"imperative": false,
|
|
2261
|
-
"isVerb": true,
|
|
2262
2258
|
"level": 0
|
|
2263
2259
|
},
|
|
2264
2260
|
"unflatten": [
|
|
@@ -2274,7 +2270,8 @@
|
|
|
2274
2270
|
"property": "liker"
|
|
2275
2271
|
},
|
|
2276
2272
|
{
|
|
2277
|
-
"property": "operator"
|
|
2273
|
+
"property": "operator",
|
|
2274
|
+
"number": "liker"
|
|
2278
2275
|
},
|
|
2279
2276
|
{
|
|
2280
2277
|
"property": "likee"
|
|
@@ -2288,6 +2285,7 @@
|
|
|
2288
2285
|
},
|
|
2289
2286
|
{
|
|
2290
2287
|
"value": "love",
|
|
2288
|
+
"isVerb": true,
|
|
2291
2289
|
"number": "one",
|
|
2292
2290
|
"text": "x loves y",
|
|
2293
2291
|
"marker": "love",
|
|
@@ -2298,12 +2296,7 @@
|
|
|
2298
2296
|
},
|
|
2299
2297
|
"do": {
|
|
2300
2298
|
"left": "lover",
|
|
2301
|
-
"right": "lovee"
|
|
2302
|
-
"range": {
|
|
2303
|
-
"start": 16,
|
|
2304
|
-
"end": 24
|
|
2305
|
-
},
|
|
2306
|
-
"text": ""
|
|
2299
|
+
"right": "lovee"
|
|
2307
2300
|
},
|
|
2308
2301
|
"lover": {
|
|
2309
2302
|
"value": "x",
|
|
@@ -2339,17 +2332,17 @@
|
|
|
2339
2332
|
},
|
|
2340
2333
|
"operator": {
|
|
2341
2334
|
"value": "love",
|
|
2335
|
+
"isVerb": true,
|
|
2342
2336
|
"number": "one",
|
|
2343
2337
|
"text": "loves",
|
|
2344
2338
|
"marker": "love",
|
|
2345
2339
|
"word": "loves",
|
|
2346
2340
|
"range": {
|
|
2347
|
-
"start":
|
|
2348
|
-
"end":
|
|
2341
|
+
"start": 18,
|
|
2342
|
+
"end": 22
|
|
2349
2343
|
},
|
|
2350
2344
|
"evaluateWord": true,
|
|
2351
2345
|
"imperative": false,
|
|
2352
|
-
"isVerb": true,
|
|
2353
2346
|
"level": 0
|
|
2354
2347
|
},
|
|
2355
2348
|
"unflatten": [
|
|
@@ -2365,7 +2358,8 @@
|
|
|
2365
2358
|
"property": "lover"
|
|
2366
2359
|
},
|
|
2367
2360
|
{
|
|
2368
|
-
"property": "operator"
|
|
2361
|
+
"property": "operator",
|
|
2362
|
+
"number": "lover"
|
|
2369
2363
|
},
|
|
2370
2364
|
{
|
|
2371
2365
|
"property": "lovee"
|
|
@@ -2395,12 +2389,7 @@
|
|
|
2395
2389
|
},
|
|
2396
2390
|
"do": {
|
|
2397
2391
|
"left": "wanter",
|
|
2398
|
-
"right": "wantee"
|
|
2399
|
-
"range": {
|
|
2400
|
-
"start": 31,
|
|
2401
|
-
"end": 39
|
|
2402
|
-
},
|
|
2403
|
-
"text": ""
|
|
2392
|
+
"right": "wantee"
|
|
2404
2393
|
},
|
|
2405
2394
|
"wanter": {
|
|
2406
2395
|
"value": "x",
|
|
@@ -2440,8 +2429,8 @@
|
|
|
2440
2429
|
"marker": "want",
|
|
2441
2430
|
"word": "wants",
|
|
2442
2431
|
"range": {
|
|
2443
|
-
"start":
|
|
2444
|
-
"end":
|
|
2432
|
+
"start": 33,
|
|
2433
|
+
"end": 37
|
|
2445
2434
|
},
|
|
2446
2435
|
"evaluateWord": true,
|
|
2447
2436
|
"imperative": false,
|
|
@@ -2462,7 +2451,8 @@
|
|
|
2462
2451
|
"property": "wanter"
|
|
2463
2452
|
},
|
|
2464
2453
|
{
|
|
2465
|
-
"property": "operator"
|
|
2454
|
+
"property": "operator",
|
|
2455
|
+
"number": "wanter"
|
|
2466
2456
|
},
|
|
2467
2457
|
{
|
|
2468
2458
|
"property": "wantee"
|
package/common/ordering.js
CHANGED
|
@@ -32,7 +32,7 @@ const api = new API();
|
|
|
32
32
|
|
|
33
33
|
if a likes b then a wants b
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
function initializer({config, km}) {
|
|
36
36
|
const oapi = km('ordering').api
|
|
37
37
|
oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
|
|
38
38
|
const papi = km('properties').api
|