tpmkms_4wp 8.9.1-beta.1 → 8.9.1-beta.11
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 +195 -16
- package/common/articles.js +18 -2
- package/common/articles.test.json +338 -0
- package/common/asking.js +2 -2
- package/common/avatar.js +1 -1
- package/common/characters.js +1 -1
- package/common/colors.instance.json +210 -45
- package/common/comparable.instance.json +45 -0
- package/common/comparable.js +1 -1
- package/common/concept.js +1 -1
- package/common/conjunction.js +1 -1
- package/common/countable.js +2 -8
- package/common/countable.test.json +0 -586
- package/common/crew.instance.json +390 -0
- package/common/currency.js +2 -2
- package/common/dialogues.js +6 -4
- package/common/dimension.instance.json +11 -4
- package/common/dimension.js +2 -2
- package/common/edible.instance.json +352 -58
- package/common/emotions.instance.json +15 -0
- package/common/errors.js +3 -1
- package/common/events.js +1 -1
- package/common/fastfood.instance.json +1753 -1074
- package/common/fastfood.js +3 -3
- package/common/formulas.instance.json +11 -1
- package/common/formulas.js +1 -1
- package/common/gdefaults.js +28 -17
- package/common/help.js +4 -4
- package/common/help.test.json +4 -4
- package/common/helpers/concept.js +3 -3
- package/common/helpers/conjunction.js +1 -1
- package/common/helpers/formulas.js +4 -4
- package/common/helpers/frankenhash.js +4 -4
- package/common/helpers/meta.js +4 -4
- package/common/helpers/ordering.js +2 -2
- package/common/helpers/properties.js +16 -16
- package/common/helpers.js +17 -1
- package/common/hierarchy.js +3 -3
- package/common/javascript.js +1 -1
- package/common/kirk.instance.json +15 -0
- package/common/length.instance.json +165 -20
- package/common/math.instance.json +11 -1
- package/common/math.js +1 -1
- package/common/meta.js +5 -5
- package/common/negation.js +1 -1
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +31 -71
- package/common/ordinals.js +5 -3
- package/common/people.instance.json +120 -0
- package/common/people.js +1 -1
- package/common/percentages.js +1 -1
- package/common/pipboy.instance.json +187 -46
- package/common/pipboy.js +1 -1
- package/common/pokemon.instance.json +195 -5
- package/common/pos.js +11 -1
- package/common/pressure.instance.json +44 -7
- package/common/properties.instance.json +15 -0
- package/common/properties.js +2 -2
- package/common/punctuation.js +1 -1
- package/common/reports.instance.json +24 -4
- package/common/reports.js +7 -7
- package/common/scorekeeper.js +5 -5
- package/common/sdefaults.js +2 -2
- package/common/sizeable.js +1 -1
- package/common/spock.instance.json +15 -0
- package/common/stm.js +6 -6
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +44 -8
- package/common/tester.js +1 -1
- package/common/ui.instance.json +16 -1
- package/common/weight.instance.json +132 -16
- package/common/wp.instance.json +13996 -1532
- package/common/wp.js +150 -25
- package/common/wp.test.json +82657 -3824
- package/common/yesno.js +1 -1
- package/package.json +11 -6
package/common/fastfood.js
CHANGED
@@ -323,7 +323,7 @@ const template = {
|
|
323
323
|
|
324
324
|
const hasDrink = (isA, item) => {
|
325
325
|
let hasDrink = false
|
326
|
-
for (
|
326
|
+
for (const modification of (item.modifications || [])) {
|
327
327
|
if (isA(modification.id, 'drink')) {
|
328
328
|
hasDrink = true
|
329
329
|
break
|
@@ -385,7 +385,7 @@ const template = {
|
|
385
385
|
const { api, context } = args
|
386
386
|
if (isMany(context)) {
|
387
387
|
let count = getCount(context) || Number.MAX_SAFE_INTEGER
|
388
|
-
for (
|
388
|
+
for (const item of needsDrink) {
|
389
389
|
if (count < 1) {
|
390
390
|
break
|
391
391
|
}
|
@@ -598,7 +598,7 @@ class API {
|
|
598
598
|
|
599
599
|
if (item.combo) {
|
600
600
|
item.needsDrink = true
|
601
|
-
for (
|
601
|
+
for (const modification of item.modifications || []) {
|
602
602
|
// TODO check for awailable
|
603
603
|
if (this.args.isA(modification.id, 'drink')) {
|
604
604
|
item.needsDrink = false
|
@@ -248,6 +248,11 @@
|
|
248
248
|
"theAble",
|
249
249
|
false
|
250
250
|
],
|
251
|
+
[
|
252
|
+
"distributable",
|
253
|
+
"queryable",
|
254
|
+
false
|
255
|
+
],
|
251
256
|
[
|
252
257
|
"divideByExpression",
|
253
258
|
"mathematicalExpression",
|
@@ -263,6 +268,11 @@
|
|
263
268
|
"queryable",
|
264
269
|
false
|
265
270
|
],
|
271
|
+
[
|
272
|
+
"each",
|
273
|
+
"articlePOS",
|
274
|
+
false
|
275
|
+
],
|
266
276
|
[
|
267
277
|
"evaluate",
|
268
278
|
"verb",
|
@@ -270,7 +280,7 @@
|
|
270
280
|
],
|
271
281
|
[
|
272
282
|
"every",
|
273
|
-
"
|
283
|
+
"articlePOS",
|
274
284
|
false
|
275
285
|
],
|
276
286
|
[
|
package/common/formulas.js
CHANGED
@@ -91,7 +91,7 @@ class API {
|
|
91
91
|
}
|
92
92
|
*/
|
93
93
|
|
94
|
-
|
94
|
+
const 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
|
package/common/gdefaults.js
CHANGED
@@ -3,9 +3,9 @@ const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
4
4
|
const tokenize = require('./tokenize.js')
|
5
5
|
const gdefaults_tests = require('./gdefaults.test.json')
|
6
|
-
const { isMany } = require('./helpers.js')
|
6
|
+
const { getValue, isMany } = require('./helpers.js')
|
7
7
|
|
8
|
-
|
8
|
+
const config = {
|
9
9
|
name: 'gdefaults',
|
10
10
|
generators: [
|
11
11
|
/* TODO save for later
|
@@ -33,20 +33,25 @@ let config = {
|
|
33
33
|
where: where(),
|
34
34
|
match: ({context}) => context.generate,
|
35
35
|
apply: async ({context, gs}) => {
|
36
|
-
const
|
37
|
-
const
|
38
|
-
|
39
|
-
|
36
|
+
const contexts = []
|
37
|
+
for (const keyOrContext of context.generate) {
|
38
|
+
let value = keyOrContext
|
39
|
+
if (typeof keyOrContext == 'string') {
|
40
|
+
value = getValue(keyOrContext, context)
|
40
41
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
if (
|
45
|
-
|
42
|
+
if (!(value !== undefined || keyOrContext == 'this')) {
|
43
|
+
continue
|
44
|
+
}
|
45
|
+
if (value?.skipDefault) {
|
46
|
+
continue
|
47
|
+
}
|
48
|
+
if (keyOrContext == 'this') {
|
49
|
+
contexts.push({...context, generate: null})
|
46
50
|
} else {
|
47
|
-
|
51
|
+
contexts.push(value)
|
48
52
|
}
|
49
|
-
}
|
53
|
+
}
|
54
|
+
return gs(contexts)
|
50
55
|
}
|
51
56
|
},
|
52
57
|
|
@@ -61,11 +66,11 @@ let config = {
|
|
61
66
|
//({context}) => context.paraphrase && context.modifiers,
|
62
67
|
// match: ({context}) => context.paraphrase && (context.modifiers || context.postModifiers),
|
63
68
|
match: ({context}) => (context.modifiers || context.postModifiers),
|
64
|
-
apply: async ({context, g, callId}) => {
|
69
|
+
apply: async ({context, g, gs, callId}) => {
|
65
70
|
const text = []
|
66
71
|
for (modifier of (context.modifiers || [])) {
|
67
72
|
if (Array.isArray(context[modifier])) {
|
68
|
-
for (
|
73
|
+
for (const m of context[modifier]) {
|
69
74
|
text.push(await g(m))
|
70
75
|
}
|
71
76
|
} else {
|
@@ -86,9 +91,15 @@ let config = {
|
|
86
91
|
}
|
87
92
|
for ([index, modifier] of (context.postModifiers || []).entries()) {
|
88
93
|
if (index == context.postModifiers.length - 1) {
|
89
|
-
|
94
|
+
const fn = Array.isArray(context[modifier]) ? gs: g;
|
95
|
+
if (Array.isArray(context[modifier])) {
|
96
|
+
text.push(await gs(context[modifier].map((c) => { return {...c , number} })))
|
97
|
+
} else {
|
98
|
+
text.push(await g({...context[modifier], number}))
|
99
|
+
}
|
90
100
|
} else {
|
91
|
-
|
101
|
+
const fn = Array.isArray(context[modifier]) ? gs: g;
|
102
|
+
text.push(await fn(context[modifier]))
|
92
103
|
}
|
93
104
|
}
|
94
105
|
return text.join(' ')
|
package/common/help.js
CHANGED
@@ -13,7 +13,7 @@ const getHelp = (config, indent=2) => {
|
|
13
13
|
help += `${indent}NAME: ${config.name}\n`
|
14
14
|
help += `${indent}DESCRIPTION: ${config.description}\n\n`
|
15
15
|
help += `${indent}SAMPLE SENTENCES\n\n`
|
16
|
-
for (
|
16
|
+
for (const test of config.tests) {
|
17
17
|
if (test.developerTest) {
|
18
18
|
continue
|
19
19
|
}
|
@@ -43,7 +43,7 @@ const config = {
|
|
43
43
|
level: 0,
|
44
44
|
generatorp: () => 'help',
|
45
45
|
generatorr: ({context, config}) => {
|
46
|
-
|
46
|
+
const kms = helpers.propertyToArray(context.kms).map( (value) => value.value )
|
47
47
|
const isAll = kms.length == 0
|
48
48
|
let help = '';
|
49
49
|
let separator = ''
|
@@ -89,10 +89,10 @@ const config = {
|
|
89
89
|
|
90
90
|
const initializer = ({ config, addWord, kms }) => {
|
91
91
|
const names = new Set()
|
92
|
-
for (
|
92
|
+
for (const name in kms) {
|
93
93
|
names.add(name);
|
94
94
|
}
|
95
|
-
for (
|
95
|
+
for (const name of names) {
|
96
96
|
addWord(name, {id: "km", initial: `{ value: '${name}', word: '${name}' }`})
|
97
97
|
}
|
98
98
|
}
|
package/common/help.test.json
CHANGED
@@ -395,7 +395,7 @@
|
|
395
395
|
}
|
396
396
|
],
|
397
397
|
"generatedParenthesized": [
|
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)"
|
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 every distributable\n each distributable\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)"
|
399
399
|
],
|
400
400
|
"metadata": {
|
401
401
|
"opChoices": [
|
@@ -489,11 +489,11 @@
|
|
489
489
|
"value": "help",
|
490
490
|
"word": "help"
|
491
491
|
},
|
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)",
|
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 every distributable\n each distributable\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)",
|
493
493
|
"paraphrases": "help",
|
494
494
|
"paraphrasesParenthesized": "(help)",
|
495
495
|
"responses": [
|
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"
|
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 every distributable\n each distributable\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"
|
497
497
|
]
|
498
498
|
}
|
499
499
|
]
|
@@ -506,7 +506,7 @@
|
|
506
506
|
],
|
507
507
|
"query": "help",
|
508
508
|
"responses": [
|
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"
|
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 every distributable\n each distributable\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"
|
510
510
|
]
|
511
511
|
}
|
512
512
|
]
|
@@ -11,7 +11,7 @@ class API {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
addDefaultTypesForObjectHierarchy(types) {
|
14
|
-
for (
|
14
|
+
for (const type of types) {
|
15
15
|
this._objects.defaultTypesForHierarchy.add(type)
|
16
16
|
}
|
17
17
|
}
|
@@ -23,7 +23,7 @@ class API {
|
|
23
23
|
types.push('concept');
|
24
24
|
}
|
25
25
|
|
26
|
-
for (
|
26
|
+
for (const type of types) {
|
27
27
|
config.addHierarchy(id, type)
|
28
28
|
}
|
29
29
|
}
|
@@ -142,7 +142,7 @@ class API {
|
|
142
142
|
if (config.exists('number')) {
|
143
143
|
// config.addPriority({ context: [['list', 0], ['number', 0]].concat(modifierIds.map((id) => [id, 0])).concat([[objectId, 0]]), ordered: true, choose: [2,3] })
|
144
144
|
if (modifierIds.length > 1) {
|
145
|
-
|
145
|
+
const choose = []
|
146
146
|
for (let i = 0; i < modifierIds.length; ++i) {
|
147
147
|
choose.push(i+2)
|
148
148
|
}
|
@@ -43,7 +43,7 @@ const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
|
|
43
43
|
return hierarchy.isA(child, parent)
|
44
44
|
} else {
|
45
45
|
const children = propertyToArray(child)
|
46
|
-
for (
|
46
|
+
for (const child of children) {
|
47
47
|
let okay = false
|
48
48
|
if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
|
49
49
|
okay = true
|
@@ -14,7 +14,7 @@ function getVariables(expression, isVariable = (expression) => typeof expression
|
|
14
14
|
}
|
15
15
|
|
16
16
|
const match = (values, head, value) => {
|
17
|
-
for (
|
17
|
+
for (const prop in head) {
|
18
18
|
if (head[prop] instanceof Function) {
|
19
19
|
if (!head[prop](value[prop])) {
|
20
20
|
return
|
@@ -25,7 +25,7 @@ const match = (values, head, value) => {
|
|
25
25
|
return
|
26
26
|
}
|
27
27
|
}
|
28
|
-
for (
|
28
|
+
for (const prop in values) {
|
29
29
|
if (!values[prop]) {
|
30
30
|
return
|
31
31
|
}
|
@@ -107,11 +107,11 @@ class API {
|
|
107
107
|
get(name, expectedVars) {
|
108
108
|
if (expectedVars) {
|
109
109
|
const fs = this.gets(name);
|
110
|
-
for (
|
110
|
+
for (const f of fs) {
|
111
111
|
const foundVars = getVariables(f.formula)
|
112
112
|
if (foundVars.length == expectedVars.length) {
|
113
113
|
let failed = false
|
114
|
-
for (
|
114
|
+
for (const ev of expectedVars) {
|
115
115
|
if (!foundVars.find( (fv) => fv.value == ev.value )) {
|
116
116
|
failed = true
|
117
117
|
break
|
@@ -14,7 +14,7 @@ class Frankenhash {
|
|
14
14
|
|
15
15
|
setHandler(path, handler) {
|
16
16
|
let where = this.data.handlers
|
17
|
-
for (
|
17
|
+
for (const arg of path.slice(0, path.length-1)) {
|
18
18
|
if (!where[arg]) {
|
19
19
|
where[arg] = {}
|
20
20
|
}
|
@@ -25,7 +25,7 @@ class Frankenhash {
|
|
25
25
|
|
26
26
|
getValue(path, writeDefault=true) {
|
27
27
|
let value = this.data.root
|
28
|
-
for (
|
28
|
+
for (const property of path) {
|
29
29
|
if (!value[property]) {
|
30
30
|
if (writeDefault) {
|
31
31
|
value[property] = {}
|
@@ -44,7 +44,7 @@ class Frankenhash {
|
|
44
44
|
|
45
45
|
getHandler(path) {
|
46
46
|
let value = this.data.handlers
|
47
|
-
for (
|
47
|
+
for (const property of path) {
|
48
48
|
if (this.isHandler(value)) {
|
49
49
|
return value
|
50
50
|
}
|
@@ -56,7 +56,7 @@ class Frankenhash {
|
|
56
56
|
|
57
57
|
knownProperty(path) {
|
58
58
|
let value = this.data.root;
|
59
|
-
for (
|
59
|
+
for (const property of path) {
|
60
60
|
if (!value[property]) {
|
61
61
|
return false
|
62
62
|
}
|
package/common/helpers/meta.js
CHANGED
@@ -2,7 +2,7 @@ const _ = require('lodash')
|
|
2
2
|
|
3
3
|
const hashIndexesGet = (hash, indexes) => {
|
4
4
|
let value = hash
|
5
|
-
for (
|
5
|
+
for (const i of indexes) {
|
6
6
|
value = value[i]
|
7
7
|
}
|
8
8
|
return value
|
@@ -10,7 +10,7 @@ const hashIndexesGet = (hash, indexes) => {
|
|
10
10
|
|
11
11
|
const hashIndexesSet = (hash, indexes, value) => {
|
12
12
|
let currentValue = hash
|
13
|
-
for (
|
13
|
+
for (const i of indexes.slice(0, -1)) {
|
14
14
|
if (!currentValue[i]) {
|
15
15
|
currentValue[i] = {}
|
16
16
|
}
|
@@ -53,7 +53,7 @@ const translationMapping = (from, to) => {
|
|
53
53
|
if (from.atomic) {
|
54
54
|
return mappings
|
55
55
|
}
|
56
|
-
for (
|
56
|
+
for (const fkey of Object.keys(from)) {
|
57
57
|
let matchField;
|
58
58
|
if (from[fkey].value) {
|
59
59
|
matchField = 'value'
|
@@ -75,7 +75,7 @@ const translationMapping = (from, to) => {
|
|
75
75
|
break
|
76
76
|
} else {
|
77
77
|
if (typeof tvalue !== 'string' && typeof tvalue !== 'number') {
|
78
|
-
for (
|
78
|
+
for (const key of Object.keys(tvalue)) {
|
79
79
|
todo.push(tkey.concat(key))
|
80
80
|
}
|
81
81
|
}
|
@@ -51,13 +51,13 @@ class API {
|
|
51
51
|
}
|
52
52
|
} else if (larger) {
|
53
53
|
const edges = []
|
54
|
-
for (
|
54
|
+
for (const smaller of digraph.descendants(larger)) {
|
55
55
|
edges.push({ smaller, context, larger, name })
|
56
56
|
}
|
57
57
|
return edges;
|
58
58
|
} else if (smaller) {
|
59
59
|
const edges = []
|
60
|
-
for (
|
60
|
+
for (const larger of digraph.ancestors(smaller)) {
|
61
61
|
edges.push({ smaller, context, larger, name })
|
62
62
|
}
|
63
63
|
return edges;
|
@@ -147,7 +147,7 @@ class API {
|
|
147
147
|
const value = constraint.constraint;
|
148
148
|
let property = constraint.property;
|
149
149
|
const properties = constraint.properties;
|
150
|
-
for (
|
150
|
+
for (const p of properties) {
|
151
151
|
if (value[p].concept) {
|
152
152
|
property = p
|
153
153
|
constraint.property = p; // set what is used
|
@@ -157,7 +157,7 @@ class API {
|
|
157
157
|
// value.greg = true
|
158
158
|
// value.ownee.query = true
|
159
159
|
value.query = true
|
160
|
-
|
160
|
+
const instance = await e(value)
|
161
161
|
if (instance.verbatim) {
|
162
162
|
context.evalue = { verbatim: instance.verbatim }
|
163
163
|
return
|
@@ -333,7 +333,7 @@ class API {
|
|
333
333
|
}
|
334
334
|
|
335
335
|
if (false) {
|
336
|
-
for (
|
336
|
+
for (const argument of before.concat(after)) {
|
337
337
|
if (create.includes(argument.id)) {
|
338
338
|
// config.addHierarchy('unknown', argument.id)
|
339
339
|
// config.addHierarchy('what', argument.id)
|
@@ -343,7 +343,7 @@ class API {
|
|
343
343
|
}
|
344
344
|
}
|
345
345
|
} else {
|
346
|
-
for (
|
346
|
+
for (const argument of before.concat(after)) {
|
347
347
|
if (create.includes(argument.id)) {
|
348
348
|
// config.addHierarchy(argument.id, 'unknown')
|
349
349
|
// config.addHierarchy(argument.id, 'what')
|
@@ -356,9 +356,9 @@ class API {
|
|
356
356
|
create.map( (id) => {
|
357
357
|
if (id === operator) {
|
358
358
|
const tagsToProps = (where, args, suffix='') => {
|
359
|
-
|
359
|
+
const i = 0;
|
360
360
|
let r = ''
|
361
|
-
for (
|
361
|
+
for (const arg of args) {
|
362
362
|
r += `, ${arg.tag}${suffix}: ${where}[${i}] `
|
363
363
|
}
|
364
364
|
return r
|
@@ -528,11 +528,11 @@ class API {
|
|
528
528
|
apply: ({context, km, hierarchy, config}) => {
|
529
529
|
const api = km('properties').api
|
530
530
|
// add types for arguments
|
531
|
-
for (
|
531
|
+
for (const argument of context.focusable || []) {
|
532
532
|
const value = api.toValue(context[argument])
|
533
533
|
if (value) {
|
534
534
|
const minimas = hierarchy.minima(context[argument].types)
|
535
|
-
for (
|
535
|
+
for (const type of minimas) {
|
536
536
|
if (config.exists(value)) {
|
537
537
|
config.addHierarchy(value, type);
|
538
538
|
}
|
@@ -586,7 +586,7 @@ class API {
|
|
586
586
|
if (!Array.isArray(relations)) {
|
587
587
|
relations = [relations]
|
588
588
|
}
|
589
|
-
for (
|
589
|
+
for (const relation of relations) {
|
590
590
|
this._objects.relations.push(relation)
|
591
591
|
}
|
592
592
|
}
|
@@ -622,7 +622,7 @@ class API {
|
|
622
622
|
return t.value && v.value && t.value == v.value
|
623
623
|
}
|
624
624
|
|
625
|
-
for (
|
625
|
+
for (const arg of args) {
|
626
626
|
if (!matches(template[arg], value[arg])) {
|
627
627
|
return null
|
628
628
|
}
|
@@ -632,7 +632,7 @@ class API {
|
|
632
632
|
|
633
633
|
relation_get(context, args) {
|
634
634
|
const andTheAnswerIs = []
|
635
|
-
for (
|
635
|
+
for (const relation of this._objects.relations) {
|
636
636
|
if (this.relation_match(args, context, relation)) {
|
637
637
|
const queriedArgs = args.filter( (arg) => context[arg].query )
|
638
638
|
if (queriedArgs.length == 1) {
|
@@ -718,7 +718,7 @@ class API {
|
|
718
718
|
if (property == 'property') {
|
719
719
|
const objectProps = await this.propertiesFH.getValue([object])
|
720
720
|
const values = []
|
721
|
-
for (
|
721
|
+
for (const key of Object.keys(objectProps)) {
|
722
722
|
if (objectProps[key].has) {
|
723
723
|
values.push(`${await g(key)}: ${await g({ ...objectProps[key].value, paraphrase: true })}`)
|
724
724
|
}
|
@@ -784,7 +784,7 @@ class API {
|
|
784
784
|
return true
|
785
785
|
}
|
786
786
|
const parents = this._objects.parents[next] || [];
|
787
|
-
for (
|
787
|
+
for (const parent of parents) {
|
788
788
|
if (!seen.includes(parent)) {
|
789
789
|
todo.push(parent)
|
790
790
|
seen.push(parent)
|
@@ -812,7 +812,7 @@ class API {
|
|
812
812
|
return true
|
813
813
|
}
|
814
814
|
const parents = this._objects.parents[next] || [];
|
815
|
-
for (
|
815
|
+
for (const parent of parents) {
|
816
816
|
if (!seen.includes(parent)) {
|
817
817
|
todo.push(parent)
|
818
818
|
seen.push(parent)
|
@@ -859,7 +859,7 @@ class API {
|
|
859
859
|
return true
|
860
860
|
}
|
861
861
|
const parents = this._objects.parents[next] || [];
|
862
|
-
for (
|
862
|
+
for (const parent of parents) {
|
863
863
|
if (!seen.includes(parent)) {
|
864
864
|
todo.push(parent)
|
865
865
|
seen.push(parent)
|
@@ -903,7 +903,7 @@ class API {
|
|
903
903
|
}
|
904
904
|
|
905
905
|
isOperator(id) {
|
906
|
-
for (
|
906
|
+
for (const bridge of this.__config.getBridges()) {
|
907
907
|
if (bridge.id == id) {
|
908
908
|
return true
|
909
909
|
}
|
package/common/helpers.js
CHANGED
@@ -83,7 +83,7 @@ const zip = (...arrays) => {
|
|
83
83
|
}
|
84
84
|
const zipped = []
|
85
85
|
for(let i = 0; i < arrays[0].length; i++){
|
86
|
-
|
86
|
+
const tuple = []
|
87
87
|
for (const array of arrays) {
|
88
88
|
tuple.push(array[i])
|
89
89
|
}
|
@@ -191,7 +191,23 @@ const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
|
|
191
191
|
}
|
192
192
|
}
|
193
193
|
|
194
|
+
const getValue = (propertyPath, object) => {
|
195
|
+
if (!propertyPath) {
|
196
|
+
return
|
197
|
+
}
|
198
|
+
const path = propertyPath.split('.')
|
199
|
+
let value = object
|
200
|
+
for (const name of path) {
|
201
|
+
if (!value) {
|
202
|
+
break
|
203
|
+
}
|
204
|
+
value = value[name]
|
205
|
+
}
|
206
|
+
return value
|
207
|
+
}
|
208
|
+
|
194
209
|
module.exports = {
|
210
|
+
getValue,
|
195
211
|
defaultContextCheck,
|
196
212
|
defaultContextCheckProperties,
|
197
213
|
toEValue,
|
package/common/hierarchy.js
CHANGED
@@ -32,7 +32,7 @@ const getTypes = ( km, concept, instance ) => {
|
|
32
32
|
|
33
33
|
// TODO the types of rank are x y z ....
|
34
34
|
// TODO x is a kind of y
|
35
|
-
|
35
|
+
const config = {
|
36
36
|
name: 'hierarchy',
|
37
37
|
operators: [
|
38
38
|
// "([hierarchyAble|])",
|
@@ -250,8 +250,8 @@ let config = {
|
|
250
250
|
const api = km('properties').api
|
251
251
|
const oneConcepts = asList(context);
|
252
252
|
const twoConcepts = asList(context.same);
|
253
|
-
for (
|
254
|
-
for (
|
253
|
+
for (const oneConcept of oneConcepts.value) {
|
254
|
+
for (const twoConcept of twoConcepts.value) {
|
255
255
|
oneConceptId = api.makeObject({config, context: oneConcept})
|
256
256
|
twoConceptId = api.makeObject({config, context: twoConcept})
|
257
257
|
api.rememberIsA(oneConceptId, twoConceptId)
|
package/common/javascript.js
CHANGED
@@ -3,7 +3,7 @@ const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const dialogues = require('./dialogues')
|
4
4
|
const javascript_tests = require('./javascript.test.json')
|
5
5
|
|
6
|
-
|
6
|
+
const config = {
|
7
7
|
name: 'javascript',
|
8
8
|
operators: [
|
9
9
|
"((<let> ([variable|])) [assignment|] (value))",
|
@@ -365,6 +365,11 @@
|
|
365
365
|
"theAble",
|
366
366
|
false
|
367
367
|
],
|
368
|
+
[
|
369
|
+
"distributable",
|
370
|
+
"queryable",
|
371
|
+
false
|
372
|
+
],
|
368
373
|
[
|
369
374
|
"doctor",
|
370
375
|
"hierarchyAble",
|
@@ -445,6 +450,11 @@
|
|
445
450
|
"queryable",
|
446
451
|
false
|
447
452
|
],
|
453
|
+
[
|
454
|
+
"each",
|
455
|
+
"articlePOS",
|
456
|
+
false
|
457
|
+
],
|
448
458
|
[
|
449
459
|
"eagle",
|
450
460
|
"bird",
|
@@ -495,6 +505,11 @@
|
|
495
505
|
"verb",
|
496
506
|
false
|
497
507
|
],
|
508
|
+
[
|
509
|
+
"every",
|
510
|
+
"articlePOS",
|
511
|
+
false
|
512
|
+
],
|
498
513
|
[
|
499
514
|
"feel",
|
500
515
|
"canBeDoQuestion",
|