ekms 8.0.0-beta.7 → 8.0.0-beta.71
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +2871 -1379
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/avatar.js +5 -9
- package/common/characters.js +22 -28
- package/common/colors.instance.json +7170 -3657
- package/common/colors.js +4 -8
- package/common/colors.test.json +345 -780
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +438 -2
- package/common/concept.js +120 -118
- package/common/countable.js +19 -13
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +13066 -6469
- package/common/crew.js +36 -41
- package/common/crew.test.json +714 -452
- package/common/currency.js +27 -45
- package/common/dialogues.js +161 -285
- package/common/dimension.instance.json +474 -253
- package/common/dimension.js +16 -22
- package/common/dimension.test.json +446 -1640
- package/common/edible.instance.json +20053 -10093
- package/common/edible.js +3 -8
- package/common/emotions.instance.json +147 -69
- package/common/emotions.js +35 -38
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +49 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +10 -14
- package/common/fastfood.instance.json +221166 -111223
- package/common/fastfood.js +75 -85
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +455 -249
- package/common/formulas.js +19 -26
- package/common/gdefaults.js +24 -26
- package/common/help.js +7 -12
- package/common/help.test.json +63 -8
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +54 -62
- package/common/helpers.js +6 -5
- package/common/hierarchy.js +16 -24
- package/common/javascript.js +11 -18
- package/common/kirk.instance.json +584 -290
- package/common/kirk.js +5 -8
- package/common/length.instance.json +8834 -4757
- package/common/length.js +4 -8
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +425 -1187
- package/common/math.js +16 -20
- package/common/meta.js +23 -47
- 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 +27 -31
- package/common/ordering.instance.json +366 -246
- package/common/ordering.js +80 -86
- package/common/people.instance.json +2074 -1022
- package/common/people.js +8 -13
- 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 +11745 -6329
- package/common/pipboy.js +48 -59
- package/common/pokemon.instance.json +4226 -2081
- package/common/pokemon.js +7 -20
- package/common/pos.js +15 -13
- package/common/pressure.instance.json +2208 -1175
- package/common/pressure.js +4 -8
- package/common/properties.instance.json +131 -61
- package/common/properties.js +57 -134
- package/common/punctuation.js +15 -7
- package/common/reports.instance.json +1018 -530
- package/common/reports.js +77 -100
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +18 -30
- package/common/sdefaults.js +16 -7
- package/common/sizeable.js +6 -10
- package/common/spock.instance.json +584 -290
- package/common/spock.js +5 -8
- package/common/stgame.js +19 -19
- package/common/stm.js +164 -27
- package/common/stm.test.json +1734 -1
- package/common/tell.js +14 -18
- package/common/temperature.instance.json +2271 -1222
- package/common/temperature.js +4 -8
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +20 -25
- package/common/tokenize.js +5 -6
- package/common/ui.instance.json +459 -240
- package/common/ui.js +16 -22
- package/common/weight.instance.json +7646 -4026
- package/common/weight.js +4 -8
- package/common/yesno.js +5 -5
- package/main.js +14 -2
- package/package.json +28 -5
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,16 +14,12 @@ 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,
|
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,9 +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
|
-
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)
|
19
19
|
context.isResponse = true
|
20
20
|
},
|
21
21
|
bridge: "{ ...next(operator), value: after[0] }",
|
@@ -30,16 +30,12 @@ let configStruct = {
|
|
30
30
|
],
|
31
31
|
};
|
32
32
|
|
33
|
-
const createConfig = () => {
|
34
|
-
const config = new Config(configStruct, module)
|
35
|
-
config.add(gdefaults())
|
36
|
-
return config
|
37
|
-
}
|
38
|
-
|
39
33
|
knowledgeModule({
|
34
|
+
config,
|
35
|
+
includes: [gdefaults],
|
36
|
+
|
40
37
|
module,
|
41
38
|
description: 'code for testing',
|
42
|
-
createConfig,
|
43
39
|
test: {
|
44
40
|
name: './testing.test.json',
|
45
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,31 +169,27 @@ 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,
|
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' },
|
@@ -31,11 +31,10 @@ let configStruct = {
|
|
31
31
|
},
|
32
32
|
};
|
33
33
|
|
34
|
-
createConfig = () => new Config(configStruct, module)
|
35
|
-
|
36
34
|
knowledgeModule( {
|
35
|
+
config,
|
36
|
+
|
37
37
|
module,
|
38
|
-
createConfig,
|
39
38
|
description: 'tokenize',
|
40
39
|
test: {
|
41
40
|
name: './tokenize.test.json',
|