tpmkms_4wp 8.0.0-beta.0 → 8.0.0-beta.10
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 +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/help.test.json
CHANGED
@@ -19,24 +19,6 @@
|
|
19
19
|
0
|
20
20
|
]
|
21
21
|
],
|
22
|
-
[
|
23
|
-
[
|
24
|
-
"help",
|
25
|
-
0
|
26
|
-
],
|
27
|
-
[
|
28
|
-
"km",
|
29
|
-
0
|
30
|
-
],
|
31
|
-
[
|
32
|
-
"list",
|
33
|
-
0
|
34
|
-
],
|
35
|
-
[
|
36
|
-
"withKM",
|
37
|
-
0
|
38
|
-
]
|
39
|
-
],
|
40
22
|
[
|
41
23
|
[
|
42
24
|
"help",
|
@@ -120,7 +102,7 @@
|
|
120
102
|
}
|
121
103
|
],
|
122
104
|
"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 nevermindTestSetup accept nevermind hi\n nevermindTestSetup reject nevermind hi\n)"
|
105
|
+
"( 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)"
|
124
106
|
],
|
125
107
|
"metadata": {
|
126
108
|
"opChoices": [
|
@@ -216,13 +198,16 @@
|
|
216
198
|
"gdefaults": "gdefaults2",
|
217
199
|
"help": "help1",
|
218
200
|
"meta": "meta2",
|
201
|
+
"negation": "negation2",
|
219
202
|
"pos": "pos2",
|
220
203
|
"punctuation": "punctuation2",
|
221
204
|
"sdefaults": "sdefaults2",
|
222
|
-
"stm": "stm2"
|
205
|
+
"stm": "stm2",
|
206
|
+
"tokenize": "tokenize2"
|
223
207
|
},
|
224
208
|
"namespaced": {
|
225
209
|
"dialogues2": {
|
210
|
+
"idSuffix": "",
|
226
211
|
"mentioned": [
|
227
212
|
],
|
228
213
|
"variables": {
|
@@ -234,6 +219,8 @@
|
|
234
219
|
},
|
235
220
|
"meta2": {
|
236
221
|
},
|
222
|
+
"negation2": {
|
223
|
+
},
|
237
224
|
"pos2": {
|
238
225
|
},
|
239
226
|
"punctuation2": {
|
@@ -245,6 +232,8 @@
|
|
245
232
|
],
|
246
233
|
"variables": {
|
247
234
|
}
|
235
|
+
},
|
236
|
+
"tokenize2": {
|
248
237
|
}
|
249
238
|
},
|
250
239
|
"processed": [
|
@@ -312,11 +301,11 @@
|
|
312
301
|
"value": "help",
|
313
302
|
"word": "help"
|
314
303
|
},
|
315
|
-
"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)",
|
304
|
+
"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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n)",
|
316
305
|
"paraphrases": "help",
|
317
306
|
"paraphrasesParenthesized": "(help)",
|
318
307
|
"responses": [
|
319
|
-
" 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"
|
308
|
+
" 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
|
320
309
|
]
|
321
310
|
}
|
322
311
|
]
|
@@ -329,7 +318,7 @@
|
|
329
318
|
],
|
330
319
|
"query": "help with help and dialogues",
|
331
320
|
"responses": [
|
332
|
-
" 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"
|
321
|
+
" 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n"
|
333
322
|
]
|
334
323
|
},
|
335
324
|
{
|
@@ -356,9 +345,8 @@
|
|
356
345
|
"word": "help"
|
357
346
|
}
|
358
347
|
],
|
359
|
-
"developerTest": false,
|
360
348
|
"generatedParenthesized": [
|
361
|
-
"( 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\n\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n\n)"
|
349
|
+
"( 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)"
|
362
350
|
],
|
363
351
|
"metadata": {
|
364
352
|
"opChoices": [
|
@@ -383,6 +371,7 @@
|
|
383
371
|
"gdefaults": "gdefaults2",
|
384
372
|
"help": "help1",
|
385
373
|
"meta": "meta2",
|
374
|
+
"negation": "negation2",
|
386
375
|
"pos": "pos2",
|
387
376
|
"punctuation": "punctuation2",
|
388
377
|
"sdefaults": "sdefaults2",
|
@@ -391,6 +380,7 @@
|
|
391
380
|
},
|
392
381
|
"namespaced": {
|
393
382
|
"dialogues2": {
|
383
|
+
"idSuffix": "",
|
394
384
|
"mentioned": [
|
395
385
|
],
|
396
386
|
"variables": {
|
@@ -402,6 +392,8 @@
|
|
402
392
|
},
|
403
393
|
"meta2": {
|
404
394
|
},
|
395
|
+
"negation2": {
|
396
|
+
},
|
405
397
|
"pos2": {
|
406
398
|
},
|
407
399
|
"punctuation2": {
|
@@ -436,11 +428,11 @@
|
|
436
428
|
"value": "help",
|
437
429
|
"word": "help"
|
438
430
|
},
|
439
|
-
"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\n\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n\n)",
|
431
|
+
"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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n)",
|
440
432
|
"paraphrases": "help",
|
441
433
|
"paraphrasesParenthesized": "(help)",
|
442
434
|
"responses": [
|
443
|
-
" 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\n\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n\n"
|
435
|
+
" 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
|
444
436
|
]
|
445
437
|
}
|
446
438
|
]
|
@@ -453,7 +445,7 @@
|
|
453
445
|
],
|
454
446
|
"query": "help",
|
455
447
|
"responses": [
|
456
|
-
" 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\n\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n\n\n"
|
448
|
+
" 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 setidsuffix greg\n setidsuffix greg resetidsuffix\n setidsuffix greg makeObject banana\\nbanana\n setidsuffix _suffy\n\n\n NAME: negation\n DESCRIPTION: negation\n\n SAMPLE SENTENCES\n\n not negatable\n not negatables\n\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: punctuation\n DESCRIPTION: punctuation\n\n SAMPLE SENTENCES\n\n (a)\n :\n \"hi man\"\n\n\n\n NAME: tokenize\n DESCRIPTION: tokenize\n\n SAMPLE SENTENCES\n\n hello_world\n"
|
457
449
|
]
|
458
450
|
}
|
459
451
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const pluralize = require('pluralize')
|
2
2
|
const deepEqual = require('deep-equal')
|
3
|
-
const { chooseNumber } = require('../helpers.js')
|
3
|
+
const { chooseNumber, zip } = require('../helpers.js')
|
4
4
|
const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
|
5
5
|
|
6
6
|
class API {
|
@@ -31,13 +31,25 @@ class API {
|
|
31
31
|
// for example, "crew member" or "photon torpedo"
|
32
32
|
// TODO account for modifier a complex phrase for example "hot (chicken strips)"
|
33
33
|
kindOfConcept({ config, modifiers, object }) {
|
34
|
-
|
34
|
+
// TODO make the modifiers objects then below for add words for modifiers only do if !unknown
|
35
|
+
// const objectId = pluralize.singular(object)
|
36
|
+
const objectId = this.args.kms.dialogues.api.toScopedId(object)
|
37
|
+
|
35
38
|
// const modifierIds = modifiers.map( (modifier) => pluralize.singular(modifier) )
|
36
|
-
const modifierIds = modifiers
|
37
|
-
const modifiersObjectId = `${
|
39
|
+
const modifierIds = modifiers.map( (modifier) => this.args.kms.dialogues.api.toScopedId(modifier) )
|
40
|
+
const modifiersObjectId = `${modifiers.join("_")}_${objectId}`
|
38
41
|
|
39
|
-
const
|
40
|
-
|
42
|
+
const toWord = (object) => {
|
43
|
+
if (typeof object == 'string') {
|
44
|
+
return object
|
45
|
+
}
|
46
|
+
return object.text
|
47
|
+
}
|
48
|
+
const objectWord = toWord(object)
|
49
|
+
// const objectWord = object
|
50
|
+
// TODO call evaluator to pick up overrides
|
51
|
+
const objectSingular = pluralize.singular(objectWord)
|
52
|
+
const objectPlural = pluralize.plural(objectWord)
|
41
53
|
// config.addOperator({ pattern: `(${modifierIds.map((modifierId) => `(${modifierId}/*)`).join(' ')} [${modifiersObjectId}] (${objectId}/0))`, allowDups: true })
|
42
54
|
config.addOperator({ pattern: `(${modifierIds.map((modifierId) => `(${modifierId}/*)`).join(' ')} [${modifiersObjectId}] (${objectId}/*))`, allowDups: true })
|
43
55
|
// config.addOperator({ pattern: `(<${modifierId}|> ([${objectId}|]))`, allowDups: true })
|
@@ -59,10 +71,18 @@ class API {
|
|
59
71
|
config.addOperator({ pattern: `([${objectId}|])`, allowDups: true })
|
60
72
|
}
|
61
73
|
|
74
|
+
if (object.unknown) {
|
75
|
+
config.addWord(objectSingular, { id: objectId, initial: `{ value: '${objectId}', number: 'one' }`})
|
76
|
+
config.addWord(objectPlural, { id: objectId, initial: `{ value: '${objectId}', number: 'many' }`})
|
77
|
+
}
|
62
78
|
|
63
|
-
|
64
|
-
|
65
|
-
|
79
|
+
zip(modifiers, modifierIds).forEach(([modifierWord, modifierId]) => {
|
80
|
+
// config.addWord(modifier, { id: modifierId, initial: `{ value: '${modifierId}' }`})
|
81
|
+
// TODO call evaluator to pick up overrides
|
82
|
+
config.addWord(pluralize.singular(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'one' }`})
|
83
|
+
config.addWord(pluralize.plural(modifierWord), { id: modifierId, initial: `{ value: '${modifierId}', number: 'many' }`})
|
84
|
+
})
|
85
|
+
// modifierds.forEach((modifierId) => config.addWord(modifierId, { id: modifierId, initial: `{ value: '${modifierId}' }`}))
|
66
86
|
|
67
87
|
modifierIds.forEach((modifierId) => config.addBridge({ id: modifierId, level: 0, bridge: `{ ...next(operator), value: '${modifierId}' }`, allowDups: true }))
|
68
88
|
config.addBridge({ id: objectId, level: 0, bridge: `{ ...next(operator), value: '${objectId}' }`, allowDups: true })
|
@@ -74,7 +94,8 @@ class API {
|
|
74
94
|
id: modifiersObjectId,
|
75
95
|
level: 0,
|
76
96
|
convolution: true,
|
77
|
-
isA: ['adjective'],
|
97
|
+
isA: [{ parent: 'adjective', instance: true }],
|
98
|
+
// isA: ['adjective'],
|
78
99
|
before: ['verby'],
|
79
100
|
bridge: `{ ...after[0], ${modifierProperties}, atomic: true, dead: true, marker: next(operator('${modifiersObjectId}')), value: '${modifiersObjectId}', modifiers: append([${modifierList}], after[0].modifiers)}`,
|
80
101
|
allowDups: true })
|
@@ -4,6 +4,21 @@ const { indent, focus } = require('../helpers')
|
|
4
4
|
class API {
|
5
5
|
initialize({ objects }) {
|
6
6
|
this._objects = objects
|
7
|
+
this._objects.idSuffix = ''
|
8
|
+
}
|
9
|
+
|
10
|
+
setIdSuffix(idSuffix) {
|
11
|
+
this._objects.idSuffix = idSuffix
|
12
|
+
}
|
13
|
+
|
14
|
+
toScopedId(context) {
|
15
|
+
if (typeof context == 'string') {
|
16
|
+
return pluralize.singular(context) + this._objects.idSuffix
|
17
|
+
} else {
|
18
|
+
const { unknown, value, word } = context;
|
19
|
+
// return unknown ? pluralize.singular(word) + this._objects.idSuffix : pluralize.singular(value || word)
|
20
|
+
return unknown ? pluralize.singular(word) + this._objects.idSuffix : value || pluralize.singular(word)
|
21
|
+
}
|
7
22
|
}
|
8
23
|
|
9
24
|
warningNotEvaluated(log, value) {
|
@@ -64,7 +79,8 @@ class API {
|
|
64
79
|
if (!value) {
|
65
80
|
return
|
66
81
|
}
|
67
|
-
const concept = pluralize.singular(value)
|
82
|
+
// const concept = pluralize.singular(value)
|
83
|
+
const concept = this.toScopedId(context)
|
68
84
|
if (config.exists(concept)) {
|
69
85
|
return concept
|
70
86
|
}
|
@@ -42,11 +42,9 @@ const unify = (rule, value) => {
|
|
42
42
|
|
43
43
|
const f = (values, variable) => (value) => {
|
44
44
|
if (!value) {
|
45
|
-
debugger
|
46
45
|
throw new Error("Value not present")
|
47
46
|
}
|
48
47
|
if (values[variable] && values[variable] != value) {
|
49
|
-
debugger
|
50
48
|
throw new Error("Variable already set to different value")
|
51
49
|
}
|
52
50
|
values[variable] = value
|
@@ -80,18 +78,6 @@ function solveFor(expression, variable, isVariable = (expression) => typeof expr
|
|
80
78
|
return c1.value == c2.value
|
81
79
|
}
|
82
80
|
|
83
|
-
/*
|
84
|
-
for (let rule of rules) {
|
85
|
-
debugger
|
86
|
-
const body = unify(rule, expression)
|
87
|
-
const lVars = getVariables(body.left, isVariable)
|
88
|
-
const rVars = getVariables(body.right, isVariable)
|
89
|
-
if (lVars.length == 1 && sameVar(lVars[0], variable) && !rVars.some((c) => sameVar(c, variable))) {
|
90
|
-
return body
|
91
|
-
}
|
92
|
-
}
|
93
|
-
*/
|
94
|
-
|
95
81
|
const lVars = getVariables(expression.left, isVariable)
|
96
82
|
const rVars = getVariables(expression.right, isVariable)
|
97
83
|
if (lVars.length == 1 && sameVar(lVars[0], variable) && !rVars.some((c) => sameVar(c, variable))) {
|
package/common/helpers/meta.js
CHANGED
@@ -104,7 +104,6 @@ const translationMappingToInstantiatorMappings = (translationMapping, from , to
|
|
104
104
|
match: ({context}) => context[tm.to],
|
105
105
|
apply: ({context}) => {
|
106
106
|
// Object.assign(context[tm.to], from[tm.from])
|
107
|
-
// debugger;
|
108
107
|
context[tm.to] = from[tm.from]
|
109
108
|
if (context[tm.to]) {
|
110
109
|
context[tm.to].instantiated = true
|
@@ -81,7 +81,6 @@ class API {
|
|
81
81
|
match: ({context}) => context[tm.to],
|
82
82
|
apply: ({context}) => {
|
83
83
|
// Object.assign(context[tm.to], from[tm.from])
|
84
|
-
// debugger;
|
85
84
|
context[tm.to] = from[tm.from]
|
86
85
|
if (context[tm.to]) {
|
87
86
|
context[tm.to].instantiated = true
|
@@ -501,12 +500,6 @@ class API {
|
|
501
500
|
for (let argument of context.focusable || []) {
|
502
501
|
const value = api.toValue(context[argument])
|
503
502
|
if (value) {
|
504
|
-
/*
|
505
|
-
if (value == 'cleo') {
|
506
|
-
debugger;
|
507
|
-
hierarchy.isA()
|
508
|
-
}
|
509
|
-
*/
|
510
503
|
const minimas = hierarchy.minima(context[argument].types)
|
511
504
|
for (let type of minimas) {
|
512
505
|
if (config.exists(value)) {
|
@@ -689,7 +682,7 @@ class API {
|
|
689
682
|
}
|
690
683
|
|
691
684
|
getPropertyDirectly(object, property, g) {
|
692
|
-
if (property == '
|
685
|
+
if (property == 'property') {
|
693
686
|
const objectProps = this.propertiesFH.getValue([object])
|
694
687
|
const values = []
|
695
688
|
for (let key of Object.keys(objectProps)) {
|
@@ -734,7 +727,7 @@ class API {
|
|
734
727
|
}
|
735
728
|
|
736
729
|
knownObject(object) {
|
737
|
-
if (object == '
|
730
|
+
if (object == 'property') {
|
738
731
|
return object
|
739
732
|
}
|
740
733
|
if ((object || {}).value) {
|
@@ -746,7 +739,7 @@ class API {
|
|
746
739
|
}
|
747
740
|
|
748
741
|
hasProperty(object, property) {
|
749
|
-
if (property == '
|
742
|
+
if (property == 'property') {
|
750
743
|
return true;
|
751
744
|
}
|
752
745
|
|
@@ -773,8 +766,9 @@ class API {
|
|
773
766
|
knownProperty(object, property) {
|
774
767
|
object = this.toValue(object)
|
775
768
|
property = this.toValue(property)
|
776
|
-
if (property == '
|
777
|
-
|
769
|
+
if (property == 'property') {
|
770
|
+
const objectProps = this.propertiesFH.getValue([object])
|
771
|
+
return !_.isEmpty(objectProps)
|
778
772
|
}
|
779
773
|
|
780
774
|
// go up the hierarchy
|
@@ -916,7 +910,6 @@ class API {
|
|
916
910
|
}
|
917
911
|
|
918
912
|
set config(config) {
|
919
|
-
debugger
|
920
913
|
this._config = config
|
921
914
|
/*
|
922
915
|
const toJSON = (h) => {
|