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/formulas.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('./dialogues.js')
|
4
4
|
const pos = require('./pos.js')
|
@@ -91,7 +91,7 @@ class API {
|
|
91
91
|
}
|
92
92
|
*/
|
93
93
|
|
94
|
-
let
|
94
|
+
let config = {
|
95
95
|
name: 'formulas',
|
96
96
|
operators: [
|
97
97
|
// TODO notations like (([arg1:]) [op] ([arg2:nameOfArg2}|word1])) -> just make the bridge + operators. put this in the bridge def / also calculate generators
|
@@ -102,16 +102,16 @@ let configStruct = {
|
|
102
102
|
"(([expression]) [equals] ([expression]))",
|
103
103
|
],
|
104
104
|
priorities: [
|
105
|
-
{ "context": [['
|
105
|
+
{ "context": [['mathematical_operator', 0], ['number', 0], ], "choose": [0] },
|
106
106
|
],
|
107
107
|
semantics: [
|
108
108
|
{
|
109
109
|
where: where(),
|
110
110
|
match: ({context, api}) => context.evaluate && api.get(context),
|
111
|
-
apply: ({context, api, e}) => {
|
111
|
+
apply: async ({context, api, e}) => {
|
112
112
|
const { formula } = api.get(context)
|
113
113
|
// console.log('greg24 -----------', JSON.stringify(formula, null, 2))
|
114
|
-
context.evalue = e(formula)
|
114
|
+
context.evalue = await e(formula)
|
115
115
|
}
|
116
116
|
},
|
117
117
|
],
|
@@ -122,7 +122,7 @@ let configStruct = {
|
|
122
122
|
isA: ['preposition', 'queryable'],
|
123
123
|
convolution: true,
|
124
124
|
bridge: "{ number: before[0].number, ...next(operator), what: before[0], equality: after[0], variable: after[1] }",
|
125
|
-
generatorp: ({context, g}) => `${g(context.what)} ${g(context.equality)} ${g(context.variable)}`,
|
125
|
+
generatorp: async ({context, g}) => `${await g(context.what)} ${await g(context.equality)} ${await g(context.variable)}`,
|
126
126
|
evaluator: ({context, api, objects}) => {
|
127
127
|
const formulas = api.gets(context.variable).map((f) => { return { ...f.equality, paraphrase: true } })
|
128
128
|
context.evalue = { marker: 'list', value: formulas }
|
@@ -132,7 +132,7 @@ let configStruct = {
|
|
132
132
|
where: where(),
|
133
133
|
id: 'solve',
|
134
134
|
bridge: "{ ...next(operator), equality: after[0], variable: after[2] }",
|
135
|
-
generatorp: ({context, gp}) => `${context.word} ${gp(context.equality)} for ${gp(context.variable)}`,
|
135
|
+
generatorp: async ({context, gp}) => `${context.word} ${await gp(context.equality)} for ${await gp(context.variable)}`,
|
136
136
|
semantic: ({context}) => {
|
137
137
|
context.response = solveFor(context.equality, context.variable)
|
138
138
|
context.isResponse = true
|
@@ -153,17 +153,17 @@ let configStruct = {
|
|
153
153
|
{
|
154
154
|
id: 'expression',
|
155
155
|
children: ['mathematicalExpression', 'number'],
|
156
|
-
before: ['
|
156
|
+
before: ['verb'],
|
157
157
|
},
|
158
158
|
{
|
159
159
|
where: where(),
|
160
160
|
id: 'calculate',
|
161
|
-
isA: ['
|
161
|
+
isA: ['verb'],
|
162
162
|
bridge: "{ ...next(operator), expression: after[0] }",
|
163
|
-
generatorp: ({context, g}) => `${context.word} ${g(context.expression)}`,
|
163
|
+
generatorp: async ({context, g}) => `${context.word} ${await g(context.expression)}`,
|
164
164
|
localHierarchy: [ ['unknown', 'expression'] ],
|
165
|
-
semantic: ({context, e}) => {
|
166
|
-
context.evalue = e(context.expression)
|
165
|
+
semantic: async ({context, e}) => {
|
166
|
+
context.evalue = await e(context.expression)
|
167
167
|
context.isResponse = true
|
168
168
|
}
|
169
169
|
},
|
@@ -172,10 +172,10 @@ let configStruct = {
|
|
172
172
|
id: 'equals',
|
173
173
|
bridge: "{ ...next(operator), left: before[0], right: after[0] }",
|
174
174
|
words: ['='],
|
175
|
-
after: ['
|
175
|
+
after: ['mathematical_operator'],
|
176
176
|
// TODO have this be per argument then 'is' can map to equals where this only applied to before[0] and not after[0]
|
177
177
|
localHierarchy: [ ['unknown', 'expression'] ],
|
178
|
-
generatorp: ({context, gp}) => `${gp(context.left)} ${context.word} ${gp(context.right)}`,
|
178
|
+
generatorp: async ({context, gp}) => `${await gp(context.left)} ${context.word} ${await gp(context.right)}`,
|
179
179
|
semantic: ({context, api}) => {
|
180
180
|
// TODO make sure left is a single name
|
181
181
|
// TODO calculate invertable formulas?
|
@@ -188,31 +188,24 @@ let configStruct = {
|
|
188
188
|
const template = {
|
189
189
|
configs: [
|
190
190
|
"formulas are concepts",
|
191
|
-
|
191
|
+
config,
|
192
192
|
]
|
193
193
|
}
|
194
194
|
|
195
|
-
const createConfig = () => {
|
196
|
-
const api = new API()
|
197
|
-
config = new Config({ name: 'formulas' }, module)
|
198
|
-
config.stop_auto_rebuild()
|
199
|
-
config.add(dialogues(), pos(), math(), hierarchy(), comparable(), countable())
|
200
|
-
config.api = api
|
201
|
-
config.restart_auto_rebuild()
|
202
|
-
return config
|
203
|
-
}
|
204
|
-
|
205
195
|
knowledgeModule({
|
196
|
+
config: { name: 'formulas' },
|
197
|
+
includes: [dialogues, pos, math, hierarchy, comparable, countable],
|
198
|
+
api: () => new API(),
|
199
|
+
|
206
200
|
module,
|
207
201
|
description: 'Formulas using math',
|
208
|
-
createConfig,
|
209
202
|
template: { template, instance },
|
210
203
|
test: {
|
211
204
|
name: './formulas.test.json',
|
212
205
|
contents: tests,
|
213
206
|
checks: {
|
214
207
|
objects: ['formulas'],
|
215
|
-
context: defaultContextCheck,
|
208
|
+
context: defaultContextCheck(),
|
216
209
|
}
|
217
210
|
},
|
218
211
|
})
|
package/common/gdefaults.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
const pluralize = require('pluralize')
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
|
-
const {
|
3
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
4
4
|
const tokenize = require('./tokenize.js')
|
5
5
|
const gdefaults_tests = require('./gdefaults.test.json')
|
6
6
|
const { isMany } = require('./helpers.js')
|
7
7
|
|
8
|
-
let
|
8
|
+
let config = {
|
9
9
|
name: 'gdefaults',
|
10
10
|
generators: [
|
11
11
|
/* TODO save for later
|
@@ -23,20 +23,41 @@ let configStruct = {
|
|
23
23
|
/*
|
24
24
|
* modifiers = <list of properties>
|
25
25
|
*/
|
26
|
+
{
|
27
|
+
where: where(),
|
28
|
+
match: ({context}) => context.isResponse && context.response,
|
29
|
+
apply: ({context, gp}) => gp(context.response),
|
30
|
+
},
|
31
|
+
|
32
|
+
{
|
33
|
+
where: where(),
|
34
|
+
match: ({context}) => context.generate,
|
35
|
+
apply: async ({context, gs}) => {
|
36
|
+
const existing = context.generate.filter((key) => context[key] !== undefined)
|
37
|
+
const filtered = existing.filter((key) => {
|
38
|
+
if (context[key] && context[key].skipDefault) {
|
39
|
+
return false
|
40
|
+
}
|
41
|
+
return true
|
42
|
+
})
|
43
|
+
return gs(filtered.map((key) => context[key]))
|
44
|
+
}
|
45
|
+
},
|
46
|
+
|
26
47
|
{
|
27
48
|
where: where(),
|
28
49
|
//({context}) => context.paraphrase && context.modifiers,
|
29
50
|
// match: ({context}) => context.paraphrase && (context.modifiers || context.postModifiers),
|
30
51
|
match: ({context}) => (context.modifiers || context.postModifiers),
|
31
|
-
apply: ({context, g,
|
52
|
+
apply: async ({context, g, callId}) => {
|
32
53
|
const text = []
|
33
54
|
for (modifier of (context.modifiers || [])) {
|
34
55
|
if (Array.isArray(context[modifier])) {
|
35
56
|
for (let m of context[modifier]) {
|
36
|
-
text.push(g(m))
|
57
|
+
text.push(await g(m))
|
37
58
|
}
|
38
59
|
} else {
|
39
|
-
text.push(g(context[modifier], { isModifier: true }))
|
60
|
+
text.push(await g(context[modifier], { isModifier: true }))
|
40
61
|
}
|
41
62
|
}
|
42
63
|
// text.push(context.word)
|
@@ -47,15 +68,15 @@ let configStruct = {
|
|
47
68
|
number = isMany(context) ? 'many' : 'one'
|
48
69
|
}
|
49
70
|
if (context.postModifiers) {
|
50
|
-
text.push(g({...context, number: 'one', postModifiers: undefined, modifiers: undefined}))
|
71
|
+
text.push(await g({...context, number: 'one', postModifiers: undefined, modifiers: undefined}))
|
51
72
|
} else {
|
52
|
-
text.push(g({...context, number, postModifiers: undefined, modifiers: undefined}))
|
73
|
+
text.push(await g({...context, number, postModifiers: undefined, modifiers: undefined}))
|
53
74
|
}
|
54
75
|
for ([index, modifier] of (context.postModifiers || []).entries()) {
|
55
76
|
if (index == context.postModifiers.length - 1) {
|
56
|
-
text.push(g({...context[modifier], number}))
|
77
|
+
text.push(await g({...context[modifier], number}))
|
57
78
|
} else {
|
58
|
-
text.push(g(context[modifier]))
|
79
|
+
text.push(await g(context[modifier]))
|
59
80
|
}
|
60
81
|
}
|
61
82
|
return text.join(' ')
|
@@ -134,19 +155,19 @@ let configStruct = {
|
|
134
155
|
{
|
135
156
|
where: where(),
|
136
157
|
match: ({context}) => context.evalue,
|
137
|
-
apply: ({context, g}) => g(context.evalue)
|
158
|
+
apply: async ({context, g}) => await g(context.evalue)
|
138
159
|
},
|
139
160
|
|
140
161
|
{
|
141
162
|
where: where(),
|
142
163
|
match: ({context}) => context.value && Array.isArray(context.value),
|
143
|
-
apply: ({context, gs}) => gs(context.value)
|
164
|
+
apply: async ({context, gs}) => await gs(context.value)
|
144
165
|
},
|
145
166
|
|
146
167
|
{
|
147
168
|
where: where(),
|
148
169
|
match: ({context}) => context.value,
|
149
|
-
apply: ({context, g}) => g(context.value)
|
170
|
+
apply: async ({context, g}) => await g(context.value)
|
150
171
|
},
|
151
172
|
|
152
173
|
{
|
@@ -155,12 +176,6 @@ let configStruct = {
|
|
155
176
|
apply: ({context}) => `the ${context.word}`
|
156
177
|
},
|
157
178
|
|
158
|
-
{
|
159
|
-
where: where(),
|
160
|
-
match: ({context}) => context.isResponse && context.response,
|
161
|
-
apply: ({context, gp}) => gp(context.response),
|
162
|
-
},
|
163
|
-
|
164
179
|
{
|
165
180
|
where: where(),
|
166
181
|
match: ({context}) => context.word,
|
@@ -181,10 +196,7 @@ let configStruct = {
|
|
181
196
|
],
|
182
197
|
};
|
183
198
|
|
184
|
-
const
|
185
|
-
const config = new Config(configStruct, module)
|
186
|
-
config.add(tokenize())
|
187
|
-
config.initializer( ({config}) => {
|
199
|
+
const initializer = ({config}) => {
|
188
200
|
config.addArgs((args) => {
|
189
201
|
return {
|
190
202
|
number: (context) => isMany(context) ? "many" : "one",
|
@@ -198,19 +210,20 @@ const createConfig = () => {
|
|
198
210
|
},
|
199
211
|
}
|
200
212
|
})
|
201
|
-
}
|
202
|
-
return config
|
203
|
-
}
|
213
|
+
}
|
204
214
|
|
205
215
|
knowledgeModule({
|
216
|
+
config,
|
217
|
+
includes: [tokenize],
|
218
|
+
initializer,
|
219
|
+
|
206
220
|
module,
|
207
221
|
description: 'defaults for generators',
|
208
|
-
createConfig,
|
209
222
|
test: {
|
210
223
|
name: './gdefaults.test.json',
|
211
224
|
contents: gdefaults_tests,
|
212
225
|
checks: {
|
213
|
-
context: defaultContextCheck,
|
226
|
+
context: defaultContextCheck(),
|
214
227
|
},
|
215
228
|
|
216
229
|
},
|
package/common/help.js
CHANGED
@@ -22,7 +22,7 @@ const getHelp = (config, indent=2) => {
|
|
22
22
|
return help
|
23
23
|
}
|
24
24
|
|
25
|
-
const
|
25
|
+
const config = {
|
26
26
|
name: 'help',
|
27
27
|
operators: [
|
28
28
|
"([help] ([withKM|with] ([km]))?)",
|
@@ -67,7 +67,7 @@ const configStruct = {
|
|
67
67
|
|
68
68
|
return help
|
69
69
|
},
|
70
|
-
optional: {
|
70
|
+
optional: { 1: "{ marker: 'km', kms: []}" },
|
71
71
|
bridge: "{ ...next(operator), kms: after[0].kms, isResponse: true }"
|
72
72
|
},
|
73
73
|
{ id: "withKM", level: 0, bridge: "{ ...next(operator), kms: after[0] }" },
|
@@ -82,12 +82,7 @@ const configStruct = {
|
|
82
82
|
},
|
83
83
|
};
|
84
84
|
|
85
|
-
const
|
86
|
-
const config = new Config(configStruct, module)
|
87
|
-
config.stop_auto_rebuild()
|
88
|
-
config.add(dialogues())
|
89
|
-
|
90
|
-
config.initializer( ({ config, addWord, kms }) => {
|
85
|
+
const initializer = ({ config, addWord, kms }) => {
|
91
86
|
const names = new Set()
|
92
87
|
for (let name in kms) {
|
93
88
|
names.add(name);
|
@@ -95,20 +90,20 @@ const createConfig = () => {
|
|
95
90
|
for (let name of names) {
|
96
91
|
addWord(name, {id: "km", initial: `{ value: '${name}', word: '${name}' }`})
|
97
92
|
}
|
98
|
-
}
|
99
|
-
config.restart_auto_rebuild()
|
100
|
-
return config
|
101
|
-
}
|
93
|
+
}
|
102
94
|
|
103
95
|
knowledgeModule({
|
96
|
+
config,
|
97
|
+
includes: [dialogues],
|
98
|
+
initializer,
|
99
|
+
|
104
100
|
module,
|
105
101
|
description: 'Help the user with the current knowledge modules',
|
106
|
-
createConfig,
|
107
102
|
test: {
|
108
103
|
name: './help.test.json',
|
109
104
|
contents: help_tests,
|
110
105
|
checks: {
|
111
|
-
context: defaultContextCheck,
|
106
|
+
context: defaultContextCheck(),
|
112
107
|
},
|
113
108
|
},
|
114
109
|
})
|
package/common/help.test.json
CHANGED
@@ -24,10 +24,6 @@
|
|
24
24
|
"help",
|
25
25
|
0
|
26
26
|
],
|
27
|
-
[
|
28
|
-
"km",
|
29
|
-
0
|
30
|
-
],
|
31
27
|
[
|
32
28
|
"list",
|
33
29
|
0
|
@@ -91,7 +87,8 @@
|
|
91
87
|
"word": "help"
|
92
88
|
},
|
93
89
|
{
|
94
|
-
"
|
90
|
+
"dead": true,
|
91
|
+
"level": 1,
|
95
92
|
"marker": "km",
|
96
93
|
"range": {
|
97
94
|
"end": 27,
|
@@ -120,7 +117,7 @@
|
|
120
117
|
}
|
121
118
|
],
|
122
119
|
"generatedParenthesized": [
|
123
|
-
"( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n
|
120
|
+
"( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)"
|
124
121
|
],
|
125
122
|
"metadata": {
|
126
123
|
"opChoices": [
|
@@ -156,7 +153,7 @@
|
|
156
153
|
{
|
157
154
|
"counter": 2,
|
158
155
|
"op": [
|
159
|
-
"
|
156
|
+
"km",
|
160
157
|
0
|
161
158
|
],
|
162
159
|
"ops": [
|
@@ -181,7 +178,7 @@
|
|
181
178
|
{
|
182
179
|
"counter": 3,
|
183
180
|
"op": [
|
184
|
-
"
|
181
|
+
"list",
|
185
182
|
0
|
186
183
|
],
|
187
184
|
"ops": [
|
@@ -189,6 +186,10 @@
|
|
189
186
|
"help",
|
190
187
|
0
|
191
188
|
],
|
189
|
+
[
|
190
|
+
"list",
|
191
|
+
0
|
192
|
+
],
|
192
193
|
[
|
193
194
|
"withKM",
|
194
195
|
0
|
@@ -197,6 +198,23 @@
|
|
197
198
|
},
|
198
199
|
{
|
199
200
|
"counter": 4,
|
201
|
+
"op": [
|
202
|
+
"withKM",
|
203
|
+
0
|
204
|
+
],
|
205
|
+
"ops": [
|
206
|
+
[
|
207
|
+
"help",
|
208
|
+
0
|
209
|
+
],
|
210
|
+
[
|
211
|
+
"withKM",
|
212
|
+
0
|
213
|
+
]
|
214
|
+
]
|
215
|
+
},
|
216
|
+
{
|
217
|
+
"counter": 5,
|
200
218
|
"op": [
|
201
219
|
"help",
|
202
220
|
0
|
@@ -212,10 +230,15 @@
|
|
212
230
|
},
|
213
231
|
"objects": {
|
214
232
|
"nameToUUID": {
|
233
|
+
"articles": "articles2",
|
234
|
+
"asking": "asking2",
|
235
|
+
"conjunction": "conjunction2",
|
215
236
|
"dialogues": "dialogues2",
|
237
|
+
"evaluate": "evaluate2",
|
216
238
|
"gdefaults": "gdefaults2",
|
217
239
|
"help": "help1",
|
218
240
|
"meta": "meta2",
|
241
|
+
"negation": "negation2",
|
219
242
|
"pos": "pos2",
|
220
243
|
"punctuation": "punctuation2",
|
221
244
|
"sdefaults": "sdefaults2",
|
@@ -223,6 +246,12 @@
|
|
223
246
|
"tokenize": "tokenize2"
|
224
247
|
},
|
225
248
|
"namespaced": {
|
249
|
+
"articles2": {
|
250
|
+
},
|
251
|
+
"asking2": {
|
252
|
+
},
|
253
|
+
"conjunction2": {
|
254
|
+
},
|
226
255
|
"dialogues2": {
|
227
256
|
"idSuffix": "",
|
228
257
|
"mentioned": [
|
@@ -230,12 +259,16 @@
|
|
230
259
|
"variables": {
|
231
260
|
}
|
232
261
|
},
|
262
|
+
"evaluate2": {
|
263
|
+
},
|
233
264
|
"gdefaults2": {
|
234
265
|
},
|
235
266
|
"help1": {
|
236
267
|
},
|
237
268
|
"meta2": {
|
238
269
|
},
|
270
|
+
"negation2": {
|
271
|
+
},
|
239
272
|
"pos2": {
|
240
273
|
},
|
241
274
|
"punctuation2": {
|
@@ -289,7 +322,8 @@
|
|
289
322
|
"word": "help"
|
290
323
|
},
|
291
324
|
{
|
292
|
-
"
|
325
|
+
"dead": true,
|
326
|
+
"level": 1,
|
293
327
|
"marker": "km",
|
294
328
|
"range": {
|
295
329
|
"end": 27,
|
@@ -316,11 +350,11 @@
|
|
316
350
|
"value": "help",
|
317
351
|
"word": "help"
|
318
352
|
},
|
319
|
-
"generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n
|
353
|
+
"generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)",
|
320
354
|
"paraphrases": "help",
|
321
355
|
"paraphrasesParenthesized": "(help)",
|
322
356
|
"responses": [
|
323
|
-
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n
|
357
|
+
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
|
324
358
|
]
|
325
359
|
}
|
326
360
|
]
|
@@ -333,7 +367,7 @@
|
|
333
367
|
],
|
334
368
|
"query": "help with help and dialogues",
|
335
369
|
"responses": [
|
336
|
-
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n
|
370
|
+
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
|
337
371
|
]
|
338
372
|
},
|
339
373
|
{
|
@@ -361,7 +395,7 @@
|
|
361
395
|
}
|
362
396
|
],
|
363
397
|
"generatedParenthesized": [
|
364
|
-
"( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n
|
398
|
+
"( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)"
|
365
399
|
],
|
366
400
|
"metadata": {
|
367
401
|
"opChoices": [
|
@@ -382,10 +416,15 @@
|
|
382
416
|
},
|
383
417
|
"objects": {
|
384
418
|
"nameToUUID": {
|
419
|
+
"articles": "articles2",
|
420
|
+
"asking": "asking2",
|
421
|
+
"conjunction": "conjunction2",
|
385
422
|
"dialogues": "dialogues2",
|
423
|
+
"evaluate": "evaluate2",
|
386
424
|
"gdefaults": "gdefaults2",
|
387
425
|
"help": "help1",
|
388
426
|
"meta": "meta2",
|
427
|
+
"negation": "negation2",
|
389
428
|
"pos": "pos2",
|
390
429
|
"punctuation": "punctuation2",
|
391
430
|
"sdefaults": "sdefaults2",
|
@@ -393,6 +432,12 @@
|
|
393
432
|
"tokenize": "tokenize2"
|
394
433
|
},
|
395
434
|
"namespaced": {
|
435
|
+
"articles2": {
|
436
|
+
},
|
437
|
+
"asking2": {
|
438
|
+
},
|
439
|
+
"conjunction2": {
|
440
|
+
},
|
396
441
|
"dialogues2": {
|
397
442
|
"idSuffix": "",
|
398
443
|
"mentioned": [
|
@@ -400,12 +445,16 @@
|
|
400
445
|
"variables": {
|
401
446
|
}
|
402
447
|
},
|
448
|
+
"evaluate2": {
|
449
|
+
},
|
403
450
|
"gdefaults2": {
|
404
451
|
},
|
405
452
|
"help1": {
|
406
453
|
},
|
407
454
|
"meta2": {
|
408
455
|
},
|
456
|
+
"negation2": {
|
457
|
+
},
|
409
458
|
"pos2": {
|
410
459
|
},
|
411
460
|
"punctuation2": {
|
@@ -440,11 +489,11 @@
|
|
440
489
|
"value": "help",
|
441
490
|
"word": "help"
|
442
491
|
},
|
443
|
-
"generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n
|
492
|
+
"generatedParenthesized": "( NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)",
|
444
493
|
"paraphrases": "help",
|
445
494
|
"paraphrasesParenthesized": "(help)",
|
446
495
|
"responses": [
|
447
|
-
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n
|
496
|
+
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
|
448
497
|
]
|
449
498
|
}
|
450
499
|
]
|
@@ -457,7 +506,7 @@
|
|
457
506
|
],
|
458
507
|
"query": "help",
|
459
508
|
"responses": [
|
460
|
-
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n
|
509
|
+
" NAME: help\n DESCRIPTION: Help the user with the current knowledge modules\n\n SAMPLE SENTENCES\n\n help with help and dialogues\n help\n\n NAME: dialogues\n DESCRIPTION: framework for dialogues\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n be brief\n be brief greg\n is x y\n no\n what is it\n x is y?\n yes\n x is 3 what is x\n x is 3 what is x what is it\n be brief x is 3 what is x what is it\n to it\n why\n setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n NAME: asking\n DESCRIPTION: asking the user questions\n\n SAMPLE SENTENCES\n\n nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n whichOnesTestSetup apple banana pear\\npear\n whichOnesTestSetup apple banana pear\\ngoat\n whichOnesTestSetup apple banana pear\\nnevermind\n whichOnesTestSetup apple banana pear\\napple and pear\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\n NAME: stm\n DESCRIPTION: short term memory\n\n SAMPLE SENTENCES\n\n remember m1\n previous memorable\n m1\n remember m1\\nevaluate the memorable\n the memorable before\n remember m1\\nremember m2\\nevaluate the memorable before\n\n NAME: meta\n DESCRIPTION: Ways of defining new language elements\n\n SAMPLE SENTENCES\n\n a means b\n a means x\n if f then g gq\n undefined means defined\n\n NAME: conjunction\n DESCRIPTION: framework for conjunction\n\n SAMPLE SENTENCES\n\n 1 2 and 3\n\n NAME: evaluate\n DESCRIPTION: Explicit handling of evaluate\n\n SAMPLE SENTENCES\n\n evaluate value1\n\n NAME: articles\n DESCRIPTION: articles\n\n SAMPLE SENTENCES\n\n the theable\n a theable\n\n\n\n NAME: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
|
461
510
|
]
|
462
511
|
}
|
463
512
|
]
|
@@ -34,10 +34,9 @@ class API {
|
|
34
34
|
// TODO make the modifiers objects then below for add words for modifiers only do if !unknown
|
35
35
|
// const objectId = pluralize.singular(object)
|
36
36
|
const objectId = this.args.kms.dialogues.api.toScopedId(object)
|
37
|
-
|
38
37
|
// const modifierIds = modifiers.map( (modifier) => pluralize.singular(modifier) )
|
39
38
|
const modifierIds = modifiers.map( (modifier) => this.args.kms.dialogues.api.toScopedId(modifier) )
|
40
|
-
const modifiersObjectId = `${
|
39
|
+
const modifiersObjectId = `${modifierIds.join("_")}_${objectId}`
|
41
40
|
|
42
41
|
const toWord = (object) => {
|
43
42
|
if (typeof object == 'string') {
|
@@ -76,11 +75,14 @@ class API {
|
|
76
75
|
config.addWord(objectPlural, { id: objectId, initial: `{ value: '${objectId}', number: 'many' }`})
|
77
76
|
}
|
78
77
|
|
79
|
-
zip(modifiers, modifierIds).forEach(([
|
78
|
+
zip(modifiers, modifierIds).forEach(([modifier, modifierId]) => {
|
80
79
|
// config.addWord(modifier, { id: modifierId, initial: `{ value: '${modifierId}' }`})
|
81
80
|
// TODO call evaluator to pick up overrides
|
82
|
-
|
83
|
-
|
81
|
+
if (modifier.unknown) {
|
82
|
+
const modifierWord = modifier.text
|
83
|
+
config.addWord(pluralize.singular(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'one' }`})
|
84
|
+
config.addWord(pluralize.plural(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'many' }`})
|
85
|
+
}
|
84
86
|
})
|
85
87
|
// modifierds.forEach((modifierId) => config.addWord(modifierId, { id: modifierId, initial: `{ value: '${modifierId}' }`}))
|
86
88
|
|
@@ -94,8 +96,9 @@ class API {
|
|
94
96
|
id: modifiersObjectId,
|
95
97
|
level: 0,
|
96
98
|
convolution: true,
|
97
|
-
isA: ['adjective'],
|
98
|
-
|
99
|
+
isA: [{ parent: 'adjective', instance: true }],
|
100
|
+
// isA: ['adjective'],
|
101
|
+
before: ['verb'],
|
99
102
|
bridge: `{ ...after[0], ${modifierProperties}, atomic: true, dead: true, marker: next(operator('${modifiersObjectId}')), value: '${modifiersObjectId}', modifiers: append([${modifierList}], after[0].modifiers)}`,
|
100
103
|
allowDups: true })
|
101
104
|
{
|
@@ -50,10 +50,9 @@ class API {
|
|
50
50
|
return this._objects.brief
|
51
51
|
}
|
52
52
|
|
53
|
-
evaluateToConcept(value, context, log, s) {
|
53
|
+
async evaluateToConcept(value, context, log, s) {
|
54
54
|
value.evaluate = { toConcept: true }
|
55
|
-
|
56
|
-
const concept = s(value)
|
55
|
+
const concept = await s(value)
|
57
56
|
if (!concept.evalue && !concept.verbatim) {
|
58
57
|
this.warningNotEvaluated(log, value);
|
59
58
|
concept.evalue = concept.value
|
@@ -64,6 +63,9 @@ class API {
|
|
64
63
|
|
65
64
|
setupObjectHierarchy(config, id, { types } = {}) {
|
66
65
|
for (let type of types) {
|
66
|
+
if (typeof type !== 'string') {
|
67
|
+
type = type.word
|
68
|
+
}
|
67
69
|
config.addHierarchy(id, type)
|
68
70
|
}
|
69
71
|
}
|