tpmkms 9.8.0 → 9.9.0
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/actions.instance.json +10 -8
- package/common/actions.js +13 -11
- package/common/angle.instance.json +25 -17
- package/common/animals.instance.json +54 -28
- package/common/askfor.instance.json +89 -192
- package/common/askfor.js +49 -12
- package/common/asking.js +13 -5
- package/common/avatar.js +3 -3
- package/common/can.instance.json +32 -20
- package/common/can.js +2 -2
- package/common/colors.instance.json +44 -16
- package/common/colors.js +1 -1
- package/common/comparable.instance.json +25 -22
- package/common/compass.instance.json +9 -3
- package/common/concept.instance.json +14 -6
- package/common/concept.js +2 -0
- package/common/conjunction.js +17 -9
- package/common/control.js +10 -18
- package/common/countable.js +4 -3
- package/common/crew.instance.json +95 -27
- package/common/dateTimeSelectors.instance.json +4 -4
- package/common/dateTimeSelectors.js +4 -7
- package/common/dates.instance.json +52 -28
- package/common/dates.js +16 -11
- package/common/debug.instance.json +48 -0
- package/common/debug.js +50 -0
- package/common/debug.test.json +1 -0
- package/common/dialogues.js +126 -70
- package/common/dimension.instance.json +239 -495
- package/common/dimension.js +51 -9
- package/common/drone.instance.json +395 -84
- package/common/drone.js +43 -50
- package/common/drone_v1.instance.json +36 -12
- package/common/drone_v1.js +14 -9
- package/common/edible.instance.json +96 -32
- package/common/emotions.instance.json +15 -1
- package/common/evaluate.js +10 -13
- package/common/fastfood.instance.json +282 -100
- package/common/fastfood.js +30 -15
- package/common/formulas.instance.json +162 -24
- package/common/formulas.js +18 -9
- package/common/gdefaults.js +20 -96
- package/common/helpers/concept.js +2 -9
- package/common/helpers/conjunction.js +11 -1
- package/common/helpers/dialogues.js +48 -24
- package/common/helpers/gdefaults.js +15 -5
- package/common/helpers/properties.js +125 -326
- package/common/helpers.js +28 -58
- package/common/hierarchy.js +71 -41
- package/common/kirk.instance.json +3 -1
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +247 -61
- package/common/math.instance.json +144 -5
- package/common/math.js +18 -5
- package/common/menus.instance.json +29 -11
- package/common/menus.js +8 -5
- package/common/meta.js +14 -13
- package/common/nameable.js +9 -5
- package/common/numbers.instance.json +5 -3
- package/common/numbers.js +28 -28
- package/common/ordering.instance.json +53 -4
- package/common/ordinals.js +25 -25
- package/common/people.instance.json +66 -12
- package/common/percentages.js +4 -2
- package/common/pipboy.instance.json +89 -44
- package/common/pipboy.js +21 -14
- package/common/pokemon.instance.json +39 -13
- package/common/pressure.instance.json +14 -6
- package/common/properties.instance.json +2370 -511
- package/common/properties.js +496 -78
- package/common/punctuation.js +1 -0
- package/common/rates.instance.json +2 -2
- package/common/rates.js +3 -3
- package/common/reminders.instance.json +16 -0
- package/common/reminders.js +24 -20
- package/common/reports.instance.json +11 -12
- package/common/reports.js +12 -12
- package/common/scorekeeper.js +20 -10
- package/common/sdefaults.js +30 -9
- package/common/spock.instance.json +3 -1
- package/common/stm.js +16 -21
- package/common/temperature.instance.json +19 -11
- package/common/testing.js +2 -2
- package/common/time.instance.json +104 -47
- package/common/time.js +9 -8
- package/common/ui.instance.json +4 -2
- package/common/ui.js +5 -5
- package/common/weight.instance.json +86 -21
- package/common/weight.js +5 -1
- package/common/words.js +113 -2
- package/common/wp.instance.json +125 -18
- package/common/wp.js +6 -2
- package/main.js +2 -0
- package/package.json +7 -3
|
@@ -87,7 +87,23 @@
|
|
|
87
87
|
"isA": [
|
|
88
88
|
"mathematicalExpression"
|
|
89
89
|
],
|
|
90
|
-
"
|
|
90
|
+
"check": [
|
|
91
|
+
"marker",
|
|
92
|
+
"text",
|
|
93
|
+
"verbatim",
|
|
94
|
+
"value",
|
|
95
|
+
"evalue",
|
|
96
|
+
"isResponse",
|
|
97
|
+
{
|
|
98
|
+
"properties": "modifiers"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"properties": "postModifiers"
|
|
102
|
+
},
|
|
103
|
+
"x",
|
|
104
|
+
"y"
|
|
105
|
+
],
|
|
106
|
+
"semantic": "async ({e, context}) => {\n const x = toValue(await e(context.x, where())) \n const y = toValue(await e(context.y, where()))\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 = { marker: 'number', value: apply(x, y) }\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
107
|
},
|
|
92
108
|
{
|
|
93
109
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
@@ -118,7 +134,23 @@
|
|
|
118
134
|
"isA": [
|
|
119
135
|
"mathematicalExpression"
|
|
120
136
|
],
|
|
121
|
-
"
|
|
137
|
+
"check": [
|
|
138
|
+
"marker",
|
|
139
|
+
"text",
|
|
140
|
+
"verbatim",
|
|
141
|
+
"value",
|
|
142
|
+
"evalue",
|
|
143
|
+
"isResponse",
|
|
144
|
+
{
|
|
145
|
+
"properties": "modifiers"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"properties": "postModifiers"
|
|
149
|
+
},
|
|
150
|
+
"x",
|
|
151
|
+
"y"
|
|
152
|
+
],
|
|
153
|
+
"semantic": "async ({e, context}) => {\n const x = toValue(await e(context.x, where())) \n const y = toValue(await e(context.y, where()))\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 = { marker: 'number', value: apply(x, y) }\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 }"
|
|
122
154
|
},
|
|
123
155
|
{
|
|
124
156
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
@@ -158,7 +190,23 @@
|
|
|
158
190
|
"isA": [
|
|
159
191
|
"mathematicalExpression"
|
|
160
192
|
],
|
|
161
|
-
"
|
|
193
|
+
"check": [
|
|
194
|
+
"marker",
|
|
195
|
+
"text",
|
|
196
|
+
"verbatim",
|
|
197
|
+
"value",
|
|
198
|
+
"evalue",
|
|
199
|
+
"isResponse",
|
|
200
|
+
{
|
|
201
|
+
"properties": "modifiers"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"properties": "postModifiers"
|
|
205
|
+
},
|
|
206
|
+
"x",
|
|
207
|
+
"y"
|
|
208
|
+
],
|
|
209
|
+
"semantic": "async ({e, context}) => {\n const x = toValue(await e(context.x, where())) \n const y = toValue(await e(context.y, where()))\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 = { marker: 'number', value: apply(x, y) }\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 }"
|
|
162
210
|
},
|
|
163
211
|
{
|
|
164
212
|
"where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
|
|
@@ -197,7 +245,29 @@
|
|
|
197
245
|
"isA": [
|
|
198
246
|
"mathematicalExpression"
|
|
199
247
|
],
|
|
200
|
-
"
|
|
248
|
+
"check": [
|
|
249
|
+
"marker",
|
|
250
|
+
"text",
|
|
251
|
+
"verbatim",
|
|
252
|
+
"value",
|
|
253
|
+
"evalue",
|
|
254
|
+
"isResponse",
|
|
255
|
+
{
|
|
256
|
+
"properties": "modifiers"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"properties": "postModifiers"
|
|
260
|
+
},
|
|
261
|
+
"x",
|
|
262
|
+
"y"
|
|
263
|
+
],
|
|
264
|
+
"semantic": "async ({e, context}) => {\n const x = toValue(await e(context.x, where())) \n const y = toValue(await e(context.y, where()))\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 = { marker: 'number', value: apply(x, y) }\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 }"
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
"semantics": [
|
|
268
|
+
{
|
|
269
|
+
"match": "({context, isA, callId, isMany}) => {\n return context.marker == 'same' && isA(context.two, 'mathematicalExpression') && !isMany(context.one)\n }",
|
|
270
|
+
"apply": "({context}) => {\n // dont so the other one for is\n }"
|
|
201
271
|
}
|
|
202
272
|
]
|
|
203
273
|
}
|
|
@@ -303,7 +373,6 @@
|
|
|
303
373
|
"level": 1,
|
|
304
374
|
"context_index": 1,
|
|
305
375
|
"topLevel": true,
|
|
306
|
-
"context_id": 2,
|
|
307
376
|
"touchedBy": [
|
|
308
377
|
"math#call2"
|
|
309
378
|
]
|
|
@@ -449,6 +518,9 @@
|
|
|
449
518
|
}
|
|
450
519
|
],
|
|
451
520
|
"learned_contextual_priorities": [],
|
|
521
|
+
"explain_associations_details": [
|
|
522
|
+
null
|
|
523
|
+
],
|
|
452
524
|
"query": "mathematical modifies operator",
|
|
453
525
|
"key": {
|
|
454
526
|
"query": "mathematical modifies operator"
|
|
@@ -539,6 +611,22 @@
|
|
|
539
611
|
"bridge": "{ ...next(operator) }",
|
|
540
612
|
"isA": [
|
|
541
613
|
"mathematicalExpression"
|
|
614
|
+
],
|
|
615
|
+
"check": [
|
|
616
|
+
"marker",
|
|
617
|
+
"text",
|
|
618
|
+
"verbatim",
|
|
619
|
+
"value",
|
|
620
|
+
"evalue",
|
|
621
|
+
"isResponse",
|
|
622
|
+
{
|
|
623
|
+
"properties": "modifiers"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"properties": "postModifiers"
|
|
627
|
+
},
|
|
628
|
+
"x",
|
|
629
|
+
"y"
|
|
542
630
|
]
|
|
543
631
|
},
|
|
544
632
|
{
|
|
@@ -568,6 +656,22 @@
|
|
|
568
656
|
"bridge": "{ ...next(operator) }",
|
|
569
657
|
"isA": [
|
|
570
658
|
"mathematicalExpression"
|
|
659
|
+
],
|
|
660
|
+
"check": [
|
|
661
|
+
"marker",
|
|
662
|
+
"text",
|
|
663
|
+
"verbatim",
|
|
664
|
+
"value",
|
|
665
|
+
"evalue",
|
|
666
|
+
"isResponse",
|
|
667
|
+
{
|
|
668
|
+
"properties": "modifiers"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"properties": "postModifiers"
|
|
672
|
+
},
|
|
673
|
+
"x",
|
|
674
|
+
"y"
|
|
571
675
|
]
|
|
572
676
|
},
|
|
573
677
|
{
|
|
@@ -606,6 +710,22 @@
|
|
|
606
710
|
"bridge": "{ ...next(operator) }",
|
|
607
711
|
"isA": [
|
|
608
712
|
"mathematicalExpression"
|
|
713
|
+
],
|
|
714
|
+
"check": [
|
|
715
|
+
"marker",
|
|
716
|
+
"text",
|
|
717
|
+
"verbatim",
|
|
718
|
+
"value",
|
|
719
|
+
"evalue",
|
|
720
|
+
"isResponse",
|
|
721
|
+
{
|
|
722
|
+
"properties": "modifiers"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"properties": "postModifiers"
|
|
726
|
+
},
|
|
727
|
+
"x",
|
|
728
|
+
"y"
|
|
609
729
|
]
|
|
610
730
|
},
|
|
611
731
|
{
|
|
@@ -643,8 +763,27 @@
|
|
|
643
763
|
"bridge": "{ ...next(operator) }",
|
|
644
764
|
"isA": [
|
|
645
765
|
"mathematicalExpression"
|
|
766
|
+
],
|
|
767
|
+
"check": [
|
|
768
|
+
"marker",
|
|
769
|
+
"text",
|
|
770
|
+
"verbatim",
|
|
771
|
+
"value",
|
|
772
|
+
"evalue",
|
|
773
|
+
"isResponse",
|
|
774
|
+
{
|
|
775
|
+
"properties": "modifiers"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"properties": "postModifiers"
|
|
779
|
+
},
|
|
780
|
+
"x",
|
|
781
|
+
"y"
|
|
646
782
|
]
|
|
647
783
|
}
|
|
784
|
+
],
|
|
785
|
+
"semantics": [
|
|
786
|
+
{}
|
|
648
787
|
]
|
|
649
788
|
}
|
|
650
789
|
],
|
package/common/math.js
CHANGED
|
@@ -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 dialogues = require('./dialogues')
|
|
4
4
|
const numbers = require('./numbers')
|
|
5
5
|
const punctuation = require('./punctuation')
|
|
@@ -47,9 +47,10 @@ function mathematicalOperator(name, words, apply, before = []) {
|
|
|
47
47
|
bridge: "{ ...next(operator) }",
|
|
48
48
|
isA: ['mathematicalExpression'],
|
|
49
49
|
// generatorp: async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
50
|
+
check: defaultContextCheckProperties(['x', 'y']),
|
|
51
|
+
semantic: async ({e, context}) => {
|
|
52
|
+
const x = toValue(await e(context.x, where()))
|
|
53
|
+
const y = toValue(await e(context.y, where()))
|
|
53
54
|
if (!x || !y) {
|
|
54
55
|
// context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
|
|
55
56
|
context.isResponse = false
|
|
@@ -107,6 +108,16 @@ const config = {
|
|
|
107
108
|
...mathematicalOperator('times', ['times', '*'], (x, y) => x * y, [['plusOperator', 0], ['minusOperator', 0]]),
|
|
108
109
|
...mathematicalOperator('divideBy', ['/'], (x, y) => x / y, [['plusOperator', 0], ['minusOperator', 0]]),
|
|
109
110
|
],
|
|
111
|
+
semantics: [
|
|
112
|
+
{
|
|
113
|
+
match: ({context, isA, callId, isMany}) => {
|
|
114
|
+
return context.marker == 'same' && isA(context.two, 'mathematicalExpression') && !isMany(context.one)
|
|
115
|
+
},
|
|
116
|
+
apply: ({context}) => {
|
|
117
|
+
// dont so the other one for is
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
],
|
|
110
121
|
};
|
|
111
122
|
|
|
112
123
|
const template = {
|
|
@@ -129,7 +140,9 @@ knowledgeModule( {
|
|
|
129
140
|
name: './math.test.json',
|
|
130
141
|
contents: tests,
|
|
131
142
|
checks: {
|
|
132
|
-
context: [
|
|
143
|
+
context: [
|
|
144
|
+
defaultContextCheck()
|
|
145
|
+
],
|
|
133
146
|
}
|
|
134
147
|
},
|
|
135
148
|
})
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"bridges": [
|
|
15
15
|
{
|
|
16
16
|
"id": "close_menus",
|
|
17
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:130",
|
|
17
18
|
"isA": [
|
|
18
19
|
"verb"
|
|
19
20
|
],
|
|
@@ -25,11 +26,12 @@
|
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
"id": "show_menus",
|
|
29
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:141",
|
|
28
30
|
"isA": [
|
|
29
31
|
"verb"
|
|
30
32
|
],
|
|
31
33
|
"bridge": "{ ...next(operator), show: after[0], generate: ['this', 'show'] }",
|
|
32
|
-
"semantic": "({context, api}) => {\n if (context.show.
|
|
34
|
+
"semantic": "({context, api}) => {\n if (context.show.isInstance) {\n api.show(context.show.value)\n }\n }"
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
"id": "typeOfMenu_menus",
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"semantics": [
|
|
44
46
|
{
|
|
45
47
|
"match": "({context, isA}) => isA(context, 'showable_menus')",
|
|
46
|
-
"apply": "async ({context, insert,
|
|
48
|
+
"apply": "async ({context, insert, e, fragments}) => {\n const instantiation = await fragments(\"show showable\", { 'showable_menus': context })\n await e(instantiation, where())\n }"
|
|
47
49
|
}
|
|
48
50
|
]
|
|
49
51
|
},
|
|
@@ -114,7 +116,6 @@
|
|
|
114
116
|
"level": 1,
|
|
115
117
|
"context_index": 1,
|
|
116
118
|
"topLevel": true,
|
|
117
|
-
"context_id": 2,
|
|
118
119
|
"touchedBy": [
|
|
119
120
|
"menus#call2"
|
|
120
121
|
]
|
|
@@ -205,6 +206,9 @@
|
|
|
205
206
|
}
|
|
206
207
|
],
|
|
207
208
|
"learned_contextual_priorities": [],
|
|
209
|
+
"explain_associations_details": [
|
|
210
|
+
null
|
|
211
|
+
],
|
|
208
212
|
"query": "setidsuffix _menus",
|
|
209
213
|
"key": {
|
|
210
214
|
"query": "setidsuffix _menus"
|
|
@@ -345,7 +349,6 @@
|
|
|
345
349
|
"level": 2,
|
|
346
350
|
"context_index": 1,
|
|
347
351
|
"topLevel": true,
|
|
348
|
-
"context_id": 2,
|
|
349
352
|
"touchedBy": [
|
|
350
353
|
"menus#call2"
|
|
351
354
|
]
|
|
@@ -526,6 +529,9 @@
|
|
|
526
529
|
}
|
|
527
530
|
],
|
|
528
531
|
"learned_contextual_priorities": [],
|
|
532
|
+
"explain_associations_details": [
|
|
533
|
+
null
|
|
534
|
+
],
|
|
529
535
|
"query": "menu is a concept",
|
|
530
536
|
"key": {
|
|
531
537
|
"query": "menu is a concept"
|
|
@@ -666,7 +672,6 @@
|
|
|
666
672
|
"level": 2,
|
|
667
673
|
"context_index": 1,
|
|
668
674
|
"topLevel": true,
|
|
669
|
-
"context_id": 2,
|
|
670
675
|
"touchedBy": [
|
|
671
676
|
"menus#call2"
|
|
672
677
|
]
|
|
@@ -847,6 +852,9 @@
|
|
|
847
852
|
}
|
|
848
853
|
],
|
|
849
854
|
"learned_contextual_priorities": [],
|
|
855
|
+
"explain_associations_details": [
|
|
856
|
+
null
|
|
857
|
+
],
|
|
850
858
|
"query": "item is a concept",
|
|
851
859
|
"key": {
|
|
852
860
|
"query": "item is a concept"
|
|
@@ -952,7 +960,6 @@
|
|
|
952
960
|
"level": 1,
|
|
953
961
|
"context_index": 1,
|
|
954
962
|
"topLevel": true,
|
|
955
|
-
"context_id": 2,
|
|
956
963
|
"touchedBy": [
|
|
957
964
|
"menus#call2"
|
|
958
965
|
]
|
|
@@ -1098,6 +1105,9 @@
|
|
|
1098
1105
|
}
|
|
1099
1106
|
],
|
|
1100
1107
|
"learned_contextual_priorities": [],
|
|
1108
|
+
"explain_associations_details": [
|
|
1109
|
+
null
|
|
1110
|
+
],
|
|
1101
1111
|
"query": "menu modifies item",
|
|
1102
1112
|
"key": {
|
|
1103
1113
|
"query": "menu modifies item"
|
|
@@ -1346,7 +1356,6 @@
|
|
|
1346
1356
|
"level": 2,
|
|
1347
1357
|
"context_index": 1,
|
|
1348
1358
|
"topLevel": true,
|
|
1349
|
-
"context_id": 2,
|
|
1350
1359
|
"touchedBy": [
|
|
1351
1360
|
"menus#call2"
|
|
1352
1361
|
]
|
|
@@ -1677,6 +1686,9 @@
|
|
|
1677
1686
|
}
|
|
1678
1687
|
],
|
|
1679
1688
|
"learned_contextual_priorities": [],
|
|
1689
|
+
"explain_associations_details": [
|
|
1690
|
+
null
|
|
1691
|
+
],
|
|
1680
1692
|
"query": "menus and menu items are showable",
|
|
1681
1693
|
"key": {
|
|
1682
1694
|
"query": "menus and menu items are showable"
|
|
@@ -1692,6 +1704,7 @@
|
|
|
1692
1704
|
"bridges": [
|
|
1693
1705
|
{
|
|
1694
1706
|
"id": "close_menus",
|
|
1707
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:130",
|
|
1695
1708
|
"isA": [
|
|
1696
1709
|
"verb"
|
|
1697
1710
|
],
|
|
@@ -1702,6 +1715,7 @@
|
|
|
1702
1715
|
},
|
|
1703
1716
|
{
|
|
1704
1717
|
"id": "show_menus",
|
|
1718
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:141",
|
|
1705
1719
|
"isA": [
|
|
1706
1720
|
"verb"
|
|
1707
1721
|
],
|
|
@@ -1718,7 +1732,7 @@
|
|
|
1718
1732
|
],
|
|
1719
1733
|
"semantics": [
|
|
1720
1734
|
{
|
|
1721
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:
|
|
1735
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:159"
|
|
1722
1736
|
}
|
|
1723
1737
|
]
|
|
1724
1738
|
},
|
|
@@ -1742,7 +1756,6 @@
|
|
|
1742
1756
|
"level": 0,
|
|
1743
1757
|
"context_index": 1,
|
|
1744
1758
|
"topLevel": true,
|
|
1745
|
-
"context_id": 2,
|
|
1746
1759
|
"touchedBy": [
|
|
1747
1760
|
"menus#call2"
|
|
1748
1761
|
]
|
|
@@ -1783,6 +1796,9 @@
|
|
|
1783
1796
|
}
|
|
1784
1797
|
],
|
|
1785
1798
|
"learned_contextual_priorities": [],
|
|
1799
|
+
"explain_associations_details": [
|
|
1800
|
+
null
|
|
1801
|
+
],
|
|
1786
1802
|
"query": "resetidsuffix",
|
|
1787
1803
|
"key": {
|
|
1788
1804
|
"query": "resetidsuffix"
|
|
@@ -1859,8 +1875,7 @@
|
|
|
1859
1875
|
],
|
|
1860
1876
|
"level": 1,
|
|
1861
1877
|
"context_index": 1,
|
|
1862
|
-
"topLevel": true
|
|
1863
|
-
"context_id": 2
|
|
1878
|
+
"topLevel": true
|
|
1864
1879
|
}
|
|
1865
1880
|
],
|
|
1866
1881
|
"generated": [
|
|
@@ -1948,6 +1963,9 @@
|
|
|
1948
1963
|
}
|
|
1949
1964
|
],
|
|
1950
1965
|
"learned_contextual_priorities": [],
|
|
1966
|
+
"explain_associations_details": [
|
|
1967
|
+
null
|
|
1968
|
+
],
|
|
1951
1969
|
"query": "show showable",
|
|
1952
1970
|
"skipSemantics": true,
|
|
1953
1971
|
"key": {
|
package/common/menus.js
CHANGED
|
@@ -77,7 +77,7 @@ class MenusAPI {
|
|
|
77
77
|
id: `${languageId}`,
|
|
78
78
|
associations: [languageId, 'menus'],
|
|
79
79
|
isA: ['menu_menus'],
|
|
80
|
-
words: [{ word: name, value: id,
|
|
80
|
+
words: [{ word: name, value: id, isInstance: true }],
|
|
81
81
|
})
|
|
82
82
|
this._objects.menuDefs.push({
|
|
83
83
|
key: name,
|
|
@@ -96,7 +96,7 @@ class MenusAPI {
|
|
|
96
96
|
id: `${languageId}`,
|
|
97
97
|
associations: [menuId.languageId, 'menus'],
|
|
98
98
|
isA: ['menu_menus_item_menus'],
|
|
99
|
-
words: [{ word: name, value: id, path: [menuId.id, id],
|
|
99
|
+
words: [{ word: name, value: id, path: [menuId.id, id], isInstance: true }],
|
|
100
100
|
})
|
|
101
101
|
const menu = this._objects.menuDefs.find((md) => md.key == menuId.id)
|
|
102
102
|
menu.children.push({
|
|
@@ -127,6 +127,7 @@ const template = {
|
|
|
127
127
|
bridges: [
|
|
128
128
|
{
|
|
129
129
|
id: 'close_menus',
|
|
130
|
+
where: where(),
|
|
130
131
|
isA: ['verb'],
|
|
131
132
|
associations: ['menus'],
|
|
132
133
|
bridge: "{ ...next(operator), closee: after[0], generate: ['this', 'closee'] }",
|
|
@@ -136,10 +137,12 @@ const template = {
|
|
|
136
137
|
},
|
|
137
138
|
{
|
|
138
139
|
id: 'show_menus',
|
|
140
|
+
where: where(),
|
|
141
|
+
where: where(),
|
|
139
142
|
isA: ['verb'],
|
|
140
143
|
bridge: "{ ...next(operator), show: after[0], generate: ['this', 'show'] }",
|
|
141
144
|
semantic: ({context, api}) => {
|
|
142
|
-
if (context.show.
|
|
145
|
+
if (context.show.isInstance) {
|
|
143
146
|
api.show(context.show.value)
|
|
144
147
|
}
|
|
145
148
|
}
|
|
@@ -155,9 +158,9 @@ const template = {
|
|
|
155
158
|
{
|
|
156
159
|
where: where(),
|
|
157
160
|
match: ({context, isA}) => isA(context, 'showable_menus'),
|
|
158
|
-
apply: async ({context, insert,
|
|
161
|
+
apply: async ({context, insert, e, fragments}) => {
|
|
159
162
|
const instantiation = await fragments("show showable", { 'showable_menus': context })
|
|
160
|
-
await
|
|
163
|
+
await e(instantiation, where())
|
|
161
164
|
}
|
|
162
165
|
},
|
|
163
166
|
]
|
package/common/meta.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
|
|
1
|
+
const { knowledgeModule, ensureTestFile, where, unflatten, flattens, debug } = require('./runtime').theprogrammablemind
|
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const _ = require('lodash')
|
|
4
4
|
const gdefaults = require('./gdefaults.js')
|
|
@@ -78,7 +78,7 @@ const config = {
|
|
|
78
78
|
id: 'synonymOfWord',
|
|
79
79
|
operator: "((synonym/*) [synonymOfWord|of] (word))",
|
|
80
80
|
bridge: "{ ...next(operator), word: after[0] }",
|
|
81
|
-
|
|
81
|
+
semantic: ({context}) => {
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
*/
|
|
@@ -192,10 +192,10 @@ const config = {
|
|
|
192
192
|
{
|
|
193
193
|
where: where(),
|
|
194
194
|
match: ({context}) => context.marker == 'orList',
|
|
195
|
-
apply: async ({context,
|
|
195
|
+
apply: async ({context, e}) => {
|
|
196
196
|
const response = []
|
|
197
197
|
for (const value of context.value) {
|
|
198
|
-
response.push(await
|
|
198
|
+
response.push(await e(value, where()))
|
|
199
199
|
}
|
|
200
200
|
context.evalue = {
|
|
201
201
|
marker: 'orList',
|
|
@@ -219,7 +219,7 @@ const config = {
|
|
|
219
219
|
function invertMappings(mappings) {
|
|
220
220
|
return mappings.map( ({ from, to }) => { return { to: from, from: to } } )
|
|
221
221
|
}
|
|
222
|
-
return async ({context,
|
|
222
|
+
return async ({context, e, config}) => {
|
|
223
223
|
DEFINITIONs = _.cloneDeep(DEFINITIONs)
|
|
224
224
|
//const mappings = mappingss[0]
|
|
225
225
|
let toPrimes = []
|
|
@@ -229,7 +229,7 @@ const config = {
|
|
|
229
229
|
}
|
|
230
230
|
// next move add debug arg to s and g
|
|
231
231
|
TO.query = true
|
|
232
|
-
toPrimes.push([await
|
|
232
|
+
toPrimes.push([await e(TO, where()), mappings])
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
let hasResponse = false
|
|
@@ -323,12 +323,12 @@ const config = {
|
|
|
323
323
|
return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
|
|
324
324
|
}
|
|
325
325
|
function apply(mappings, TO) {
|
|
326
|
-
return async ({context,
|
|
326
|
+
return async ({context, e}) => {
|
|
327
327
|
TO = _.cloneDeep(TO)
|
|
328
328
|
for (const { from, to } of mappings) {
|
|
329
329
|
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
|
330
330
|
}
|
|
331
|
-
toPrime = await
|
|
331
|
+
toPrime = await e(TO, where())
|
|
332
332
|
context.result = toPrime.result
|
|
333
333
|
}
|
|
334
334
|
}
|
|
@@ -349,14 +349,15 @@ const config = {
|
|
|
349
349
|
|
|
350
350
|
// setup the read semantic
|
|
351
351
|
{
|
|
352
|
+
// TODO change this disable to callOnce
|
|
352
353
|
function matchByMarker(defContext) {
|
|
353
|
-
return ({context, uuid}) => context.marker == defContext.from.marker &&
|
|
354
|
+
return ({context, uuid}) => context.marker == defContext.from.marker && !context[`disable${uuid}`]
|
|
354
355
|
}
|
|
355
356
|
function matchByValue(defContext) {
|
|
356
|
-
return ({context, uuid}) => context.value == defContext.from.value &&
|
|
357
|
+
return ({context, uuid, stack}) => context.value == defContext.from.value && !context[`disable${uuid}`]
|
|
357
358
|
}
|
|
358
359
|
function apply(mappings, TO) {
|
|
359
|
-
return async ({uuid, context,
|
|
360
|
+
return async ({uuid, context, e, g, config}) => {
|
|
360
361
|
TO = _.cloneDeep(TO)
|
|
361
362
|
for (const { from, to } of mappings) {
|
|
362
363
|
hashIndexesSet(TO, to, hashIndexesGet(context, from))
|
|
@@ -366,10 +367,10 @@ const config = {
|
|
|
366
367
|
if (context.query) {
|
|
367
368
|
TO.query = context.query
|
|
368
369
|
} else {
|
|
369
|
-
TO.
|
|
370
|
+
TO.metaDefinition = true
|
|
370
371
|
}
|
|
371
372
|
TO[`disable${uuid}`] = true
|
|
372
|
-
toPrime = await
|
|
373
|
+
toPrime = await e(TO, where())
|
|
373
374
|
if (context.query) {
|
|
374
375
|
if (toPrime.evalue) {
|
|
375
376
|
context.evalue = toPrime.evalue
|
package/common/nameable.js
CHANGED
|
@@ -19,7 +19,7 @@ class API {
|
|
|
19
19
|
context.namespaced.nameable ??= {}
|
|
20
20
|
context.namespaced.nameable.names ??= []
|
|
21
21
|
context.namespaced.nameable.names.push(name)
|
|
22
|
-
this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true,
|
|
22
|
+
this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true, isInstance: ${context.isInstance ? 'true' : 'false'} }` })
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// used by mongo km
|
|
@@ -88,11 +88,12 @@ const config = {
|
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
id: 'getNamesByType',
|
|
91
|
+
where: where(),
|
|
91
92
|
scope: "testing",
|
|
92
93
|
isA: ['verb'],
|
|
93
94
|
bridge: "{ ...next(operator), type: after[0] }",
|
|
94
95
|
semantic: async ({context, api}) => {
|
|
95
|
-
context.
|
|
96
|
+
context.evalue = api.getNamesByType(context.type.value).join(" ")
|
|
96
97
|
context.isResponse = true
|
|
97
98
|
}
|
|
98
99
|
},
|
|
@@ -113,6 +114,7 @@ const config = {
|
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
id: 'call',
|
|
117
|
+
where: where(),
|
|
116
118
|
isA: ['verb'],
|
|
117
119
|
words: englishHelpers.conjugateVerb('call'),
|
|
118
120
|
bridge: `{
|
|
@@ -124,7 +126,7 @@ const config = {
|
|
|
124
126
|
`,
|
|
125
127
|
// generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
|
|
126
128
|
semantic: async ({config, context, api, e, verbatim, g}) => {
|
|
127
|
-
const nameable = (await e(context.nameable))?.evalue
|
|
129
|
+
const nameable = (await e(context.nameable, where()))?.evalue
|
|
128
130
|
if (!nameable) {
|
|
129
131
|
verbatim(`${await g(context.nameable)} is not known`)
|
|
130
132
|
return
|
|
@@ -156,7 +158,7 @@ const config = {
|
|
|
156
158
|
semantics: [
|
|
157
159
|
{
|
|
158
160
|
where: where(),
|
|
159
|
-
match: ({context}) => context.marker == 'mentions' && context.
|
|
161
|
+
match: ({context}) => context.marker == 'mentions' && context.args?.context?.nameable_named,
|
|
160
162
|
apply: async ({callId, _continue, toList, context, kms, e, log, retry}) => {
|
|
161
163
|
context.args.condition ??= () => true
|
|
162
164
|
const oldCondition = context.args.condition
|
|
@@ -188,7 +190,9 @@ knowledgeModule( {
|
|
|
188
190
|
context: [
|
|
189
191
|
defaultContextCheck({ extra: ['pullFromContext'] }),
|
|
190
192
|
],
|
|
191
|
-
objects: [
|
|
193
|
+
objects: [
|
|
194
|
+
{ km: 'stm' }
|
|
195
|
+
],
|
|
192
196
|
},
|
|
193
197
|
include: {
|
|
194
198
|
words: [ "peter james chunkington", "banana" ],
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"trace": "undefined",
|
|
24
24
|
"contexts": [
|
|
25
25
|
{
|
|
26
|
-
"
|
|
26
|
+
"isInstance": true,
|
|
27
27
|
"value": 10.2345,
|
|
28
28
|
"text": "10.2345",
|
|
29
29
|
"marker": "number",
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"dead": true,
|
|
36
36
|
"level": 1,
|
|
37
37
|
"context_index": 1,
|
|
38
|
-
"topLevel": true
|
|
39
|
-
"context_id": 2
|
|
38
|
+
"topLevel": true
|
|
40
39
|
}
|
|
41
40
|
],
|
|
42
41
|
"generated": [
|
|
@@ -89,6 +88,9 @@
|
|
|
89
88
|
}
|
|
90
89
|
],
|
|
91
90
|
"learned_contextual_priorities": [],
|
|
91
|
+
"explain_associations_details": [
|
|
92
|
+
null
|
|
93
|
+
],
|
|
92
94
|
"query": "10.2345",
|
|
93
95
|
"skipSemantics": true,
|
|
94
96
|
"key": {
|