ekms 8.0.0-beta.9 → 8.0.0-beta.90
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 +2915 -1553
- 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 -29
- package/common/colors.instance.json +7487 -4114
- package/common/colors.js +5 -9
- 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 +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 +13553 -7026
- package/common/crew.js +37 -42
- package/common/crew.test.json +714 -452
- package/common/currency.js +28 -46
- package/common/dialogues.js +150 -426
- package/common/dialogues.test.json +0 -786
- package/common/dimension.instance.json +491 -262
- package/common/dimension.js +22 -24
- package/common/dimension.test.json +508 -1702
- package/common/edible.instance.json +20446 -10806
- package/common/edible.js +4 -9
- package/common/emotions.instance.json +192 -124
- 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 +222642 -113618
- package/common/fastfood.js +76 -86
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +443 -247
- package/common/formulas.js +20 -27
- package/common/gdefaults.js +40 -27
- package/common/help.js +9 -14
- package/common/help.test.json +65 -16
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +5 -3
- package/common/helpers/properties.js +67 -64
- package/common/helpers.js +35 -24
- package/common/hierarchy.js +17 -25
- package/common/javascript.js +12 -19
- package/common/kirk.instance.json +583 -299
- package/common/kirk.js +6 -9
- package/common/length.instance.json +9005 -5001
- package/common/length.js +5 -9
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +406 -1178
- package/common/math.js +17 -21
- package/common/meta.js +24 -48
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.js +11 -7
- package/common/numbers.js +28 -32
- package/common/ordering.instance.json +443 -343
- 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 +2210 -1150
- 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 +11845 -6590
- package/common/pipboy.js +51 -62
- package/common/pokemon.instance.json +4300 -2285
- package/common/pokemon.js +8 -21
- package/common/pos.js +16 -14
- package/common/pressure.instance.json +2325 -1340
- package/common/pressure.js +5 -9
- package/common/properties.instance.json +148 -88
- package/common/properties.js +149 -160
- package/common/punctuation.js +16 -8
- package/common/reports.instance.json +1019 -551
- package/common/reports.js +77 -101
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +19 -31
- package/common/sdefaults.js +17 -8
- package/common/sizeable.js +7 -11
- package/common/spock.instance.json +582 -298
- package/common/spock.js +6 -9
- package/common/stgame.js +20 -20
- package/common/stm.js +173 -31
- package/common/stm.test.json +1734 -1
- package/common/tell.js +15 -19
- package/common/temperature.instance.json +2430 -1429
- package/common/temperature.js +5 -9
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +21 -26
- package/common/tokenize.js +6 -7
- package/common/ui.instance.json +150 -463
- package/common/ui.js +22 -33
- package/common/ui.test.json +641 -5357
- package/common/weight.instance.json +8034 -4503
- package/common/weight.js +5 -9
- package/common/yesno.js +6 -6
- package/main.js +20 -4
- package/package.json +37 -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,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,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' },
|
@@ -31,17 +31,16 @@ 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',
|
42
41
|
contents: tokenize_tests,
|
43
42
|
checks: {
|
44
|
-
context: defaultContextCheck,
|
43
|
+
context: defaultContextCheck(),
|
45
44
|
},
|
46
45
|
},
|
47
46
|
})
|