tpmkms 8.0.0-beta.42 → 8.0.0-beta.43
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.js +17 -20
- package/common/articles.js +6 -11
- package/common/avatar.js +5 -9
- package/common/characters.js +22 -26
- package/common/colors.instance.json +28 -0
- package/common/colors.js +4 -8
- package/common/comparable.js +5 -9
- package/common/concept.js +120 -124
- package/common/countable.js +5 -9
- package/common/crew.js +36 -41
- package/common/currency.js +25 -43
- package/common/dialogues.js +46 -49
- package/common/dimension.instance.json +8 -8
- package/common/dimension.js +7 -13
- package/common/edible.instance.json +112 -0
- package/common/edible.js +3 -8
- package/common/emotions.js +35 -38
- package/common/evaluate.js +5 -11
- package/common/events.js +6 -10
- package/common/fastfood.instance.json +401 -317
- package/common/fastfood.js +53 -63
- package/common/formulas.instance.json +10 -10
- package/common/formulas.js +7 -14
- package/common/gdefaults.js +8 -10
- package/common/help.js +7 -12
- package/common/hierarchy.js +8 -12
- package/common/javascript.js +7 -14
- package/common/kirk.js +5 -8
- package/common/length.js +4 -8
- package/common/listener.js +5 -11
- package/common/math.instance.json +16 -16
- package/common/math.js +6 -10
- package/common/meta.js +5 -22
- package/common/nameable.js +6 -13
- package/common/negation.js +5 -5
- package/common/numbers.js +5 -9
- package/common/ordering.instance.json +68 -0
- package/common/ordering.js +80 -86
- package/common/people.js +8 -12
- package/common/percentages.js +5 -9
- package/common/pipboy.instance.json +84 -28
- package/common/pipboy.js +7 -15
- package/common/pokemon.js +7 -20
- package/common/pos.js +4 -5
- package/common/pressure.js +4 -8
- package/common/properties.js +6 -12
- package/common/punctuation.js +5 -5
- package/common/reports.instance.json +1 -1
- package/common/reports.js +9 -14
- package/common/scorekeeper.js +8 -12
- package/common/sdefaults.js +4 -5
- package/common/sizeable.js +5 -9
- package/common/spock.js +5 -8
- package/common/stgame.js +18 -23
- package/common/stm.js +9 -15
- package/common/tell.js +9 -13
- package/common/temperature.instance.json +0 -112
- package/common/temperature.js +4 -8
- package/common/tester.js +1 -1
- package/common/testing.js +5 -9
- package/common/time.js +18 -23
- package/common/tokenize.js +4 -5
- package/common/ui.js +6 -12
- package/common/weight.js +4 -8
- package/common/yesno.js +5 -5
- package/package.json +2 -2
@@ -59,7 +59,7 @@
|
|
59
59
|
"development": true
|
60
60
|
},
|
61
61
|
{
|
62
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
62
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
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/
|
83
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
84
84
|
"id": "plusExpression",
|
85
85
|
"level": 0,
|
86
86
|
"bridge": "{ ...next(operator) }",
|
@@ -91,7 +91,7 @@
|
|
91
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/
|
94
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
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/
|
115
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
116
116
|
"id": "minusExpression",
|
117
117
|
"level": 0,
|
118
118
|
"bridge": "{ ...next(operator) }",
|
@@ -123,7 +123,7 @@
|
|
123
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/
|
126
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
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/
|
156
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
157
157
|
"id": "timesExpression",
|
158
158
|
"level": 0,
|
159
159
|
"bridge": "{ ...next(operator) }",
|
@@ -164,7 +164,7 @@
|
|
164
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/
|
167
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
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/
|
196
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
197
197
|
"id": "divideByExpression",
|
198
198
|
"level": 0,
|
199
199
|
"bridge": "{ ...next(operator) }",
|
@@ -770,7 +770,7 @@
|
|
770
770
|
"development": true
|
771
771
|
},
|
772
772
|
{
|
773
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
773
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
774
774
|
"id": "plusOperator",
|
775
775
|
"level": 0,
|
776
776
|
"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 }",
|
@@ -790,7 +790,7 @@
|
|
790
790
|
]
|
791
791
|
},
|
792
792
|
{
|
793
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
793
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
794
794
|
"id": "plusExpression",
|
795
795
|
"level": 0,
|
796
796
|
"bridge": "{ ...next(operator) }",
|
@@ -799,7 +799,7 @@
|
|
799
799
|
]
|
800
800
|
},
|
801
801
|
{
|
802
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
802
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
803
803
|
"id": "minusOperator",
|
804
804
|
"level": 0,
|
805
805
|
"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 }",
|
@@ -819,7 +819,7 @@
|
|
819
819
|
]
|
820
820
|
},
|
821
821
|
{
|
822
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
822
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
823
823
|
"id": "minusExpression",
|
824
824
|
"level": 0,
|
825
825
|
"bridge": "{ ...next(operator) }",
|
@@ -828,7 +828,7 @@
|
|
828
828
|
]
|
829
829
|
},
|
830
830
|
{
|
831
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
831
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
832
832
|
"id": "timesOperator",
|
833
833
|
"level": 0,
|
834
834
|
"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 }",
|
@@ -857,7 +857,7 @@
|
|
857
857
|
]
|
858
858
|
},
|
859
859
|
{
|
860
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
860
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
861
861
|
"id": "timesExpression",
|
862
862
|
"level": 0,
|
863
863
|
"bridge": "{ ...next(operator) }",
|
@@ -866,7 +866,7 @@
|
|
866
866
|
]
|
867
867
|
},
|
868
868
|
{
|
869
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
869
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
870
870
|
"id": "divideByOperator",
|
871
871
|
"level": 0,
|
872
872
|
"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 }",
|
@@ -894,7 +894,7 @@
|
|
894
894
|
]
|
895
895
|
},
|
896
896
|
{
|
897
|
-
"where": "/home/dev/code/theprogrammablemind/kms/
|
897
|
+
"where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
|
898
898
|
"id": "divideByExpression",
|
899
899
|
"level": 0,
|
900
900
|
"bridge": "{ ...next(operator) }",
|
package/common/math.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const dialogues = require('./dialogues')
|
4
4
|
const numbers = require('./numbers')
|
@@ -69,7 +69,7 @@ const mathematicalOperator = (name, words, apply, before = []) => [
|
|
69
69
|
}
|
70
70
|
]
|
71
71
|
|
72
|
-
let
|
72
|
+
let config = {
|
73
73
|
name: 'math',
|
74
74
|
operators: [
|
75
75
|
"([mathematicalExpression])",
|
@@ -108,20 +108,16 @@ let configStruct = {
|
|
108
108
|
const template = {
|
109
109
|
configs: [
|
110
110
|
"mathematical modifies operator",
|
111
|
-
|
111
|
+
config,
|
112
112
|
// "* + / and - are mathematical operators",
|
113
113
|
]
|
114
114
|
}
|
115
115
|
|
116
|
-
const createConfig = async () => {
|
117
|
-
const config = new Config({ name: 'math' }, module)
|
118
|
-
await config.add(numbers, dialogues, punctuation, countable, comparable)
|
119
|
-
return config
|
120
|
-
}
|
121
|
-
|
122
116
|
knowledgeModule( {
|
117
|
+
config: { name: 'math' },
|
118
|
+
includes: [numbers, dialogues, punctuation, countable, comparable],
|
119
|
+
|
123
120
|
module,
|
124
|
-
createConfig,
|
125
121
|
description: 'talking about math',
|
126
122
|
template: { template, instance },
|
127
123
|
test: {
|
package/common/meta.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const _ = require('lodash')
|
4
4
|
const gdefaults = require('./gdefaults.js')
|
@@ -17,7 +17,7 @@ const template = {
|
|
17
17
|
};
|
18
18
|
|
19
19
|
// TODO -> if a car's top speed is over 200 mph then the car is fast
|
20
|
-
let
|
20
|
+
let config = {
|
21
21
|
name: 'meta',
|
22
22
|
operators: [
|
23
23
|
"((phrase) [means] (phrase))",
|
@@ -371,29 +371,12 @@ let configStruct = {
|
|
371
371
|
],
|
372
372
|
};
|
373
373
|
|
374
|
-
const createConfig = async () => {
|
375
|
-
const config = new Config(configStruct, module)
|
376
|
-
config.stop_auto_rebuild()
|
377
|
-
await config.add(gdefaults)
|
378
|
-
|
379
|
-
await config.initializer( ({config, addGenerator, isModule}) => {
|
380
|
-
if (!isModule) {
|
381
|
-
addGenerator({
|
382
|
-
where: where(),
|
383
|
-
match: ({context}) => context.marker == 'unknown',
|
384
|
-
apply: ({context}) => `${context.word}`
|
385
|
-
})
|
386
|
-
}
|
387
|
-
})
|
388
|
-
|
389
|
-
await config.restart_auto_rebuild()
|
390
|
-
return config
|
391
|
-
}
|
392
|
-
|
393
374
|
knowledgeModule({
|
375
|
+
config,
|
376
|
+
includes: [gdefaults],
|
377
|
+
|
394
378
|
module,
|
395
379
|
description: 'Ways of defining new language elements',
|
396
|
-
createConfig,
|
397
380
|
test: {
|
398
381
|
name: './meta.test.json',
|
399
382
|
contents: meta_tests,
|
package/common/nameable.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const helpers = require('./helpers')
|
4
4
|
const stm = require('./stm')
|
@@ -70,7 +70,7 @@ class API {
|
|
70
70
|
|
71
71
|
const api = new API()
|
72
72
|
|
73
|
-
const
|
73
|
+
const config = {
|
74
74
|
name: 'nameable',
|
75
75
|
operators: [
|
76
76
|
"([call] ([nameable]) (name))",
|
@@ -117,20 +117,13 @@ const configStruct = {
|
|
117
117
|
]
|
118
118
|
}
|
119
119
|
|
120
|
-
let createConfig = async () => {
|
121
|
-
const config = new Config(configStruct, module)
|
122
|
-
config.stop_auto_rebuild()
|
123
|
-
await config.setApi(api)
|
124
|
-
await config.add(stm)
|
125
|
-
|
126
|
-
await config.restart_auto_rebuild()
|
127
|
-
return config
|
128
|
-
}
|
129
|
-
|
130
120
|
knowledgeModule( {
|
121
|
+
config,
|
122
|
+
api: () => new API(),
|
123
|
+
includes: [stm],
|
124
|
+
|
131
125
|
module,
|
132
126
|
description: 'namable objects',
|
133
|
-
createConfig,
|
134
127
|
test: {
|
135
128
|
name: './nameable.test.json',
|
136
129
|
contents: nameable_tests,
|
package/common/negation.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { words, defaultContextCheck } = require('./helpers')
|
3
3
|
const gdefaults = require('./gdefaults')
|
4
4
|
const pos = require('./pos')
|
5
5
|
const negation_tests = require('./negation.test.json')
|
6
6
|
|
7
|
-
let
|
7
|
+
let config = {
|
8
8
|
name: 'negation',
|
9
9
|
operators: [
|
10
10
|
"([negatable])",
|
@@ -21,11 +21,11 @@ let configStruct = {
|
|
21
21
|
],
|
22
22
|
};
|
23
23
|
|
24
|
-
const createConfig = async () => new Config(configStruct, module).add(gdefaults, pos)
|
25
|
-
|
26
24
|
knowledgeModule( {
|
25
|
+
config,
|
26
|
+
includes: [gdefaults, pos],
|
27
|
+
|
27
28
|
module,
|
28
|
-
createConfig,
|
29
29
|
description: 'negation',
|
30
30
|
test: {
|
31
31
|
name: './negation.test.json',
|
package/common/numbers.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const numbers_tests = require('./numbers.test.json')
|
4
4
|
const gdefaults = require('./gdefaults')
|
@@ -10,7 +10,7 @@ const sdefaults = require('./sdefaults')
|
|
10
10
|
10 million 300 hundred and fifty
|
11
11
|
*/
|
12
12
|
|
13
|
-
let
|
13
|
+
let config = {
|
14
14
|
name: 'numbers',
|
15
15
|
operators: [
|
16
16
|
"([number])",
|
@@ -83,15 +83,11 @@ let configStruct = {
|
|
83
83
|
],
|
84
84
|
};
|
85
85
|
|
86
|
-
const createConfig = async () => {
|
87
|
-
const config = new Config(configStruct, module)
|
88
|
-
await config.add(gdefaults, sdefaults)
|
89
|
-
return config
|
90
|
-
}
|
91
|
-
|
92
86
|
knowledgeModule( {
|
87
|
+
config,
|
88
|
+
includes: [gdefaults, sdefaults],
|
89
|
+
|
93
90
|
module,
|
94
|
-
createConfig,
|
95
91
|
description: 'talking about numbers',
|
96
92
|
test: {
|
97
93
|
name: './numbers.test.json',
|
@@ -2027,6 +2027,40 @@
|
|
2027
2027
|
0
|
2028
2028
|
]
|
2029
2029
|
],
|
2030
|
+
[
|
2031
|
+
[
|
2032
|
+
"if",
|
2033
|
+
0
|
2034
|
+
],
|
2035
|
+
[
|
2036
|
+
"like",
|
2037
|
+
0
|
2038
|
+
],
|
2039
|
+
[
|
2040
|
+
"love",
|
2041
|
+
0
|
2042
|
+
],
|
2043
|
+
[
|
2044
|
+
"orList",
|
2045
|
+
0
|
2046
|
+
],
|
2047
|
+
[
|
2048
|
+
"then",
|
2049
|
+
0
|
2050
|
+
],
|
2051
|
+
[
|
2052
|
+
"unknown",
|
2053
|
+
0
|
2054
|
+
],
|
2055
|
+
[
|
2056
|
+
"unknown",
|
2057
|
+
1
|
2058
|
+
],
|
2059
|
+
[
|
2060
|
+
"want",
|
2061
|
+
0
|
2062
|
+
]
|
2063
|
+
],
|
2030
2064
|
[
|
2031
2065
|
[
|
2032
2066
|
"if",
|
@@ -2388,6 +2422,40 @@
|
|
2388
2422
|
0
|
2389
2423
|
]
|
2390
2424
|
],
|
2425
|
+
[
|
2426
|
+
[
|
2427
|
+
"if",
|
2428
|
+
0
|
2429
|
+
],
|
2430
|
+
[
|
2431
|
+
"like",
|
2432
|
+
0
|
2433
|
+
],
|
2434
|
+
[
|
2435
|
+
"love",
|
2436
|
+
0
|
2437
|
+
],
|
2438
|
+
[
|
2439
|
+
"orList",
|
2440
|
+
0
|
2441
|
+
],
|
2442
|
+
[
|
2443
|
+
"then",
|
2444
|
+
0
|
2445
|
+
],
|
2446
|
+
[
|
2447
|
+
"unknown",
|
2448
|
+
0
|
2449
|
+
],
|
2450
|
+
[
|
2451
|
+
"unknown",
|
2452
|
+
1
|
2453
|
+
],
|
2454
|
+
[
|
2455
|
+
"want",
|
2456
|
+
0
|
2457
|
+
]
|
2458
|
+
],
|
2391
2459
|
[
|
2392
2460
|
[
|
2393
2461
|
"if",
|
package/common/ordering.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const hierarchy = require('./hierarchy')
|
4
4
|
const ordering_tests = require('./ordering.test.json')
|
@@ -32,96 +32,90 @@ const api = new API();
|
|
32
32
|
|
33
33
|
if a likes b then a wants b
|
34
34
|
*/
|
35
|
-
const
|
36
|
-
const
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
create: ['own'],
|
110
|
-
before: [{tag: 'owner', id: 'object'}],
|
111
|
-
after: [{tag: 'ownee', id: 'object'}],
|
112
|
-
relation: true,
|
113
|
-
config
|
114
|
-
})
|
115
|
-
*/
|
116
|
-
})
|
117
|
-
await config.restart_auto_rebuild()
|
118
|
-
return config
|
35
|
+
const initializer = ({config, km}) => {
|
36
|
+
const oapi = km('ordering').api
|
37
|
+
oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
|
38
|
+
const papi = km('properties').api
|
39
|
+
// want is xfx between wanter and wantee
|
40
|
+
// papi.createBinaryRelation(config, 'want', ['want', 'wants'], 'wanter', 'wantee')
|
41
|
+
papi.createActionPrefix({
|
42
|
+
operator: 'love',
|
43
|
+
create: ['love'],
|
44
|
+
before: [{tag: 'lover', id: 'object'}],
|
45
|
+
after: [{tag: 'lovee', id: 'object'}],
|
46
|
+
ordering: {
|
47
|
+
name: 'preference',
|
48
|
+
marker: 'love',
|
49
|
+
object: 'lover',
|
50
|
+
category: 'lovee',
|
51
|
+
},
|
52
|
+
doAble: true,
|
53
|
+
config
|
54
|
+
})
|
55
|
+
papi.createActionPrefix({
|
56
|
+
operator: 'like',
|
57
|
+
create: ['like'],
|
58
|
+
before: [{tag: 'liker', id: 'object'}],
|
59
|
+
after: [{tag: 'likee', id: 'object'}],
|
60
|
+
ordering: {
|
61
|
+
name: 'preference',
|
62
|
+
marker: 'like',
|
63
|
+
object: 'liker',
|
64
|
+
category: 'likee',
|
65
|
+
},
|
66
|
+
doAble: true,
|
67
|
+
config
|
68
|
+
})
|
69
|
+
papi.createActionPrefix({
|
70
|
+
operator: 'dislike',
|
71
|
+
create: ['dislike'],
|
72
|
+
before: [{tag: 'disliker', id: 'object'}],
|
73
|
+
after: [{tag: 'dislikee', id: 'object'}],
|
74
|
+
ordering: {
|
75
|
+
name: 'preference',
|
76
|
+
marker: 'dislike',
|
77
|
+
object: 'disliker',
|
78
|
+
category: 'dislikee',
|
79
|
+
},
|
80
|
+
doAble: true,
|
81
|
+
config
|
82
|
+
})
|
83
|
+
papi.createActionPrefix({
|
84
|
+
// pattern: [ {tag: 'hater', id: 'object'}, { operator, create: true, relation: true }, {tag: 'hatee', id: 'object'} ],
|
85
|
+
operator: 'hate',
|
86
|
+
create: ['hate'],
|
87
|
+
before: [{tag: 'hater', id: 'object'}],
|
88
|
+
after: [{tag: 'hatee', id: 'object'}],
|
89
|
+
ordering: {
|
90
|
+
name: 'preference',
|
91
|
+
marker: 'hate',
|
92
|
+
object: 'hater',
|
93
|
+
category: 'hatee',
|
94
|
+
},
|
95
|
+
doAble: true,
|
96
|
+
// negation: 'likes',
|
97
|
+
config
|
98
|
+
})
|
99
|
+
/*
|
100
|
+
papi.createActionPrefix({
|
101
|
+
operator: 'own',
|
102
|
+
create: ['own'],
|
103
|
+
before: [{tag: 'owner', id: 'object'}],
|
104
|
+
after: [{tag: 'ownee', id: 'object'}],
|
105
|
+
relation: true,
|
106
|
+
config
|
107
|
+
})
|
108
|
+
*/
|
119
109
|
}
|
120
110
|
|
121
111
|
knowledgeModule( {
|
112
|
+
config: { name: 'ordering' },
|
113
|
+
api: () => new API(),
|
114
|
+
includes: [hierarchy],
|
115
|
+
initializer,
|
116
|
+
|
122
117
|
module,
|
123
118
|
description: 'ordering related concepts',
|
124
|
-
createConfig,
|
125
119
|
test: {
|
126
120
|
name: './ordering.test.json',
|
127
121
|
heck: ['children', 'concept', 'parents', 'properties'],
|
package/common/people.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const hierarchy = require('./hierarchy')
|
4
4
|
const people_tests = require('./people.test.json')
|
@@ -25,7 +25,7 @@ const template = {
|
|
25
25
|
// "wendy owns cleo",
|
26
26
|
],
|
27
27
|
}
|
28
|
-
let
|
28
|
+
let config = {
|
29
29
|
name: 'people',
|
30
30
|
operators: [
|
31
31
|
"([person|person,people])",
|
@@ -45,11 +45,7 @@ let configStruct = {
|
|
45
45
|
],
|
46
46
|
};
|
47
47
|
|
48
|
-
const
|
49
|
-
const config = new Config(configStruct, module)
|
50
|
-
config.stop_auto_rebuild()
|
51
|
-
await config.add(hierarchy)
|
52
|
-
await config.initializer( ({baseConfig, context, apis, isModule}) => {
|
48
|
+
const initializer = ({baseConfig, context, apis, isModule}) => {
|
53
49
|
// const api = km('properties').api
|
54
50
|
const api = apis('properties')
|
55
51
|
// setup paraphrase
|
@@ -65,15 +61,15 @@ const createConfig = async () => {
|
|
65
61
|
edAble: { operator: 'owned', word: 'owned' },
|
66
62
|
config: baseConfig
|
67
63
|
})
|
68
|
-
}
|
69
|
-
await config.restart_auto_rebuild()
|
70
|
-
return config
|
71
|
-
}
|
64
|
+
}
|
72
65
|
|
73
66
|
knowledgeModule( {
|
67
|
+
config,
|
68
|
+
includes: [hierarchy],
|
69
|
+
initializer,
|
70
|
+
|
74
71
|
module,
|
75
72
|
description: 'about people',
|
76
|
-
createConfig,
|
77
73
|
test: {
|
78
74
|
name: './people.test.json',
|
79
75
|
contents: people_tests,
|