tpmkms_4wp 9.5.1-beta.2 → 9.5.1-beta.21
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 +21 -61
- package/common/asking.js +102 -100
- package/common/can.instance.json +2180 -0
- package/common/can.js +254 -0
- package/common/can.test.json +50706 -0
- package/common/characters.js +3 -3
- package/common/colors.instance.json +38 -10
- package/common/comparable.instance.json +2 -2
- package/common/concept.test.json +54 -40
- package/common/conjunction.js +13 -5
- package/common/crew.instance.json +241 -123
- package/common/crew.js +1 -1
- package/common/currency.js +1 -1
- package/common/dates.instance.json +87 -3
- package/common/dialogues.js +41 -119
- package/common/dimension.instance.json +16 -12
- package/common/dimension.js +23 -4
- package/common/dimension.test.json +1758 -2351
- package/common/edible.instance.json +79 -95
- package/common/emotions.instance.json +53 -80
- package/common/emotions.js +1 -1
- package/common/english_helpers.js +277 -67
- package/common/fastfood.instance.json +35 -663
- package/common/fastfood.js +4 -4
- package/common/formulas.instance.json +1 -1
- package/common/gdefaults.js +85 -14
- package/common/help.js +2 -2
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +1 -1
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +8 -8
- package/common/helpers/properties.js +102 -21
- package/common/helpers.js +82 -46
- package/common/hierarchy.js +4 -3
- package/common/kirk.instance.json +1 -1
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +20 -2
- package/common/length.test.json +2241 -1801
- package/common/math.instance.json +20 -20
- package/common/math.js +45 -44
- package/common/menus.instance.json +3 -3
- package/common/menus.js +1 -1
- package/common/meta.js +49 -33
- package/common/ordering.instance.json +20 -30
- package/common/ordering.js +1 -1
- package/common/ordering.test.json +354 -296
- package/common/people.instance.json +56 -258
- package/common/people.js +1 -1
- package/common/people.test.json +952 -681
- package/common/pipboy.instance.json +72 -16
- package/common/pokemon.instance.json +8 -8
- package/common/pokemon.js +1 -1
- package/common/pressure.instance.json +6 -2
- package/common/properties.instance.json +4 -12
- package/common/properties.js +16 -3
- package/common/reminders.js +1 -1
- package/common/reports.instance.json +3 -3
- package/common/reports.js +18 -16
- package/common/scorekeeper.js +4 -4
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +1 -1
- package/common/stgame.js +1 -1
- package/common/stm.js +2 -2
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +6 -2
- package/common/tester.js +3 -3
- package/common/time.js +3 -3
- package/common/tokenize.js +1 -1
- package/common/weight.instance.json +19 -2
- package/common/words.instance.json +9 -0
- package/common/words.js +53 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +320 -8
- package/common/wp.js +8 -4
- package/common/wp.test.json +3469 -0
- package/main.js +0 -2
- package/package.json +9 -5
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/stgame.js
CHANGED
package/common/stm.js
CHANGED
|
@@ -74,7 +74,7 @@ class API {
|
|
|
74
74
|
|
|
75
75
|
const findPrevious = !!context.stm_previous
|
|
76
76
|
const forAll = []
|
|
77
|
-
|
|
77
|
+
function addForAll(context) {
|
|
78
78
|
if (!forAll.find( (c) => c.stm.id == context.stm.id)) {
|
|
79
79
|
forAll.push(context)
|
|
80
80
|
}
|
|
@@ -247,7 +247,7 @@ const config = {
|
|
|
247
247
|
],
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
function initializer({config}) {
|
|
251
251
|
config.addArgs(({kms}) => ({
|
|
252
252
|
mentioned: (args) => {
|
|
253
253
|
kms.stm.api.mentioned(args)
|
package/common/tell.js
CHANGED
|
@@ -98,7 +98,7 @@ const config = {
|
|
|
98
98
|
],
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
function initializer({config, isModule}) {
|
|
102
102
|
if (!isModule) {
|
|
103
103
|
config.addSemantic({
|
|
104
104
|
match: ({context, hierarchy}) => context.happening && hierarchy.isA(context.marker, 'event'),
|
|
@@ -1112,7 +1112,7 @@
|
|
|
1112
1112
|
"word": "temperature",
|
|
1113
1113
|
"range": {
|
|
1114
1114
|
"start": 0,
|
|
1115
|
-
"end":
|
|
1115
|
+
"end": 10
|
|
1116
1116
|
},
|
|
1117
1117
|
"dead": true,
|
|
1118
1118
|
"types": [
|
|
@@ -2719,7 +2719,7 @@
|
|
|
2719
2719
|
"text": "celcius fahrenheit and kelvin",
|
|
2720
2720
|
"range": {
|
|
2721
2721
|
"start": 0,
|
|
2722
|
-
"end":
|
|
2722
|
+
"end": 28
|
|
2723
2723
|
},
|
|
2724
2724
|
"types": [
|
|
2725
2725
|
"list",
|
|
@@ -5048,6 +5048,7 @@
|
|
|
5048
5048
|
"value": "fahrenheit",
|
|
5049
5049
|
"number": "one",
|
|
5050
5050
|
"text": "fahrenheit",
|
|
5051
|
+
"dimension": "temperature",
|
|
5051
5052
|
"marker": "fahrenheit",
|
|
5052
5053
|
"word": "fahrenheit",
|
|
5053
5054
|
"range": {
|
|
@@ -5106,6 +5107,7 @@
|
|
|
5106
5107
|
"value": "celcius",
|
|
5107
5108
|
"number": "one",
|
|
5108
5109
|
"text": "celcius",
|
|
5110
|
+
"dimension": "temperature",
|
|
5109
5111
|
"marker": "celcius",
|
|
5110
5112
|
"word": "celcius",
|
|
5111
5113
|
"range": {
|
|
@@ -7535,6 +7537,7 @@
|
|
|
7535
7537
|
"value": "celcius",
|
|
7536
7538
|
"number": "one",
|
|
7537
7539
|
"text": "celcius",
|
|
7540
|
+
"dimension": "temperature",
|
|
7538
7541
|
"marker": "celcius",
|
|
7539
7542
|
"word": "celcius",
|
|
7540
7543
|
"range": {
|
|
@@ -7607,6 +7610,7 @@
|
|
|
7607
7610
|
"value": "fahrenheit",
|
|
7608
7611
|
"number": "one",
|
|
7609
7612
|
"text": "fahrenheit",
|
|
7613
|
+
"dimension": "temperature",
|
|
7610
7614
|
"marker": "fahrenheit",
|
|
7611
7615
|
"word": "fahrenheit",
|
|
7612
7616
|
"range": {
|
package/common/tester.js
CHANGED
|
@@ -2,7 +2,7 @@ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
|
2
2
|
const tester_tests = require('./tester.test.json')
|
|
3
3
|
const ArgumentParser = require('argparse').ArgumentParser
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function testModuleNameFn() {
|
|
6
6
|
const parser = new ArgumentParser({ description: 'Get test module name' })
|
|
7
7
|
parser.add_argument('-tmn', '--testModuleName', { help: 'List of module to run the tests from' })
|
|
8
8
|
const [args, unknown] = parser.parse_known_args()
|
|
@@ -18,7 +18,7 @@ parser.add_argument('-m', '--modules', { help: 'List of modules to load' })
|
|
|
18
18
|
const [args, unknown] = parser.parse_known_args()
|
|
19
19
|
process.argv = [process.argv[0], process.argv[1], ...unknown]
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
async function createConfig() {
|
|
22
22
|
const config = new Config({ name: 'tester' })
|
|
23
23
|
global.theprogrammablemind = {
|
|
24
24
|
loadForTesting: {}
|
|
@@ -42,7 +42,7 @@ const includes = args.modules.split(',').map((module) => {
|
|
|
42
42
|
return km
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
async function fixtures(args) {
|
|
46
46
|
const { config, kms, apis } = args;
|
|
47
47
|
if (kms[testModuleName].testConfig?.fixtures) {
|
|
48
48
|
const fixtures = kms.menus.testConfig?.fixtures
|
package/common/time.js
CHANGED
|
@@ -6,7 +6,7 @@ const numbers = require('./numbers')
|
|
|
6
6
|
const helpers = require('./helpers')
|
|
7
7
|
const time_tests = require('./time.test.json')
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function pad(v, l) {
|
|
10
10
|
const s = String(v)
|
|
11
11
|
const n = l - s.length
|
|
12
12
|
return "0".repeat(n) + s
|
|
@@ -141,7 +141,7 @@ const config = {
|
|
|
141
141
|
where: where(),
|
|
142
142
|
match: ({context}) => context.marker == 'time' && context.evalue && context.format == 24,
|
|
143
143
|
apply: ({g, context}) => {
|
|
144
|
-
|
|
144
|
+
function pad(num, size) {
|
|
145
145
|
num = num.toString();
|
|
146
146
|
while (num.length < size) num = "0" + num;
|
|
147
147
|
return num;
|
|
@@ -187,7 +187,7 @@ const config = {
|
|
|
187
187
|
],
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
function initializer({api, config, objects, kms, isModule}) {
|
|
191
191
|
if (!isModule) {
|
|
192
192
|
kms.time.api.newDate = () => new Date("December 25, 1995 1:59:58 pm" )
|
|
193
193
|
}
|
package/common/tokenize.js
CHANGED
|
@@ -2510,7 +2510,7 @@
|
|
|
2510
2510
|
"word": "weight",
|
|
2511
2511
|
"range": {
|
|
2512
2512
|
"start": 0,
|
|
2513
|
-
"end":
|
|
2513
|
+
"end": 5
|
|
2514
2514
|
},
|
|
2515
2515
|
"dead": true,
|
|
2516
2516
|
"types": [
|
|
@@ -4464,7 +4464,7 @@
|
|
|
4464
4464
|
"text": "kilograms grams pounds (troy ounces) ounces and tons",
|
|
4465
4465
|
"range": {
|
|
4466
4466
|
"start": 0,
|
|
4467
|
-
"end":
|
|
4467
|
+
"end": 51
|
|
4468
4468
|
},
|
|
4469
4469
|
"types": [
|
|
4470
4470
|
"list",
|
|
@@ -8109,6 +8109,7 @@
|
|
|
8109
8109
|
"value": "ounce",
|
|
8110
8110
|
"number": "many",
|
|
8111
8111
|
"text": "ounces",
|
|
8112
|
+
"dimension": "weight",
|
|
8112
8113
|
"marker": "ounce",
|
|
8113
8114
|
"word": "ounces",
|
|
8114
8115
|
"range": {
|
|
@@ -8155,6 +8156,7 @@
|
|
|
8155
8156
|
"value": "troy_ounce",
|
|
8156
8157
|
"number": "many",
|
|
8157
8158
|
"text": "troy ounces",
|
|
8159
|
+
"dimension": "weight",
|
|
8158
8160
|
"marker": "troy_ounce",
|
|
8159
8161
|
"word": "ounces",
|
|
8160
8162
|
"range": {
|
|
@@ -10065,6 +10067,7 @@
|
|
|
10065
10067
|
"value": "troy_ounce",
|
|
10066
10068
|
"number": "many",
|
|
10067
10069
|
"text": "troy ounces",
|
|
10070
|
+
"dimension": "weight",
|
|
10068
10071
|
"marker": "troy_ounce",
|
|
10069
10072
|
"word": "ounces",
|
|
10070
10073
|
"range": {
|
|
@@ -10115,6 +10118,7 @@
|
|
|
10115
10118
|
"value": "ounce",
|
|
10116
10119
|
"number": "many",
|
|
10117
10120
|
"text": "ounces",
|
|
10121
|
+
"dimension": "weight",
|
|
10118
10122
|
"marker": "ounce",
|
|
10119
10123
|
"word": "ounces",
|
|
10120
10124
|
"range": {
|
|
@@ -12019,6 +12023,7 @@
|
|
|
12019
12023
|
"value": "kilogram",
|
|
12020
12024
|
"number": "many",
|
|
12021
12025
|
"text": "kilograms",
|
|
12026
|
+
"dimension": "weight",
|
|
12022
12027
|
"marker": "kilogram",
|
|
12023
12028
|
"word": "kilograms",
|
|
12024
12029
|
"range": {
|
|
@@ -12049,6 +12054,7 @@
|
|
|
12049
12054
|
"value": "pound",
|
|
12050
12055
|
"number": "many",
|
|
12051
12056
|
"text": "pounds",
|
|
12057
|
+
"dimension": "weight",
|
|
12052
12058
|
"marker": "pound",
|
|
12053
12059
|
"word": "pounds",
|
|
12054
12060
|
"range": {
|
|
@@ -13901,6 +13907,7 @@
|
|
|
13901
13907
|
"value": "gram",
|
|
13902
13908
|
"number": "many",
|
|
13903
13909
|
"text": "grams",
|
|
13910
|
+
"dimension": "weight",
|
|
13904
13911
|
"marker": "gram",
|
|
13905
13912
|
"word": "grams",
|
|
13906
13913
|
"range": {
|
|
@@ -13931,6 +13938,7 @@
|
|
|
13931
13938
|
"value": "kilogram",
|
|
13932
13939
|
"number": "many",
|
|
13933
13940
|
"text": "kilograms",
|
|
13941
|
+
"dimension": "weight",
|
|
13934
13942
|
"marker": "kilogram",
|
|
13935
13943
|
"word": "kilograms",
|
|
13936
13944
|
"range": {
|
|
@@ -15783,6 +15791,7 @@
|
|
|
15783
15791
|
"value": "kilogram",
|
|
15784
15792
|
"number": "many",
|
|
15785
15793
|
"text": "kilograms",
|
|
15794
|
+
"dimension": "weight",
|
|
15786
15795
|
"marker": "kilogram",
|
|
15787
15796
|
"word": "kilograms",
|
|
15788
15797
|
"range": {
|
|
@@ -15813,6 +15822,7 @@
|
|
|
15813
15822
|
"value": "gram",
|
|
15814
15823
|
"number": "many",
|
|
15815
15824
|
"text": "grams",
|
|
15825
|
+
"dimension": "weight",
|
|
15816
15826
|
"marker": "gram",
|
|
15817
15827
|
"word": "grams",
|
|
15818
15828
|
"range": {
|
|
@@ -17665,6 +17675,7 @@
|
|
|
17665
17675
|
"value": "pound",
|
|
17666
17676
|
"number": "many",
|
|
17667
17677
|
"text": "pounds",
|
|
17678
|
+
"dimension": "weight",
|
|
17668
17679
|
"marker": "pound",
|
|
17669
17680
|
"word": "pounds",
|
|
17670
17681
|
"range": {
|
|
@@ -17695,6 +17706,7 @@
|
|
|
17695
17706
|
"value": "kilogram",
|
|
17696
17707
|
"number": "many",
|
|
17697
17708
|
"text": "kilograms",
|
|
17709
|
+
"dimension": "weight",
|
|
17698
17710
|
"marker": "kilogram",
|
|
17699
17711
|
"word": "kilograms",
|
|
17700
17712
|
"range": {
|
|
@@ -19547,6 +19559,7 @@
|
|
|
19547
19559
|
"value": "ounce",
|
|
19548
19560
|
"number": "many",
|
|
19549
19561
|
"text": "ounces",
|
|
19562
|
+
"dimension": "weight",
|
|
19550
19563
|
"marker": "ounce",
|
|
19551
19564
|
"word": "ounces",
|
|
19552
19565
|
"range": {
|
|
@@ -19577,6 +19590,7 @@
|
|
|
19577
19590
|
"value": "pound",
|
|
19578
19591
|
"number": "many",
|
|
19579
19592
|
"text": "pounds",
|
|
19593
|
+
"dimension": "weight",
|
|
19580
19594
|
"marker": "pound",
|
|
19581
19595
|
"word": "pounds",
|
|
19582
19596
|
"range": {
|
|
@@ -21433,6 +21447,7 @@
|
|
|
21433
21447
|
"value": "ton",
|
|
21434
21448
|
"number": "one",
|
|
21435
21449
|
"text": "ton",
|
|
21450
|
+
"dimension": "weight",
|
|
21436
21451
|
"marker": "ton",
|
|
21437
21452
|
"word": "ton",
|
|
21438
21453
|
"range": {
|
|
@@ -23316,6 +23331,7 @@
|
|
|
23316
23331
|
"value": "pound",
|
|
23317
23332
|
"number": "many",
|
|
23318
23333
|
"text": "pounds",
|
|
23334
|
+
"dimension": "weight",
|
|
23319
23335
|
"marker": "pound",
|
|
23320
23336
|
"word": "pounds",
|
|
23321
23337
|
"range": {
|
|
@@ -23346,6 +23362,7 @@
|
|
|
23346
23362
|
"value": "ton",
|
|
23347
23363
|
"number": "one",
|
|
23348
23364
|
"text": "ton",
|
|
23365
|
+
"dimension": "weight",
|
|
23349
23366
|
"marker": "ton",
|
|
23350
23367
|
"word": "ton",
|
|
23351
23368
|
"range": {
|
package/common/words.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
|
+
const { defaultContextCheck } = require('./helpers')
|
|
3
|
+
const words_tests = require('./words.test.json')
|
|
4
|
+
const words_instance = require('./words.instance.json')
|
|
5
|
+
const tokenize = require('./tokenize')
|
|
6
|
+
|
|
7
|
+
function initializer({objects, config, isModule}) {
|
|
8
|
+
objects.words = []
|
|
9
|
+
config.addArgs((args) => ({
|
|
10
|
+
getWordFromDictionary: (partial) => {
|
|
11
|
+
for (const word of objects.words) {
|
|
12
|
+
let matches = true
|
|
13
|
+
for (const key in partial) {
|
|
14
|
+
if (partial[key] !== word[key]) {
|
|
15
|
+
matches = false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (matches) {
|
|
19
|
+
return word
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
addWordToDictionary: (context) => {
|
|
24
|
+
objects.words.push(context)
|
|
25
|
+
}
|
|
26
|
+
}))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const template = {
|
|
30
|
+
configs: [],
|
|
31
|
+
fragments: [],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
knowledgeModule( {
|
|
35
|
+
config: { name: 'words' },
|
|
36
|
+
includes: [tokenize],
|
|
37
|
+
initializer,
|
|
38
|
+
|
|
39
|
+
module,
|
|
40
|
+
description: 'talking about words',
|
|
41
|
+
test: {
|
|
42
|
+
name: './words.test.json',
|
|
43
|
+
contents: words_tests,
|
|
44
|
+
checks: {
|
|
45
|
+
context: [defaultContextCheck()],
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
template: {
|
|
49
|
+
template,
|
|
50
|
+
instance: words_instance,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
})
|