ekms 8.0.0-beta.0 → 8.0.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +2634 -1477
- package/common/characters.js +0 -1
- package/common/colors.instance.json +25327 -0
- package/common/colors.js +71 -0
- package/common/colors.test.json +4860 -0
- package/common/concept.js +2 -2
- package/common/crew.instance.json +15918 -9384
- package/common/crew.js +4 -2
- package/common/crew.test.json +714 -452
- package/common/dialogues.js +36 -25
- package/common/dialogues.test.json +1053 -33
- package/common/dimension.instance.json +261 -290
- package/common/dimension.test.json +476 -687
- package/common/edible.instance.json +19462 -10130
- package/common/emotions.instance.json +125 -68
- package/common/fastfood.instance.json +219732 -110803
- package/common/fastfood.js +1 -1
- package/common/fastfood.test.json +7941 -3647
- package/common/formulas.instance.json +219 -249
- package/common/formulas.js +2 -2
- package/common/formulas.test.json +1027 -955
- package/common/help.test.json +20 -28
- package/common/helpers/concept.js +31 -10
- package/common/helpers/dialogues.js +17 -1
- package/common/helpers/formulas.js +0 -14
- package/common/helpers/meta.js +0 -1
- package/common/helpers/properties.js +6 -13
- package/common/kirk.instance.json +567 -289
- package/common/length.instance.json +5232 -4726
- package/common/math.instance.json +143 -1181
- package/common/math.js +4 -4
- package/common/meta.js +0 -2
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/ordering.instance.json +298 -160
- package/common/people.instance.json +1930 -1068
- package/common/pipboy.instance.json +7868 -6548
- package/common/pokemon.instance.json +4074 -2152
- package/common/pressure.instance.json +1299 -1237
- package/common/properties.instance.json +109 -60
- package/common/properties.js +9 -7
- package/common/properties.test.json +17605 -4030
- package/common/punctuation.js +8 -0
- package/common/punctuation.test.json +233 -5
- package/common/reports.instance.json +566 -560
- package/common/reports.js +0 -2
- package/common/sizeable.js +7 -2
- package/common/spock.instance.json +567 -289
- package/common/stm.js +16 -5
- package/common/temperature.instance.json +1337 -1263
- package/common/testing.js +0 -1
- package/common/tokenize.js +2 -1
- package/common/tokenize.test.json +86 -1
- package/common/ui.instance.json +241 -258
- package/common/ui.js +0 -1
- package/common/weight.instance.json +4996 -4206
- package/common/weight.test.json +242 -238
- package/main.js +50 -45
- package/package.json +13 -6
package/common/dialogues.js
CHANGED
@@ -3,6 +3,7 @@ const meta = require('./meta.js')
|
|
3
3
|
const gdefaults = require('./gdefaults.js')
|
4
4
|
const sdefaults = require('./sdefaults.js')
|
5
5
|
const pos = require('./pos.js')
|
6
|
+
const negation = require('./negation.js')
|
6
7
|
const punctuation = require('./punctuation.js')
|
7
8
|
const stm = require('./stm.js')
|
8
9
|
const _ = require('lodash')
|
@@ -36,6 +37,10 @@ const warningSameNotEvaluated = (log, one) => {
|
|
36
37
|
let configStruct = {
|
37
38
|
name: 'dialogues',
|
38
39
|
operators: [
|
40
|
+
"([makeObject] (word))",
|
41
|
+
"([setIdSuffix] (word))",
|
42
|
+
"([resetIdSuffix])",
|
43
|
+
|
39
44
|
"(([queryable]) [is|] ([queryable|]))",
|
40
45
|
"([is:queryBridge|] ([queryable]) ([queryable]))",
|
41
46
|
// "(([queryable]) [is:isEdBridge|is,are] ([isEdAble|]))",
|
@@ -55,7 +60,6 @@ let configStruct = {
|
|
55
60
|
"(<the|> ([theAble|]))",
|
56
61
|
"(<a|a,an> ([theAble|]))",
|
57
62
|
// "([unknown])",
|
58
|
-
"([not] ([notAble|]))",
|
59
63
|
|
60
64
|
"([be] ([briefOrWordy|]))",
|
61
65
|
|
@@ -98,6 +102,30 @@ let configStruct = {
|
|
98
102
|
]
|
99
103
|
},
|
100
104
|
bridges: [
|
105
|
+
{
|
106
|
+
id: 'makeObject',
|
107
|
+
bridge: "{ ...next(operator), object: after[0] }",
|
108
|
+
generatorp: ({context, gp}) => `${context.word} ${gp(context.object)}`,
|
109
|
+
semantic: ({config, context, api}) => {
|
110
|
+
api.makeObject({ context: context.object, config, types: [] })
|
111
|
+
}
|
112
|
+
},
|
113
|
+
{
|
114
|
+
id: 'setIdSuffix',
|
115
|
+
bridge: "{ ...next(operator), suffix: after[0] }",
|
116
|
+
generatorp: ({context, gp}) => `${context.word} ${gp(context.suffix)}`,
|
117
|
+
semantic: ({context, api}) => {
|
118
|
+
api.setIdSuffix(context.suffix.text)
|
119
|
+
}
|
120
|
+
},
|
121
|
+
{
|
122
|
+
id: 'resetIdSuffix',
|
123
|
+
bridge: "{ ...next(operator) }",
|
124
|
+
semantic: ({context, api}) => {
|
125
|
+
api.setIdSuffix('')
|
126
|
+
}
|
127
|
+
},
|
128
|
+
|
101
129
|
{ id: "by", level: 0, bridge: "{ ...next(operator), object: after[0] }", optional: { 'isEder': "{ marker: 'unknown', implicit: true, concept: true }", }, },
|
102
130
|
|
103
131
|
{ id: "debug23", level: 0, bridge: "{ ...next(operator) }" },
|
@@ -144,9 +172,6 @@ let configStruct = {
|
|
144
172
|
{ id: "be", level: 0, bridge: "{ ...next(operator), type: after[0] }" },
|
145
173
|
{ id: "briefOrWordy", level: 0, bridge: "{ ...next(operator) }" },
|
146
174
|
|
147
|
-
{ id: "notAble", level: 0, bridge: "{ ...next(operator) }" },
|
148
|
-
{ id: "not", level: 0, bridge: "{ ...after, negated: true }" },
|
149
|
-
|
150
175
|
{ id: "yesno", level: 0, bridge: "{ ...next(operator) }" },
|
151
176
|
{ id: "canBeQuestion", level: 0, bridge: "{ ...next(operator) }" },
|
152
177
|
{ id: "canBeQuestion", level: 1, bridge: "{ ...next(operator) }" },
|
@@ -235,7 +260,6 @@ let configStruct = {
|
|
235
260
|
applyq: () => 'the test question?',
|
236
261
|
onNevermind: ({objects, context}) => {
|
237
262
|
objects.onNevermindWasCalled = true
|
238
|
-
debugger
|
239
263
|
objects.nevermindType = nevermindType
|
240
264
|
return nevermindType == 'accept'
|
241
265
|
},
|
@@ -303,13 +327,13 @@ let configStruct = {
|
|
303
327
|
{ "context": [['isEdAble', 0], ['is', 1], ], "choose": [0] },
|
304
328
|
],
|
305
329
|
hierarchy: [
|
330
|
+
['doubleQuote', 'queryable'],
|
306
331
|
['it', 'pronoun'],
|
307
332
|
['this', 'pronoun'],
|
308
333
|
['questionMark', 'punctuation'],
|
309
334
|
// ['questionMark', 'isEd'],
|
310
335
|
['a', 'articlePOS'],
|
311
336
|
['the', 'articlePOS'],
|
312
|
-
['unknown', 'notAble'],
|
313
337
|
['unknown', 'theAble'],
|
314
338
|
['unknown', 'queryable'],
|
315
339
|
['it', 'queryable'],
|
@@ -410,18 +434,6 @@ let configStruct = {
|
|
410
434
|
}
|
411
435
|
},
|
412
436
|
|
413
|
-
{
|
414
|
-
where: where(),
|
415
|
-
notes: 'paraphrase a negation',
|
416
|
-
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'notAble') && context.negated, // && !context.isQuery && !context.paraphrase && context.value,
|
417
|
-
apply: ({context, g}) => {
|
418
|
-
context.negated = false
|
419
|
-
const result = g(context.value)
|
420
|
-
context.negated = true
|
421
|
-
return `not ${result}`
|
422
|
-
}
|
423
|
-
},
|
424
|
-
|
425
437
|
{
|
426
438
|
where: where(),
|
427
439
|
notes: 'paraphrase a queryable response',
|
@@ -681,7 +693,6 @@ let configStruct = {
|
|
681
693
|
|
682
694
|
*/
|
683
695
|
context.value = kms.stm.api.mentions(context)
|
684
|
-
// debugger;
|
685
696
|
if (!context.value) {
|
686
697
|
// retry()
|
687
698
|
context.value = { marker: 'answerNotKnown' }
|
@@ -897,9 +908,6 @@ let configStruct = {
|
|
897
908
|
|
898
909
|
// move ask to the KM's since verbatim is called probably in dialogues?
|
899
910
|
const getAsk = (config) => (uuid) => {
|
900
|
-
// if (!uuid) {
|
901
|
-
// debugger
|
902
|
-
//}
|
903
911
|
return (asks) => {
|
904
912
|
const ask = (ask) => {
|
905
913
|
let oneShot = true // default
|
@@ -998,14 +1006,14 @@ const createConfig = () => {
|
|
998
1006
|
const config = new Config(configStruct, module)
|
999
1007
|
config.stop_auto_rebuild()
|
1000
1008
|
config.api = api
|
1001
|
-
config.add(gdefaults(), sdefaults(), pos(), stm(), meta(), punctuation())
|
1009
|
+
config.add(gdefaults(), sdefaults(), pos(), negation(), stm(), meta(), punctuation())
|
1002
1010
|
config.initializer( ({objects, config, isModule}) => {
|
1003
1011
|
/* TODO add this beck in. some stuff from config needs to be here
|
1004
1012
|
config.addArgs((args) => ({
|
1005
1013
|
e: (context) => config.api.getEvaluator(args.s, args.log, context),
|
1006
1014
|
}))
|
1007
1015
|
*/
|
1008
|
-
config.addArgs(({config, isA}) => ({
|
1016
|
+
config.addArgs(({config, api, isA}) => ({
|
1009
1017
|
isAListable: (context, type) => {
|
1010
1018
|
if (context.marker == 'list' || context.listable) {
|
1011
1019
|
return context.value.every( (element) => isA(element.marker, type) )
|
@@ -1026,6 +1034,9 @@ const createConfig = () => {
|
|
1026
1034
|
ask: getAsk(config)(uuid),
|
1027
1035
|
}
|
1028
1036
|
},
|
1037
|
+
toScopedId: (context) => {
|
1038
|
+
return api('dialogues').toScopedId(context)
|
1039
|
+
},
|
1029
1040
|
}))
|
1030
1041
|
objects.mentioned = []
|
1031
1042
|
objects.variables = {
|
@@ -1048,7 +1059,7 @@ knowledgeModule( {
|
|
1048
1059
|
name: './dialogues.test.json',
|
1049
1060
|
contents: dialogues_tests,
|
1050
1061
|
checks: {
|
1051
|
-
objects: ['onNevermindWasCalled', 'nevermindType'],
|
1062
|
+
objects: ['onNevermindWasCalled', 'nevermindType', 'idSuffix'],
|
1052
1063
|
context: defaultContextCheck,
|
1053
1064
|
},
|
1054
1065
|
|