tpmkms_4wp 9.5.1 → 9.6.0-beta.1
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 +151 -61
- package/common/animals.js +3 -5
- package/common/asking.js +116 -106
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2194 -0
- package/common/can.js +251 -0
- package/common/can.test.json +51307 -0
- package/common/characters.js +5 -5
- package/common/colors.instance.json +152 -12
- package/common/colors.js +3 -6
- package/common/comparable.instance.json +33 -3
- package/common/comparable.js +3 -6
- package/common/concept.js +25 -27
- package/common/concept.test.json +180 -144
- package/common/conjunction.js +13 -5
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +433 -173
- package/common/crew.js +4 -7
- package/common/crew.test.json +4148 -3324
- package/common/currency.js +1 -1
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +6 -9
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +53 -3
- package/common/dates.js +3 -6
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +43 -122
- package/common/dialogues.test.json +1248 -1152
- package/common/dimension.instance.json +21493 -561
- package/common/dimension.js +150 -55
- package/common/dimension.test.json +10979 -4625
- package/common/drone.instance.json +24709 -0
- package/common/drone.js +662 -0
- package/common/drone.test.json +30522 -0
- package/common/drone_v1.instance.json +24703 -0
- package/common/drone_v1.js +596 -0
- package/common/drone_v1.test.json +115538 -0
- package/common/edible.instance.json +388 -32
- package/common/edible.js +3 -5
- package/common/emotions.instance.json +85 -76
- package/common/emotions.js +4 -7
- package/common/emotions.test.json +242 -174
- package/common/english_helpers.js +336 -0
- package/common/errors.js +6 -6
- package/common/evaluate.js +2 -2
- package/common/events.js +8 -8
- package/common/fastfood.instance.json +1071 -393
- package/common/fastfood.js +14 -16
- package/common/fastfood.test.json +6970 -6829
- package/common/formulas.instance.json +11 -1
- package/common/formulas.js +3 -2
- package/common/gdefaults.js +111 -17
- package/common/help.js +12 -12
- 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 +10 -2
- 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 +186 -64
- package/common/helpers.js +167 -48
- package/common/hierarchy.js +12 -10
- package/common/kirk.instance.json +11 -1
- package/common/kirk.js +4 -6
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +12 -12
- package/common/latin.js +12 -14
- package/common/length.instance.json +34660 -3158
- package/common/length.js +11 -6
- package/common/length.test.json +54357 -2557
- package/common/math.instance.json +39 -29
- package/common/math.js +49 -47
- package/common/menus.instance.json +77 -10
- package/common/menus.js +4 -13
- package/common/meta.js +80 -65
- package/common/nameable.js +36 -22
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +107 -19
- package/common/ordering.js +4 -6
- package/common/ordering.test.json +835 -417
- package/common/people.instance.json +176 -348
- package/common/people.js +9 -9
- package/common/people.test.json +4135 -3606
- package/common/pipboy.instance.json +187 -17
- package/common/pipboy.js +4 -4
- package/common/pokemon.instance.json +143 -13
- package/common/pokemon.js +4 -6
- package/common/pressure.instance.json +3610 -1601
- package/common/pressure.js +3 -5
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +16 -17
- package/common/properties.js +32 -13
- package/common/properties.test.json +9565 -6951
- package/common/rates.instance.json +59 -0
- package/common/rates.js +95 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.instance.json +4 -4
- package/common/reminders.js +8 -11
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +23 -3
- package/common/reports.js +21 -21
- package/common/scorekeeper.js +9 -12
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +11 -1
- package/common/spock.js +4 -7
- package/common/spock.test.json +606 -430
- package/common/stgame.js +1 -1
- package/common/stm.js +41 -24
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +3163 -1154
- package/common/temperature.js +3 -5
- package/common/temperature.test.json +433 -477
- package/common/tester.js +3 -3
- package/common/time.instance.json +24852 -0
- package/common/time.js +138 -141
- package/common/time.test.json +31876 -3757
- package/common/tokenize.js +5 -2
- package/common/ui.instance.json +12 -5
- package/common/ui.js +4 -13
- package/common/weight.instance.json +10501 -4099
- package/common/weight.js +3 -5
- package/common/weight.test.json +2601 -2263
- package/common/words.instance.json +9 -0
- package/common/words.js +50 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +548 -8
- package/common/wp.js +10 -8
- package/common/wp.test.json +7385 -6906
- package/main.js +6 -2
- package/package.json +25 -6
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
|
@@ -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
|
}
|
|
@@ -719,6 +719,16 @@
|
|
|
719
719
|
"adjective",
|
|
720
720
|
false
|
|
721
721
|
],
|
|
722
|
+
[
|
|
723
|
+
"stm_current",
|
|
724
|
+
"adjective",
|
|
725
|
+
false
|
|
726
|
+
],
|
|
727
|
+
[
|
|
728
|
+
"stm_previous",
|
|
729
|
+
"adjective",
|
|
730
|
+
false
|
|
731
|
+
],
|
|
722
732
|
[
|
|
723
733
|
"that",
|
|
724
734
|
"thisitthat",
|
|
@@ -878,7 +888,7 @@
|
|
|
878
888
|
"end": 29
|
|
879
889
|
},
|
|
880
890
|
"dead": true,
|
|
881
|
-
"
|
|
891
|
+
"conceptModifiers": [
|
|
882
892
|
{
|
|
883
893
|
"value": "mathematical",
|
|
884
894
|
"unknown": true,
|
|
@@ -1088,11 +1098,11 @@
|
|
|
1088
1098
|
"([divideByExpression|])",
|
|
1089
1099
|
{
|
|
1090
1100
|
"pattern": "([x])",
|
|
1091
|
-
"
|
|
1101
|
+
"scope": "testing"
|
|
1092
1102
|
},
|
|
1093
1103
|
{
|
|
1094
1104
|
"pattern": "([y])",
|
|
1095
|
-
"
|
|
1105
|
+
"scope": "testing"
|
|
1096
1106
|
}
|
|
1097
1107
|
],
|
|
1098
1108
|
"bridges": [
|
|
@@ -1119,7 +1129,7 @@
|
|
|
1119
1129
|
],
|
|
1120
1130
|
"level": 0,
|
|
1121
1131
|
"bridge": "{ ...next(operator) }",
|
|
1122
|
-
"
|
|
1132
|
+
"scope": "testing"
|
|
1123
1133
|
},
|
|
1124
1134
|
{
|
|
1125
1135
|
"id": "y",
|
|
@@ -1128,10 +1138,10 @@
|
|
|
1128
1138
|
],
|
|
1129
1139
|
"level": 0,
|
|
1130
1140
|
"bridge": "{ ...next(operator) }",
|
|
1131
|
-
"
|
|
1141
|
+
"scope": "testing"
|
|
1132
1142
|
},
|
|
1133
1143
|
{
|
|
1134
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1144
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1135
1145
|
"id": "plusOperator",
|
|
1136
1146
|
"level": 0,
|
|
1137
1147
|
"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 +1161,7 @@
|
|
|
1151
1161
|
]
|
|
1152
1162
|
},
|
|
1153
1163
|
{
|
|
1154
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1164
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1155
1165
|
"id": "plusExpression",
|
|
1156
1166
|
"level": 0,
|
|
1157
1167
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1160,7 +1170,7 @@
|
|
|
1160
1170
|
]
|
|
1161
1171
|
},
|
|
1162
1172
|
{
|
|
1163
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1173
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1164
1174
|
"id": "minusOperator",
|
|
1165
1175
|
"level": 0,
|
|
1166
1176
|
"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 +1190,7 @@
|
|
|
1180
1190
|
]
|
|
1181
1191
|
},
|
|
1182
1192
|
{
|
|
1183
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1193
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1184
1194
|
"id": "minusExpression",
|
|
1185
1195
|
"level": 0,
|
|
1186
1196
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1189,7 +1199,7 @@
|
|
|
1189
1199
|
]
|
|
1190
1200
|
},
|
|
1191
1201
|
{
|
|
1192
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1202
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1193
1203
|
"id": "timesOperator",
|
|
1194
1204
|
"level": 0,
|
|
1195
1205
|
"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 +1228,7 @@
|
|
|
1218
1228
|
]
|
|
1219
1229
|
},
|
|
1220
1230
|
{
|
|
1221
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1231
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1222
1232
|
"id": "timesExpression",
|
|
1223
1233
|
"level": 0,
|
|
1224
1234
|
"bridge": "{ ...next(operator) }",
|
|
@@ -1227,7 +1237,7 @@
|
|
|
1227
1237
|
]
|
|
1228
1238
|
},
|
|
1229
1239
|
{
|
|
1230
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1240
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
1231
1241
|
"id": "divideByOperator",
|
|
1232
1242
|
"level": 0,
|
|
1233
1243
|
"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 +1265,7 @@
|
|
|
1255
1265
|
]
|
|
1256
1266
|
},
|
|
1257
1267
|
{
|
|
1258
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:
|
|
1268
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45",
|
|
1259
1269
|
"id": "divideByExpression",
|
|
1260
1270
|
"level": 0,
|
|
1261
1271
|
"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]]),
|
|
@@ -119,7 +120,8 @@ knowledgeModule( {
|
|
|
119
120
|
|
|
120
121
|
module,
|
|
121
122
|
description: 'talking about math',
|
|
122
|
-
|
|
123
|
+
instance,
|
|
124
|
+
template,
|
|
123
125
|
test: {
|
|
124
126
|
name: './math.test.json',
|
|
125
127
|
contents: tests,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"semantics": [
|
|
44
44
|
{
|
|
45
45
|
"match": "({context, isA}) => isA(context, 'showable_menus')",
|
|
46
|
-
"apply": "async ({context, insert, s, fragments}) => {\n const
|
|
46
|
+
"apply": "async ({context, insert, s, fragments}) => {\n const instantiation = await fragments(\"show showable\", { 'showable_menus': context })\n await s(instantiation)\n }"
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
49
|
},
|
|
@@ -807,6 +807,16 @@
|
|
|
807
807
|
"adjective",
|
|
808
808
|
false
|
|
809
809
|
],
|
|
810
|
+
[
|
|
811
|
+
"stm_current",
|
|
812
|
+
"adjective",
|
|
813
|
+
false
|
|
814
|
+
],
|
|
815
|
+
[
|
|
816
|
+
"stm_previous",
|
|
817
|
+
"adjective",
|
|
818
|
+
false
|
|
819
|
+
],
|
|
810
820
|
[
|
|
811
821
|
"stop",
|
|
812
822
|
"verb",
|
|
@@ -1861,6 +1871,16 @@
|
|
|
1861
1871
|
"adjective",
|
|
1862
1872
|
false
|
|
1863
1873
|
],
|
|
1874
|
+
[
|
|
1875
|
+
"stm_current",
|
|
1876
|
+
"adjective",
|
|
1877
|
+
false
|
|
1878
|
+
],
|
|
1879
|
+
[
|
|
1880
|
+
"stm_previous",
|
|
1881
|
+
"adjective",
|
|
1882
|
+
false
|
|
1883
|
+
],
|
|
1864
1884
|
[
|
|
1865
1885
|
"stop",
|
|
1866
1886
|
"verb",
|
|
@@ -2075,7 +2095,7 @@
|
|
|
2075
2095
|
"word": "menu",
|
|
2076
2096
|
"range": {
|
|
2077
2097
|
"start": 0,
|
|
2078
|
-
"end":
|
|
2098
|
+
"end": 3
|
|
2079
2099
|
},
|
|
2080
2100
|
"dead": true,
|
|
2081
2101
|
"types": [
|
|
@@ -3139,6 +3159,16 @@
|
|
|
3139
3159
|
"adjective",
|
|
3140
3160
|
false
|
|
3141
3161
|
],
|
|
3162
|
+
[
|
|
3163
|
+
"stm_current",
|
|
3164
|
+
"adjective",
|
|
3165
|
+
false
|
|
3166
|
+
],
|
|
3167
|
+
[
|
|
3168
|
+
"stm_previous",
|
|
3169
|
+
"adjective",
|
|
3170
|
+
false
|
|
3171
|
+
],
|
|
3142
3172
|
[
|
|
3143
3173
|
"stop",
|
|
3144
3174
|
"verb",
|
|
@@ -3353,7 +3383,7 @@
|
|
|
3353
3383
|
"word": "item",
|
|
3354
3384
|
"range": {
|
|
3355
3385
|
"start": 0,
|
|
3356
|
-
"end":
|
|
3386
|
+
"end": 3
|
|
3357
3387
|
},
|
|
3358
3388
|
"dead": true,
|
|
3359
3389
|
"types": [
|
|
@@ -4457,6 +4487,16 @@
|
|
|
4457
4487
|
"adjective",
|
|
4458
4488
|
false
|
|
4459
4489
|
],
|
|
4490
|
+
[
|
|
4491
|
+
"stm_current",
|
|
4492
|
+
"adjective",
|
|
4493
|
+
false
|
|
4494
|
+
],
|
|
4495
|
+
[
|
|
4496
|
+
"stm_previous",
|
|
4497
|
+
"adjective",
|
|
4498
|
+
false
|
|
4499
|
+
],
|
|
4460
4500
|
[
|
|
4461
4501
|
"stop",
|
|
4462
4502
|
"verb",
|
|
@@ -4651,7 +4691,7 @@
|
|
|
4651
4691
|
"end": 17
|
|
4652
4692
|
},
|
|
4653
4693
|
"dead": true,
|
|
4654
|
-
"
|
|
4694
|
+
"conceptModifiers": [
|
|
4655
4695
|
{
|
|
4656
4696
|
"value": "menu_menus",
|
|
4657
4697
|
"number": "one",
|
|
@@ -5746,6 +5786,16 @@
|
|
|
5746
5786
|
"adjective",
|
|
5747
5787
|
false
|
|
5748
5788
|
],
|
|
5789
|
+
[
|
|
5790
|
+
"stm_current",
|
|
5791
|
+
"adjective",
|
|
5792
|
+
false
|
|
5793
|
+
],
|
|
5794
|
+
[
|
|
5795
|
+
"stm_previous",
|
|
5796
|
+
"adjective",
|
|
5797
|
+
false
|
|
5798
|
+
],
|
|
5749
5799
|
[
|
|
5750
5800
|
"stop",
|
|
5751
5801
|
"verb",
|
|
@@ -6017,7 +6067,7 @@
|
|
|
6017
6067
|
"text": "menus and menu items",
|
|
6018
6068
|
"range": {
|
|
6019
6069
|
"start": 0,
|
|
6020
|
-
"end":
|
|
6070
|
+
"end": 19
|
|
6021
6071
|
},
|
|
6022
6072
|
"types": [
|
|
6023
6073
|
"list",
|
|
@@ -7488,6 +7538,16 @@
|
|
|
7488
7538
|
"adjective",
|
|
7489
7539
|
false
|
|
7490
7540
|
],
|
|
7541
|
+
[
|
|
7542
|
+
"stm_current",
|
|
7543
|
+
"adjective",
|
|
7544
|
+
false
|
|
7545
|
+
],
|
|
7546
|
+
[
|
|
7547
|
+
"stm_previous",
|
|
7548
|
+
"adjective",
|
|
7549
|
+
false
|
|
7550
|
+
],
|
|
7491
7551
|
[
|
|
7492
7552
|
"stop",
|
|
7493
7553
|
"verb",
|
|
@@ -8639,6 +8699,16 @@
|
|
|
8639
8699
|
"adjective",
|
|
8640
8700
|
false
|
|
8641
8701
|
],
|
|
8702
|
+
[
|
|
8703
|
+
"stm_current",
|
|
8704
|
+
"adjective",
|
|
8705
|
+
false
|
|
8706
|
+
],
|
|
8707
|
+
[
|
|
8708
|
+
"stm_previous",
|
|
8709
|
+
"adjective",
|
|
8710
|
+
false
|
|
8711
|
+
],
|
|
8642
8712
|
[
|
|
8643
8713
|
"stop",
|
|
8644
8714
|
"verb",
|
|
@@ -8839,10 +8909,7 @@
|
|
|
8839
8909
|
"level": 1,
|
|
8840
8910
|
"context_index": 1,
|
|
8841
8911
|
"topLevel": true,
|
|
8842
|
-
"context_id": 2
|
|
8843
|
-
"touchedBy": [
|
|
8844
|
-
"menus#call2"
|
|
8845
|
-
]
|
|
8912
|
+
"context_id": 2
|
|
8846
8913
|
}
|
|
8847
8914
|
],
|
|
8848
8915
|
"generated": [
|
|
@@ -8943,7 +9010,7 @@
|
|
|
8943
9010
|
"learned_contextual_priorities": [],
|
|
8944
9011
|
"rtf_associations": [],
|
|
8945
9012
|
"query": "show showable",
|
|
8946
|
-
"skipSemantics":
|
|
9013
|
+
"skipSemantics": true,
|
|
8947
9014
|
"key": {
|
|
8948
9015
|
"query": "show showable"
|
|
8949
9016
|
}
|
package/common/menus.js
CHANGED
|
@@ -156,14 +156,7 @@ const template = {
|
|
|
156
156
|
where: where(),
|
|
157
157
|
match: ({context, isA}) => isA(context, 'showable_menus'),
|
|
158
158
|
apply: async ({context, insert, s, fragments}) => {
|
|
159
|
-
const
|
|
160
|
-
const fragment = fragments("show showable")
|
|
161
|
-
const mappings = [{
|
|
162
|
-
where: where(),
|
|
163
|
-
match: ({context}) => context.value == 'showable_menus',
|
|
164
|
-
apply: ({context}) => Object.assign(context, value),
|
|
165
|
-
}]
|
|
166
|
-
const instantiation = await fragment.instantiate(mappings)
|
|
159
|
+
const instantiation = await fragments("show showable", { 'showable_menus': context })
|
|
167
160
|
await s(instantiation)
|
|
168
161
|
}
|
|
169
162
|
},
|
|
@@ -214,7 +207,7 @@ class UIAPI {
|
|
|
214
207
|
file (<- instance of menu) menu (<- concept of menu)
|
|
215
208
|
*/
|
|
216
209
|
// called for the non-module load to setup fixtures
|
|
217
|
-
|
|
210
|
+
async function fixtures({api, fragment, s, config, objects, kms, isModule}) {
|
|
218
211
|
const fileMenuId = api.addMenu('file')
|
|
219
212
|
const objectMenuId = api.addMenu('object')
|
|
220
213
|
|
|
@@ -256,8 +249,6 @@ knowledgeModule({
|
|
|
256
249
|
],
|
|
257
250
|
},
|
|
258
251
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
instance,
|
|
262
|
-
}
|
|
252
|
+
instance,
|
|
253
|
+
template,
|
|
263
254
|
})
|