tpmkms 9.5.0 → 9.5.1-beta.10
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 +106 -104
- package/common/can.instance.json +17 -0
- package/common/can.js +188 -0
- package/common/characters.js +5 -5
- 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 +71 -85
- package/common/crew.js +1 -1
- package/common/crew.test.json +4148 -3324
- package/common/currency.js +1 -1
- package/common/dates.instance.json +87 -3
- package/common/dialogues.js +12 -9
- package/common/dimension.instance.json +9 -9
- package/common/dimension.js +4 -4
- package/common/edible.instance.json +79 -23
- package/common/emotions.instance.json +29 -7
- package/common/emotions.js +1 -1
- package/common/emotions.test.json +242 -174
- package/common/english_helpers.js +336 -0
- package/common/errors.js +3 -3
- package/common/evaluate.js +2 -2
- package/common/events.js +8 -8
- package/common/fastfood.instance.json +205 -553
- package/common/fastfood.js +4 -4
- package/common/formulas.instance.json +1 -1
- package/common/formulas.js +1 -1
- package/common/gdefaults.js +58 -9
- package/common/help.js +3 -3
- 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 +9 -9
- package/common/helpers/properties.js +158 -55
- package/common/helpers.js +135 -46
- package/common/hierarchy.js +3 -3
- package/common/kirk.instance.json +1 -1
- package/common/latin.instance.json +2 -2
- package/common/latin.js +4 -4
- package/common/length.instance.json +2 -2
- package/common/listener.js +1 -1
- package/common/math.instance.json +28 -28
- package/common/math.js +47 -46
- package/common/menus.instance.json +3 -3
- package/common/menus.js +1 -1
- package/common/meta.js +76 -60
- package/common/nameable.js +7 -7
- package/common/ordering.instance.json +85 -19
- package/common/ordering.js +1 -1
- package/common/ordering.test.json +786 -298
- package/common/people.instance.json +59 -56
- package/common/people.js +6 -4
- package/common/people.test.json +4135 -3606
- package/common/pipboy.instance.json +72 -16
- package/common/pipboy.js +2 -3
- package/common/pokemon.instance.json +8 -8
- package/common/pokemon.js +1 -1
- package/common/pressure.instance.json +2 -2
- package/common/properties.instance.json +1 -1
- package/common/properties.js +22 -4
- package/common/reminders.instance.json +4 -4
- package/common/reminders.js +3 -3
- package/common/reports.instance.json +3 -3
- package/common/reports.js +18 -16
- package/common/scorekeeper.js +6 -6
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +1 -1
- package/common/stgame.js +1 -1
- package/common/stm.js +4 -4
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +2 -2
- package/common/tester.js +3 -3
- package/common/time.js +3 -3
- package/common/tokenize.js +5 -2
- package/common/weight.instance.json +2 -2
- package/common/wp.instance.json +136 -8
- package/common/wp.js +4 -4
- package/package.json +6 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"apply": "({config}) => {\n config.addArgs(({config, api, isA}) => ({\n addLatinNoun: ({ id, nominative, genetive, development }) => {\n config.addOperator({ pattern: `([${id}|])`, development: development })\n config.addBridge({ id, isA: ['hierarchiable'] })\n const declensions = getDeclensions(nominative, genetive)\n for (const declension of declensions) {\n config.addWord(declension.word, { id, initial: { ...declension, development } })\n }\n }\n }))\n }"
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
"apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus',
|
|
7
|
+
"apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus', scope: \"testing\" })\n addLatinNoun({ id: 'titus_person', nominative: 'titus', scope: \"testing\" })\n addLatinNoun({ id: 'pear_food', nominative: 'pirum', scope: \"testing\" })\n addLatinNoun({ id: 'table_latin', nominative: 'mensa', scope: \"testing\" })\n }"
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"operators": [
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
"apply": "({config}) => {\n config.addArgs(({config, api, isA}) => ({\n addLatinNoun: ({ id, nominative, genetive, development }) => {\n config.addOperator({ pattern: `([${id}|])`, development: development })\n config.addBridge({ id, isA: ['hierarchiable'] })\n const declensions = getDeclensions(nominative, genetive)\n for (const declension of declensions) {\n config.addWord(declension.word, { id, initial: { ...declension, development } })\n }\n }\n }))\n }"
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
|
-
"apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus',
|
|
241
|
+
"apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus', scope: \"testing\" })\n addLatinNoun({ id: 'titus_person', nominative: 'titus', scope: \"testing\" })\n addLatinNoun({ id: 'pear_food', nominative: 'pirum', scope: \"testing\" })\n addLatinNoun({ id: 'table_latin', nominative: 'mensa', scope: \"testing\" })\n }"
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
"extraConfig": true,
|
package/common/latin.js
CHANGED
|
@@ -159,10 +159,10 @@ const template = {
|
|
|
159
159
|
}))
|
|
160
160
|
},
|
|
161
161
|
({addLatinNoun}) => {
|
|
162
|
-
addLatinNoun({ id: 'davus_person', nominative: 'davus',
|
|
163
|
-
addLatinNoun({ id: 'titus_person', nominative: 'titus',
|
|
164
|
-
addLatinNoun({ id: 'pear_food', nominative: 'pirum',
|
|
165
|
-
addLatinNoun({ id: 'table_latin', nominative: 'mensa',
|
|
162
|
+
addLatinNoun({ id: 'davus_person', nominative: 'davus', scope: "testing" })
|
|
163
|
+
addLatinNoun({ id: 'titus_person', nominative: 'titus', scope: "testing" })
|
|
164
|
+
addLatinNoun({ id: 'pear_food', nominative: 'pirum', scope: "testing" })
|
|
165
|
+
addLatinNoun({ id: 'table_latin', nominative: 'mensa', scope: "testing" })
|
|
166
166
|
},
|
|
167
167
|
config,
|
|
168
168
|
({addSuffix}) => addSuffix('que'),
|
|
@@ -1123,7 +1123,7 @@
|
|
|
1123
1123
|
"word": "length",
|
|
1124
1124
|
"range": {
|
|
1125
1125
|
"start": 0,
|
|
1126
|
-
"end":
|
|
1126
|
+
"end": 5
|
|
1127
1127
|
},
|
|
1128
1128
|
"dead": true,
|
|
1129
1129
|
"types": [
|
|
@@ -2756,7 +2756,7 @@
|
|
|
2756
2756
|
"text": "meter centimeter foot and inch",
|
|
2757
2757
|
"range": {
|
|
2758
2758
|
"start": 0,
|
|
2759
|
-
"end":
|
|
2759
|
+
"end": 29
|
|
2760
2760
|
},
|
|
2761
2761
|
"types": [
|
|
2762
2762
|
"list",
|
package/common/listener.js
CHANGED
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"([divideByExpression|])",
|
|
17
17
|
{
|
|
18
18
|
"pattern": "([x])",
|
|
19
|
-
"
|
|
19
|
+
"scope": "testing"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"pattern": "([y])",
|
|
23
|
-
"
|
|
23
|
+
"scope": "testing"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
26
26
|
"bridges": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
],
|
|
48
48
|
"level": 0,
|
|
49
49
|
"bridge": "{ ...next(operator) }",
|
|
50
|
-
"
|
|
50
|
+
"scope": "testing"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"id": "y",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
],
|
|
57
57
|
"level": 0,
|
|
58
58
|
"bridge": "{ ...next(operator) }",
|
|
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
|
}
|
|
@@ -1088,11 +1088,11 @@
|
|
|
1088
1088
|
"([divideByExpression|])",
|
|
1089
1089
|
{
|
|
1090
1090
|
"pattern": "([x])",
|
|
1091
|
-
"
|
|
1091
|
+
"scope": "testing"
|
|
1092
1092
|
},
|
|
1093
1093
|
{
|
|
1094
1094
|
"pattern": "([y])",
|
|
1095
|
-
"
|
|
1095
|
+
"scope": "testing"
|
|
1096
1096
|
}
|
|
1097
1097
|
],
|
|
1098
1098
|
"bridges": [
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
],
|
|
1120
1120
|
"level": 0,
|
|
1121
1121
|
"bridge": "{ ...next(operator) }",
|
|
1122
|
-
"
|
|
1122
|
+
"scope": "testing"
|
|
1123
1123
|
},
|
|
1124
1124
|
{
|
|
1125
1125
|
"id": "y",
|
|
@@ -1128,10 +1128,10 @@
|
|
|
1128
1128
|
],
|
|
1129
1129
|
"level": 0,
|
|
1130
1130
|
"bridge": "{ ...next(operator) }",
|
|
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: [
|
|
@@ -82,8 +83,8 @@ const config = {
|
|
|
82
83
|
"([minusExpression|])",
|
|
83
84
|
"([timesExpression|])",
|
|
84
85
|
"([divideByExpression|])",
|
|
85
|
-
{ pattern: "([x])",
|
|
86
|
-
{ pattern: "([y])",
|
|
86
|
+
{ pattern: "([x])", scope: "testing" },
|
|
87
|
+
{ pattern: "([y])", scope: "testing" },
|
|
87
88
|
],
|
|
88
89
|
bridges: [
|
|
89
90
|
{
|
|
@@ -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) }',
|
|
100
|
-
{ id: "y", isA: ['number'], level: 0, bridge: '{ ...next(operator) }',
|
|
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
|
|