tpmkms_4wp 9.5.1-beta.3 → 9.5.1-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +112 -102
  3. package/common/avatar.test.json +1001 -860
  4. package/common/can.instance.json +2174 -0
  5. package/common/can.js +254 -0
  6. package/common/can.test.json +51307 -0
  7. package/common/characters.js +3 -3
  8. package/common/colors.instance.json +10 -10
  9. package/common/comparable.instance.json +2 -2
  10. package/common/concept.js +19 -22
  11. package/common/concept.test.json +54 -40
  12. package/common/conjunction.js +13 -5
  13. package/common/conjunction.test.json +32 -42
  14. package/common/crew.instance.json +164 -150
  15. package/common/crew.js +1 -1
  16. package/common/currency.js +1 -1
  17. package/common/dateTimeSelectors.instance.json +2 -2
  18. package/common/dateTimeSelectors.js +3 -3
  19. package/common/dateTimeSelectors.test.json +76935 -35739
  20. package/common/dates.instance.json +3 -3
  21. package/common/dates.test.json +284 -287
  22. package/common/dialogues.js +41 -119
  23. package/common/dialogues.test.json +1171 -996
  24. package/common/dimension.instance.json +21374 -562
  25. package/common/dimension.js +145 -51
  26. package/common/dimension.test.json +8753 -3495
  27. package/common/drone.instance.json +23710 -0
  28. package/common/drone.js +429 -0
  29. package/common/drone.test.json +61113 -0
  30. package/common/edible.instance.json +23 -95
  31. package/common/emotions.instance.json +53 -80
  32. package/common/emotions.js +1 -1
  33. package/common/english_helpers.js +277 -67
  34. package/common/fastfood.instance.json +180 -372
  35. package/common/fastfood.js +4 -4
  36. package/common/fastfood.test.json +6970 -6829
  37. package/common/formulas.instance.json +1 -1
  38. package/common/gdefaults.js +94 -17
  39. package/common/help.js +11 -11
  40. package/common/help.test.json +65 -11
  41. package/common/helpers/concept.js +1 -1
  42. package/common/helpers/conjunction.js +54 -44
  43. package/common/helpers/dateTimeSelectors.js +2 -2
  44. package/common/helpers/dialogues.js +7 -2
  45. package/common/helpers/formulas.js +13 -11
  46. package/common/helpers/menus.js +12 -12
  47. package/common/helpers/meta.js +8 -8
  48. package/common/helpers/properties.js +104 -23
  49. package/common/helpers.js +114 -48
  50. package/common/hierarchy.js +6 -4
  51. package/common/kirk.instance.json +1 -1
  52. package/common/kirk.test.json +600 -424
  53. package/common/latin.instance.json +10 -10
  54. package/common/latin.js +5 -5
  55. package/common/length.instance.json +27612 -2890
  56. package/common/length.js +6 -1
  57. package/common/length.test.json +45315 -3925
  58. package/common/math.instance.json +20 -20
  59. package/common/math.js +45 -44
  60. package/common/menus.instance.json +6 -9
  61. package/common/menus.js +2 -9
  62. package/common/meta.js +50 -33
  63. package/common/nameable.js +13 -6
  64. package/common/nameable.test.json +436 -0
  65. package/common/numbers.js +1 -1
  66. package/common/ordering.instance.json +20 -30
  67. package/common/ordering.js +1 -1
  68. package/common/ordering.test.json +414 -426
  69. package/common/people.instance.json +82 -348
  70. package/common/people.js +1 -1
  71. package/common/people.test.json +952 -681
  72. package/common/pipboy.instance.json +16 -16
  73. package/common/pokemon.instance.json +8 -8
  74. package/common/pokemon.js +1 -1
  75. package/common/pressure.instance.json +3579 -1610
  76. package/common/pressure.test.json +433 -477
  77. package/common/properties.instance.json +6 -17
  78. package/common/properties.js +19 -6
  79. package/common/properties.test.json +8746 -6638
  80. package/common/rates.instance.json +59 -0
  81. package/common/rates.js +97 -0
  82. package/common/rates.test.json +27702 -0
  83. package/common/reminders.js +1 -1
  84. package/common/reminders.test.json +64635 -25787
  85. package/common/reports.instance.json +3 -3
  86. package/common/reports.js +18 -16
  87. package/common/scorekeeper.js +4 -4
  88. package/common/sdefaults.js +22 -2
  89. package/common/spock.instance.json +1 -1
  90. package/common/spock.test.json +606 -430
  91. package/common/stgame.js +1 -1
  92. package/common/stm.js +15 -4
  93. package/common/tell.js +1 -1
  94. package/common/temperature.instance.json +3786 -1705
  95. package/common/temperature.test.json +433 -477
  96. package/common/tester.js +3 -3
  97. package/common/time.instance.json +24762 -0
  98. package/common/time.js +137 -141
  99. package/common/time.test.json +31876 -3757
  100. package/common/tokenize.js +1 -1
  101. package/common/ui.instance.json +2 -5
  102. package/common/ui.js +1 -8
  103. package/common/weight.instance.json +10359 -4077
  104. package/common/weight.test.json +2601 -2263
  105. package/common/words.instance.json +9 -0
  106. package/common/words.js +53 -0
  107. package/common/words.test.json +2 -0
  108. package/common/wp.instance.json +336 -8
  109. package/common/wp.js +8 -4
  110. package/common/wp.test.json +7385 -6906
  111. package/main.js +4 -2
  112. package/package.json +18 -5
  113. package/common/listener.js +0 -50
  114. 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:32",
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:44",
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 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 }"
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:32",
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:44",
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 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 }"
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:32",
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:44",
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 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 }"
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:32",
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:44",
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 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 }"
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:32",
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:44",
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:32",
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:44",
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:32",
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:44",
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:32",
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:44",
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
- const toValue = (context) => {
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
- const mathematicalOperator = (name, words, apply, before = []) => [
31
- {
32
- where: where(),
33
- id: `${name}Operator`, level: 0,
34
- 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 }` ,
35
- // bridge: `{ ...next(operator), marker: next(operator('${name}Expression')), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }` ,
36
- isA: ['mathematical_operator'],
37
- before,
38
- localHierarchy: [ ['unknown', 'number'] ],
39
- // levelSpecificHierarchy: [[1, 'mathematicalExpression']],
40
- words,
41
- generatorp: ({context}) => context.word,
42
- },
43
- {
44
- where: where(),
45
- id: `${name}Expression`, level: 0,
46
- bridge: "{ ...next(operator) }" ,
47
- isA: ['mathematicalExpression'],
48
- generatorp: async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`,
49
- evaluator: async ({e, context}) => {
50
- const x = toValue(await e(context.x))
51
- const y = toValue(await e(context.y))
52
- if (!x || !y) {
53
- // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
54
- context.isResponse = false
55
- } else {
56
- context.evalue = apply(x, y)
57
- context.evalue.isResponse = true
58
- context.evalue.paraphrase = false
59
- // context.paraphrase = false
60
- // context.isResponse = true
61
- }
62
- /*
63
- if (!context.value) {
64
- context.isResponse = false
65
- context.paraphrase = true
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]]),
@@ -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 value = context\n const fragment = fragments(\"show showable\")\n const mappings = [{\n where: where(),\n match: ({context}) => context.value == 'showable_menus',\n apply: ({context}) => Object.assign(context, value),\n }]\n const instantiation = await fragment.instantiate(mappings)\n await s(instantiation)\n }"
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
  },
@@ -2075,7 +2075,7 @@
2075
2075
  "word": "menu",
2076
2076
  "range": {
2077
2077
  "start": 0,
2078
- "end": 16
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": 16
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": 32
6020
+ "end": 19
6021
6021
  },
6022
6022
  "types": [
6023
6023
  "list",
@@ -8839,10 +8839,7 @@
8839
8839
  "level": 1,
8840
8840
  "context_index": 1,
8841
8841
  "topLevel": true,
8842
- "context_id": 2,
8843
- "touchedBy": [
8844
- "menus#call2"
8845
- ]
8842
+ "context_id": 2
8846
8843
  }
8847
8844
  ],
8848
8845
  "generated": [
@@ -8943,7 +8940,7 @@
8943
8940
  "learned_contextual_priorities": [],
8944
8941
  "rtf_associations": [],
8945
8942
  "query": "show showable",
8946
- "skipSemantics": false,
8943
+ "skipSemantics": true,
8947
8944
  "key": {
8948
8945
  "query": "show showable"
8949
8946
  }
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 value = context
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
- const fixtures = async ({api, fragment, s, config, objects, kms, isModule}) => {
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
 
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
- const match = (defContext) => ({context}) => context.marker == (defContext.consequence || {}).marker && context.query // && !context.value
210
- const apply = (DEFINITIONs, DERIVED) => {
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
- const invertMappings = (mappings) => mappings.map( ({ from, to }) => { return { to: from, from: to } } )
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]
@@ -292,6 +296,7 @@ const config = {
292
296
  }
293
297
  if (context.to.value) {
294
298
  kms.stm.api.setVariable(context.from.value, context.to.value)
299
+ // config.addWord(context.from.word, context.to)
295
300
  } else {
296
301
  await kms.dialogues.api.makeObject({ context: context.from, types: context.to.types || [], config });
297
302
  kms.stm.api.setVariable(context.from.value, context.to)
@@ -306,15 +311,21 @@ const config = {
306
311
  apply: async ({config, context, g}) => {
307
312
  // setup the write semantic
308
313
  {
309
- const matchByMarker = (defContext) => ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
310
- const matchByValue = (defContext) => ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
311
- const apply = (mappings, TO) => async ({context, s}) => {
312
- TO = _.cloneDeep(TO)
313
- for (const { from, to } of mappings) {
314
- hashIndexesSet(TO, to, hashIndexesGet(context, from))
314
+ function matchByMarker(defContext) {
315
+ return ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
316
+ }
317
+ function matchByValue(defContext) {
318
+ return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
319
+ }
320
+ function apply(mappings, TO) {
321
+ return async ({context, s}) => {
322
+ TO = _.cloneDeep(TO)
323
+ for (const { from, to } of mappings) {
324
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
325
+ }
326
+ toPrime = await s(TO)
327
+ context.result = toPrime.result
315
328
  }
316
- toPrime = await s(TO)
317
- context.result = toPrime.result
318
329
  }
319
330
  const mappings = translationMapping(context.from, context.to)
320
331
  let match = matchByMarker(context)
@@ -333,30 +344,36 @@ const config = {
333
344
 
334
345
  // setup the read semantic
335
346
  {
336
- const matchByMarker = (defContext) => ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
337
- const matchByValue = (defContext) => ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
338
- const apply = (mappings, TO) => async ({uuid, context, s, g, config}) => {
339
- TO = _.cloneDeep(TO)
340
- for (const { from, to } of mappings) {
341
- hashIndexesSet(TO, to, hashIndexesGet(context, from))
342
- }
343
- // next move add debug arg to s and g
344
- // TODO why is there query and evaluate?
345
- if (context.query) {
346
- TO.query = context.query
347
- } else {
348
- TO.evaluate = context.evaluate
349
- }
350
- TO[`disable${uuid}`] = true
351
- toPrime = await s(TO)
352
- if (context.query) {
353
- if (toPrime.evalue) {
354
- context.evalue = toPrime.evalue
347
+ function matchByMarker(defContext) {
348
+ return ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
349
+ }
350
+ function matchByValue(defContext) {
351
+ return ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
352
+ }
353
+ function apply(mappings, TO) {
354
+ return async ({uuid, context, s, g, config}) => {
355
+ TO = _.cloneDeep(TO)
356
+ for (const { from, to } of mappings) {
357
+ hashIndexesSet(TO, to, hashIndexesGet(context, from))
358
+ }
359
+ // next move add debug arg to s and g
360
+ // TODO why is there query and evaluate?
361
+ if (context.query) {
362
+ TO.query = context.query
363
+ } else {
364
+ TO.evaluate = context.evaluate
365
+ }
366
+ TO[`disable${uuid}`] = true
367
+ toPrime = await s(TO)
368
+ if (context.query) {
369
+ if (toPrime.evalue) {
370
+ context.evalue = toPrime.evalue
371
+ } else {
372
+ context.evalue = toPrime
373
+ }
355
374
  } else {
356
- context.evalue = toPrime
375
+ context.evalue = toPrime.evalue
357
376
  }
358
- } else {
359
- context.evalue = toPrime.evalue
360
377
  }
361
378
  }
362
379
  const mappings = translationMapping(context.from, context.to)
@@ -1,5 +1,5 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck } = require('./helpers')
2
+ const { defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
3
3
  const helpers = require('./helpers')
4
4
  const stm = require('./stm')
5
5
  const nameable_tests = require('./nameable.test.json')
@@ -107,19 +107,26 @@ const config = {
107
107
  id: 'call',
108
108
  isA: ['verb'],
109
109
  bridge: "{ ...next(operator), nameable: after[0], name: after[1:][0] }",
110
- // bridge: "{ ...next(operator), nameable: after[0], name: after[1] }",
111
- // generatorp: async ({context, g}) => `call ${await g(context.nameable)} ${await g(context.name)}`,
112
110
  generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
113
- semantic: async ({config, context, api, e}) => {
111
+ semantic: async ({config, context, api, e, verbatim, g}) => {
114
112
  // TODO find report being referred to
115
113
  const nameable = (await e(context.nameable)).evalue
114
+ if (!nameable) {
115
+ verbatim(`${await g(context.nameable)} is not known`)
116
+ return
117
+ }
116
118
  const name = context.name.map((n) => n.text).join(' ')
117
119
  // const name = context.name.text
118
120
  config.addWord(name, { id: nameable.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
119
121
  api.setName(nameable, name)
120
- }
122
+ },
123
+ check: defaultContextCheckProperties(['nameable', 'name']),
124
+ },
125
+ {
126
+ id: 'nameable',
127
+ words: helpers.words('nameable'),
128
+ children: ['thisitthat'],
121
129
  },
122
- { id: 'nameable', words: helpers.words('nameable')},
123
130
  ]
124
131
  }
125
132