ekms 8.0.0-beta.7 → 8.0.0-beta.70
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/scorekeeper.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')
|
@@ -43,7 +43,7 @@ const setNextPlayer = (km, objects) => {
|
|
43
43
|
word: "turn"
|
44
44
|
}
|
45
45
|
const api = km('stm').api
|
46
|
-
api.mentioned(turn)
|
46
|
+
api.mentioned({ context: turn })
|
47
47
|
}
|
48
48
|
|
49
49
|
const addPlayer = (objects, config, player) => {
|
@@ -51,7 +51,7 @@ const addPlayer = (objects, config, player) => {
|
|
51
51
|
objects.players.push(player);
|
52
52
|
}
|
53
53
|
|
54
|
-
let
|
54
|
+
let config = {
|
55
55
|
name: 'scorekeeper',
|
56
56
|
operators: [
|
57
57
|
"([next])",
|
@@ -122,36 +122,29 @@ let configStruct = {
|
|
122
122
|
{
|
123
123
|
where: where(),
|
124
124
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.isResponse && context.two && context.two.marker == 'next',
|
125
|
-
apply: ({context, g}) => {
|
125
|
+
apply: async ({context, g}) => {
|
126
126
|
const response = context.evalue;
|
127
127
|
const concept = response.two;
|
128
128
|
concept.paraphrase = true
|
129
129
|
concept.isSelf = true
|
130
|
-
const instance = g(concept.evalue)
|
130
|
+
const instance = await g(concept.evalue)
|
131
131
|
return instance
|
132
132
|
}
|
133
133
|
},
|
134
134
|
{
|
135
135
|
where: where(),
|
136
136
|
match: ({context}) => context.marker == 'point' && context.isResponse && context.amount,
|
137
|
-
apply: ({context, g}) => `${g(context.amount)} points`
|
137
|
+
apply: async ({context, g}) => `${await g(context.amount)} points`
|
138
138
|
},
|
139
139
|
{
|
140
140
|
where: where(),
|
141
141
|
match: ({context}) => context.marker == 'scored' && context.paraphrase,
|
142
|
-
apply: ({context, g}) => `${g(context.player)} got ${g(context.points)}`
|
142
|
+
apply: async ({context, g}) => `${await g(context.player)} got ${await g(context.points)}`
|
143
143
|
},
|
144
|
-
/*
|
145
|
-
{
|
146
|
-
where: where(),
|
147
|
-
match: ({context}) => context.marker == 'enumeration' && context.paraphrase,
|
148
|
-
apply: ({context, g}) => `${g(context.concept)} are ${g(context.items)}`
|
149
|
-
},
|
150
|
-
*/
|
151
144
|
{
|
152
145
|
where: where(),
|
153
146
|
match: ({context}) => context.marker == 'start' && context.paraphrase,
|
154
|
-
apply: ({context, g}) => `start ${g(context.arg)}`
|
147
|
+
apply: async ({context, g}) => `start ${await g(context.arg)}`
|
155
148
|
},
|
156
149
|
|
157
150
|
],
|
@@ -161,7 +154,6 @@ let configStruct = {
|
|
161
154
|
where: where(),
|
162
155
|
match: ({context}) => context.marker == 'player' && context.same,
|
163
156
|
apply: ({context, objects, config, km}) => {
|
164
|
-
//objects.players = context.same.value.map( (props) => props.value )
|
165
157
|
const players = context.same.value.map( (props) => props.value )
|
166
158
|
setPlayers(objects, config, players)
|
167
159
|
for (let player of objects.players) {
|
@@ -205,11 +197,11 @@ let configStruct = {
|
|
205
197
|
matchq: ({objects}) => objects.players.length == 0,
|
206
198
|
applyq: () => 'who are the players?',
|
207
199
|
matchr: ({context}) => context.marker == 'list',
|
208
|
-
applyr: ({context, gs, objects, config}) => {
|
200
|
+
applyr: async ({context, gs, objects, config}) => {
|
209
201
|
const players = context.value.map( (player) => player.value )
|
210
202
|
setPlayers(objects, config, players)
|
211
203
|
objects.allPlayersAreKnown = true;
|
212
|
-
context.verbatim = `The players are ${gs(objects.players, ' ', ' and ')}`
|
204
|
+
context.verbatim = `The players are ${await gs(objects.players, ' ', ' and ')}`
|
213
205
|
context.isResponse = true;
|
214
206
|
}
|
215
207
|
}
|
@@ -242,12 +234,12 @@ let configStruct = {
|
|
242
234
|
{
|
243
235
|
where: where(),
|
244
236
|
match: ({context}) => context.marker == 'player' && context.evaluate && context.pullFromContext,
|
245
|
-
apply: ({context, objects, gs}) => {
|
237
|
+
apply: async ({context, objects, gs}) => {
|
246
238
|
const players = objects.players
|
247
239
|
if (players.length == 0) {
|
248
240
|
context.evalue = 'no one'
|
249
241
|
} else {
|
250
|
-
context.evalue = gs(players, ' ', ' and ')
|
242
|
+
context.evalue = await gs(players, ' ', ' and ')
|
251
243
|
}
|
252
244
|
}
|
253
245
|
},
|
@@ -350,21 +342,14 @@ let configStruct = {
|
|
350
342
|
],
|
351
343
|
};
|
352
344
|
|
353
|
-
const
|
354
|
-
const config = new Config(configStruct, module)
|
355
|
-
config.stop_auto_rebuild()
|
356
|
-
config.add(dialogues(), numbers(), properties())
|
357
|
-
config.initializer( ({objects, km, isModule}) => {
|
345
|
+
const initializer = ({objects, km, isModule}) => {
|
358
346
|
objects.players = []
|
359
347
|
objects.nextPlayer = undefined;
|
360
348
|
setNextPlayer(km, objects);
|
361
349
|
objects.scores = {};
|
362
350
|
objects.winningScore = null
|
363
351
|
objects.allPlayersAreKnown = false;
|
364
|
-
}
|
365
|
-
config.restart_auto_rebuild()
|
366
|
-
return config
|
367
|
-
}
|
352
|
+
}
|
368
353
|
|
369
354
|
startWithDefault20 = [
|
370
355
|
"greg got 1 point alice got 2 points greg got 1 point start a new game who is next",
|
@@ -382,9 +367,12 @@ startWithDefault20 = [
|
|
382
367
|
]
|
383
368
|
|
384
369
|
knowledgeModule( {
|
370
|
+
config,
|
371
|
+
includes: [dialogues, numbers, properties],
|
372
|
+
initializer,
|
373
|
+
|
385
374
|
module,
|
386
375
|
description: 'scorekeeper for card or dice games',
|
387
|
-
createConfig,
|
388
376
|
test: {
|
389
377
|
name: './scorekeeper.test.json',
|
390
378
|
contents: scorekeeper_tests,
|
package/common/sdefaults.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
const {
|
1
|
+
const { flatten, knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const sdefaults_tests = require('./sdefaults.test.json')
|
4
4
|
|
5
|
-
let
|
5
|
+
let config = {
|
6
6
|
name: 'sdefaults',
|
7
7
|
semantics: [
|
8
8
|
{
|
@@ -12,22 +12,31 @@ let configStruct = {
|
|
12
12
|
// match: ({context}) => context.flatten || context.listable && context.value[0].flatten,
|
13
13
|
match: ({context}) => context.flatten || context.listable && context.value.some((value) => value.flatten),
|
14
14
|
// match: ({context}) => context.flatten || context.listable || (Array.isArray(context.value) && context.value.some((value) => value.flatten)),
|
15
|
-
apply: ({config, km, context, s}) => {
|
15
|
+
apply: async ({config, km, context, s}) => {
|
16
16
|
const [flats, wf] = flatten(['list'], context)
|
17
17
|
for (let flat of flats) {
|
18
|
-
s({ ...flat, flatten: false })
|
18
|
+
await s({ ...flat, flatten: false })
|
19
19
|
}
|
20
20
|
}
|
21
21
|
},
|
22
|
+
{
|
23
|
+
notes: 'semanticIsEvaluate',
|
24
|
+
where: where(),
|
25
|
+
priority: -1,
|
26
|
+
match: ({context}) => context.semanticIsEvaluate,
|
27
|
+
apply: async ({context, e}) => {
|
28
|
+
context.value = await e({ ...context, semanticIsEvaluate: false })
|
29
|
+
context.isResponse
|
30
|
+
}
|
31
|
+
},
|
22
32
|
],
|
23
33
|
};
|
24
34
|
|
25
|
-
const createConfig = () => new Config(configStruct, module)
|
26
|
-
|
27
35
|
knowledgeModule({
|
36
|
+
config,
|
37
|
+
|
28
38
|
module,
|
29
39
|
description: 'defaults for semantics',
|
30
|
-
createConfig,
|
31
40
|
test: {
|
32
41
|
name: './sdefaults.test.json',
|
33
42
|
contents: sdefaults_tests,
|
package/common/sizeable.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 dialogues = require("./hierarchy")
|
4
4
|
const numbers = require("./numbers")
|
@@ -6,7 +6,7 @@ const sizeable_tests = require('./sizeable.test.json')
|
|
6
6
|
|
7
7
|
// TODO 1 to 2 sizeables
|
8
8
|
|
9
|
-
let
|
9
|
+
let config = {
|
10
10
|
name: 'sizeable',
|
11
11
|
operators: [
|
12
12
|
"(([size|]) [sizing] ([sizeable]))",
|
@@ -16,7 +16,7 @@ let configStruct = {
|
|
16
16
|
id: "sizing",
|
17
17
|
level: 0,
|
18
18
|
convolution: true,
|
19
|
-
before: ['
|
19
|
+
before: ['verb'],
|
20
20
|
bridge: "{ ...after, size: before[0], modifiers: append(['size'], after.modifiers) }"
|
21
21
|
},
|
22
22
|
{
|
@@ -52,16 +52,12 @@ let configStruct = {
|
|
52
52
|
]
|
53
53
|
};
|
54
54
|
|
55
|
-
const createConfig = () => {
|
56
|
-
const config = new Config(configStruct, module)
|
57
|
-
config.add(dialogues(), numbers())
|
58
|
-
return config
|
59
|
-
}
|
60
|
-
|
61
55
|
knowledgeModule({
|
56
|
+
config,
|
57
|
+
includes: [dialogues, numbers],
|
58
|
+
|
62
59
|
module,
|
63
60
|
description: 'Sizeable things',
|
64
|
-
createConfig,
|
65
61
|
test: {
|
66
62
|
name: './sizeable.test.json',
|
67
63
|
contents: sizeable_tests,
|