ekms 8.0.0 → 8.1.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/animals.instance.json +3003 -1651
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/asking.instance.json +2 -0
- package/common/asking.js +253 -0
- package/common/asking.test.json +2290 -0
- package/common/avatar.js +6 -10
- package/common/characters.js +23 -30
- package/common/colors.instance.json +25513 -0
- package/common/colors.js +67 -0
- package/common/colors.test.json +4425 -0
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +1196 -2
- package/common/concept.js +121 -119
- package/common/conjunction.instance.json +2 -0
- package/common/conjunction.js +104 -0
- package/common/conjunction.test.json +322 -0
- package/common/countable.js +20 -14
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +16855 -9731
- package/common/crew.js +39 -42
- package/common/crew.test.json +714 -452
- package/common/currency.js +28 -46
- package/common/dialogues.js +177 -426
- package/common/dialogues.test.json +684 -450
- package/common/dimension.instance.json +508 -289
- package/common/dimension.js +22 -24
- package/common/dimension.test.json +727 -1944
- package/common/edible.instance.json +20548 -10848
- package/common/edible.js +4 -9
- package/common/emotions.instance.json +255 -123
- package/common/emotions.js +36 -39
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +53 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +11 -15
- package/common/fastfood.instance.json +223039 -113390
- package/common/fastfood.js +77 -87
- package/common/fastfood.test.json +8205 -3733
- package/common/formulas.instance.json +444 -244
- package/common/formulas.js +20 -27
- package/common/formulas.test.json +1027 -955
- package/common/gdefaults.js +40 -27
- package/common/help.js +9 -14
- package/common/help.test.json +71 -18
- package/common/helpers/concept.js +33 -10
- package/common/helpers/dialogues.js +22 -4
- package/common/helpers/formulas.js +0 -14
- package/common/helpers/meta.js +0 -1
- package/common/helpers/properties.js +72 -76
- package/common/helpers.js +35 -24
- package/common/hierarchy.js +17 -25
- package/common/javascript.js +12 -19
- package/common/kirk.instance.json +586 -298
- package/common/kirk.js +6 -9
- package/common/length.instance.json +9158 -5124
- package/common/length.js +5 -9
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +409 -1202
- package/common/math.js +17 -21
- package/common/meta.js +24 -50
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/numbers.js +28 -32
- package/common/ordering.instance.json +449 -273
- package/common/ordering.js +81 -87
- package/common/ordinals.instance.json +2 -0
- package/common/ordinals.js +60 -0
- package/common/ordinals.test.json +306 -0
- package/common/people.instance.json +2176 -1141
- package/common/people.js +9 -14
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +53 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +12120 -6879
- package/common/pipboy.js +53 -62
- package/common/pipboy.test.json +2835 -0
- package/common/pokemon.instance.json +4415 -2351
- package/common/pokemon.js +8 -21
- package/common/pos.js +16 -14
- package/common/pressure.instance.json +2348 -1373
- package/common/pressure.js +5 -9
- package/common/properties.instance.json +151 -87
- package/common/properties.js +156 -167
- package/common/properties.test.json +17605 -4030
- package/common/punctuation.js +24 -8
- package/common/punctuation.test.json +233 -5
- package/common/reports.instance.json +1027 -551
- package/common/reports.js +77 -103
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +19 -31
- package/common/sdefaults.js +17 -8
- package/common/sizeable.js +13 -12
- package/common/spock.instance.json +585 -297
- package/common/spock.js +6 -9
- package/common/stgame.js +20 -20
- package/common/stm.js +182 -29
- package/common/stm.test.json +1734 -1
- package/common/tell.js +15 -19
- package/common/temperature.instance.json +2480 -1493
- package/common/temperature.js +5 -9
- package/common/tester.js +15 -4
- package/common/testing.js +8 -13
- package/common/time.js +21 -26
- package/common/tokenize.js +8 -8
- package/common/tokenize.test.json +86 -1
- package/common/ui.instance.json +151 -460
- package/common/ui.js +22 -34
- package/common/ui.test.json +641 -5357
- package/common/weight.instance.json +8072 -4490
- package/common/weight.js +5 -9
- package/common/weight.test.json +242 -238
- package/common/yesno.js +6 -6
- package/main.js +68 -45
- package/package.json +44 -6
package/common/temperature.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const dimension = require('./dimension.js')
|
4
4
|
const temperature_tests = require('./temperature.test.json')
|
@@ -14,21 +14,17 @@ const template = {
|
|
14
14
|
],
|
15
15
|
}
|
16
16
|
|
17
|
-
const createConfig = () => {
|
18
|
-
const config = new Config({ name: 'temperature' }, module)
|
19
|
-
config.add(dimension())
|
20
|
-
return config
|
21
|
-
}
|
22
|
-
|
23
17
|
knowledgeModule({
|
18
|
+
config: { name: 'temperature' },
|
19
|
+
includes: [dimension],
|
20
|
+
|
24
21
|
module,
|
25
22
|
description: 'Weight dimension',
|
26
|
-
createConfig,
|
27
23
|
test: {
|
28
24
|
name: './temperature.test.json',
|
29
25
|
contents: temperature_tests,
|
30
26
|
checks: {
|
31
|
-
context: defaultContextCheck,
|
27
|
+
context: defaultContextCheck(),
|
32
28
|
},
|
33
29
|
},
|
34
30
|
template: {
|
package/common/tester.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const tester_tests = require('./tester.test.json')
|
4
4
|
const ArgumentParser = require('argparse').ArgumentParser
|
@@ -12,7 +12,7 @@ const [args, unknown] = parser.parse_known_args()
|
|
12
12
|
|
13
13
|
process.argv = [process.argv[0], process.argv[1], ...unknown]
|
14
14
|
|
15
|
-
const createConfig = () => {
|
15
|
+
const createConfig = async () => {
|
16
16
|
const config = new Config({ name: 'tester' })
|
17
17
|
global.theprogrammablemind = {
|
18
18
|
loadForTesting: {}
|
@@ -21,15 +21,26 @@ const createConfig = () => {
|
|
21
21
|
global.theprogrammablemind.loadForTesting[module] = true
|
22
22
|
const km = require(`./${module}`)
|
23
23
|
// km.rebuild({ isModule: false }) // load the usually defaults
|
24
|
-
config.add(km
|
24
|
+
await config.add(km)
|
25
25
|
}
|
26
26
|
return config
|
27
27
|
}
|
28
28
|
|
29
|
+
global.theprogrammablemind = {
|
30
|
+
loadForTesting: {}
|
31
|
+
}
|
32
|
+
const includes = args.modules.split(',').map((module) => {
|
33
|
+
global.theprogrammablemind.loadForTesting[module] = true
|
34
|
+
const km = require(`./${module}`)
|
35
|
+
return km
|
36
|
+
})
|
37
|
+
|
29
38
|
knowledgeModule({
|
39
|
+
config: { name: 'tester' },
|
40
|
+
includes,
|
41
|
+
|
30
42
|
module,
|
31
43
|
description: 'Testing modules loaded together',
|
32
|
-
createConfig,
|
33
44
|
test: {
|
34
45
|
name: './tester.test.json',
|
35
46
|
contents: tester_tests
|
package/common/testing.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const testing_tests = require('./testing.test.json')
|
4
4
|
const gdefaults = require('./gdefaults')
|
5
5
|
|
6
|
-
|
6
|
+
const config = {
|
7
7
|
name: 'testing',
|
8
8
|
operators: [
|
9
9
|
{ pattern: "([testingEvaluate] ([testingValue]))" },
|
@@ -13,10 +13,9 @@ let configStruct = {
|
|
13
13
|
{
|
14
14
|
where: where(),
|
15
15
|
id: 'testingEvaluate',
|
16
|
-
generatorp: ({context, g}) => `${context.word} ${g(context.value)}`,
|
17
|
-
semantic: ({context, e}) => {
|
18
|
-
|
19
|
-
context.evalue = e(context.value)
|
16
|
+
generatorp: async ({context, g}) => `${context.word} ${await g(context.value)}`,
|
17
|
+
semantic: async ({context, e}) => {
|
18
|
+
context.evalue = await e(context.value)
|
20
19
|
context.isResponse = true
|
21
20
|
},
|
22
21
|
bridge: "{ ...next(operator), value: after[0] }",
|
@@ -31,16 +30,12 @@ let configStruct = {
|
|
31
30
|
],
|
32
31
|
};
|
33
32
|
|
34
|
-
const createConfig = () => {
|
35
|
-
const config = new Config(configStruct, module)
|
36
|
-
config.add(gdefaults())
|
37
|
-
return config
|
38
|
-
}
|
39
|
-
|
40
33
|
knowledgeModule({
|
34
|
+
config,
|
35
|
+
includes: [gdefaults],
|
36
|
+
|
41
37
|
module,
|
42
38
|
description: 'code for testing',
|
43
|
-
createConfig,
|
44
39
|
test: {
|
45
40
|
name: './testing.test.json',
|
46
41
|
contents: testing_tests
|
package/common/time.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const tell = require('./tell')
|
4
4
|
const countable = require('./countable')
|
@@ -14,7 +14,7 @@ const pad = (v, l) => {
|
|
14
14
|
|
15
15
|
class API {
|
16
16
|
// gets the contexts for doing the happening
|
17
|
-
semantics({context,
|
17
|
+
semantics({context, args, kms}) {
|
18
18
|
const api = kms.time.api
|
19
19
|
const values = args({ types: ['ampm', 'time'], properties: ['one', 'two'] })
|
20
20
|
const ampm = context[values[0]]
|
@@ -36,9 +36,8 @@ class API {
|
|
36
36
|
initialize() {
|
37
37
|
}
|
38
38
|
}
|
39
|
-
const api = new API()
|
40
39
|
|
41
|
-
const
|
40
|
+
const config = {
|
42
41
|
name: 'time',
|
43
42
|
operators: [
|
44
43
|
"([time])",
|
@@ -103,12 +102,12 @@ const configStruct = {
|
|
103
102
|
{
|
104
103
|
where: where(),
|
105
104
|
match: ({context}) => context.marker == 'ampm' && context.paraphrase,
|
106
|
-
apply: ({g, context, gp}) => `${gp(context.hour)} ${context.ampm}`
|
105
|
+
apply: async ({g, context, gp}) => `${await gp(context.hour)} ${context.ampm}`
|
107
106
|
},
|
108
107
|
{
|
109
108
|
where: where(),
|
110
109
|
match: ({context}) => context.marker == 'time' && context.evalue && context.format == 12,
|
111
|
-
apply: ({
|
110
|
+
apply: ({context}) => {
|
112
111
|
let hh = context.evalue.getHours();
|
113
112
|
let ampm = 'am'
|
114
113
|
if (hh > 12) {
|
@@ -170,36 +169,32 @@ const configStruct = {
|
|
170
169
|
],
|
171
170
|
};
|
172
171
|
|
173
|
-
const
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
format: 12 // or 24
|
184
|
-
});
|
185
|
-
config.addSemantic({
|
186
|
-
match: ({context, hierarchy, args}) => context.happening && context.marker == 'is' && args({ types: ['ampm', 'time'], properties: ['one', 'two'] }),
|
187
|
-
apply: api.semantics
|
188
|
-
})
|
172
|
+
const initializer = ({api, config, objects, kms, isModule}) => {
|
173
|
+
if (!isModule) {
|
174
|
+
kms.time.api.newDate = () => new Date("December 25, 1995 1:59:58 pm" )
|
175
|
+
}
|
176
|
+
Object.assign(objects, {
|
177
|
+
format: 12 // or 24
|
178
|
+
});
|
179
|
+
config.addSemantic({
|
180
|
+
match: ({context, hierarchy, args}) => context.happening && context.marker == 'is' && args({ types: ['ampm', 'time'], properties: ['one', 'two'] }),
|
181
|
+
apply: api.semantics
|
189
182
|
})
|
190
|
-
config.restart_auto_rebuild()
|
191
|
-
return config
|
192
183
|
}
|
193
184
|
|
194
185
|
knowledgeModule({
|
186
|
+
config,
|
187
|
+
includes: [tell, numbers, countable],
|
188
|
+
api: () => new API(),
|
189
|
+
initializer,
|
190
|
+
|
195
191
|
module,
|
196
192
|
description: 'Time related concepts',
|
197
|
-
createConfig,
|
198
193
|
test: {
|
199
194
|
name: './time.test.json',
|
200
195
|
contents: time_tests,
|
201
196
|
checks: {
|
202
|
-
context: defaultContextCheck,
|
197
|
+
context: defaultContextCheck(),
|
203
198
|
},
|
204
199
|
},
|
205
200
|
})
|
package/common/tokenize.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const tokenize_tests = require('./tokenize.test.json')
|
4
4
|
|
5
|
-
|
5
|
+
const config = {
|
6
6
|
name: 'tokenize',
|
7
7
|
operators: [
|
8
8
|
"([unknown])",
|
@@ -14,7 +14,7 @@ let configStruct = {
|
|
14
14
|
words: {
|
15
15
|
patterns: [
|
16
16
|
{ pattern: [{ type: 'space' }, { repeat: true }], defs: [ { remove: true } ] },
|
17
|
-
{ pattern: [{ type: 'alphanumeric' }, { repeat: true }], defs: [ { id: 'unknown', initial: "{ value: text, unknown: true }" } ] },
|
17
|
+
{ pattern: [{ type: 'alphanumeric' }, { repeat: true }], scale: 0.8, check_spelling: true, is_unknown: true, defs: [ { id: 'unknown', initial: "{ value: text, unknown: true }" } ] },
|
18
18
|
],
|
19
19
|
hierarchy: [
|
20
20
|
{ child: ' ', parent: 'space' },
|
@@ -25,22 +25,22 @@ let configStruct = {
|
|
25
25
|
...'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split("").map((letter) => { return { child: letter, parent: 'upper' } }),
|
26
26
|
{ child: 'letter', parent: 'alphanumeric' },
|
27
27
|
{ child: 'digit', parent: 'alphanumeric' },
|
28
|
-
|
28
|
+
{ child: '_', parent: 'alphanumeric' },
|
29
|
+
...`~!@#$%^&*()+-=[]{}\\|;:,<>/?'"`.split("").map((punctuation) => { return { child: punctuation, parent: 'punctuation' } }),
|
29
30
|
],
|
30
31
|
},
|
31
32
|
};
|
32
33
|
|
33
|
-
createConfig = () => new Config(configStruct, module)
|
34
|
-
|
35
34
|
knowledgeModule( {
|
35
|
+
config,
|
36
|
+
|
36
37
|
module,
|
37
|
-
createConfig,
|
38
38
|
description: 'tokenize',
|
39
39
|
test: {
|
40
40
|
name: './tokenize.test.json',
|
41
41
|
contents: tokenize_tests,
|
42
42
|
checks: {
|
43
|
-
context: defaultContextCheck,
|
43
|
+
context: defaultContextCheck(),
|
44
44
|
},
|
45
45
|
},
|
46
46
|
})
|
@@ -1,2 +1,87 @@
|
|
1
1
|
[
|
2
|
-
|
2
|
+
{
|
3
|
+
"associations": [
|
4
|
+
],
|
5
|
+
"config": {
|
6
|
+
},
|
7
|
+
"contexts": [
|
8
|
+
{
|
9
|
+
"dead": true,
|
10
|
+
"level": 1,
|
11
|
+
"marker": "unknown",
|
12
|
+
"range": {
|
13
|
+
"end": 10,
|
14
|
+
"start": 0
|
15
|
+
},
|
16
|
+
"text": "hello_world",
|
17
|
+
"topLevel": true,
|
18
|
+
"unknown": true,
|
19
|
+
"value": "hello_world",
|
20
|
+
"word": "hello_world"
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"generatedParenthesized": [
|
24
|
+
""
|
25
|
+
],
|
26
|
+
"metadata": {
|
27
|
+
"opChoices": [
|
28
|
+
{
|
29
|
+
"counter": 1,
|
30
|
+
"op": [
|
31
|
+
"unknown",
|
32
|
+
0
|
33
|
+
],
|
34
|
+
"ops": [
|
35
|
+
[
|
36
|
+
"unknown",
|
37
|
+
0
|
38
|
+
]
|
39
|
+
]
|
40
|
+
}
|
41
|
+
]
|
42
|
+
},
|
43
|
+
"objects": {
|
44
|
+
"nameToUUID": {
|
45
|
+
"tokenize": "tokenize1"
|
46
|
+
},
|
47
|
+
"namespaced": {
|
48
|
+
"tokenize1": {
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"processed": [
|
52
|
+
{
|
53
|
+
"context": {
|
54
|
+
"dead": true,
|
55
|
+
"level": 1,
|
56
|
+
"marker": "unknown",
|
57
|
+
"range": {
|
58
|
+
"end": 10,
|
59
|
+
"start": 0
|
60
|
+
},
|
61
|
+
"text": "hello_world",
|
62
|
+
"topLevel": true,
|
63
|
+
"unknown": true,
|
64
|
+
"value": "hello_world",
|
65
|
+
"word": "hello_world"
|
66
|
+
},
|
67
|
+
"generatedParenthesized": "",
|
68
|
+
"paraphrases": "",
|
69
|
+
"paraphrasesParenthesized": "()",
|
70
|
+
"responses": [
|
71
|
+
""
|
72
|
+
]
|
73
|
+
}
|
74
|
+
]
|
75
|
+
},
|
76
|
+
"paraphrases": [
|
77
|
+
""
|
78
|
+
],
|
79
|
+
"paraphrasesParenthesized": [
|
80
|
+
"()"
|
81
|
+
],
|
82
|
+
"query": "hello_world",
|
83
|
+
"responses": [
|
84
|
+
""
|
85
|
+
]
|
86
|
+
}
|
87
|
+
]
|