tpmkms_4wp 9.5.1-beta.9 → 9.6.0
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/asking.js +12 -4
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2162 -5
- package/common/can.js +101 -35
- package/common/can.test.json +51307 -0
- package/common/colors.instance.json +2 -30
- package/common/comparable.instance.json +1 -1
- package/common/concept.js +25 -27
- package/common/concept.test.json +142 -120
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +163 -113
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +3 -3
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +0 -84
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +31 -112
- package/common/dialogues.test.json +1171 -996
- package/common/dimension.instance.json +21374 -562
- package/common/dimension.js +145 -51
- package/common/dimension.test.json +8753 -3495
- package/common/drone.instance.json +23712 -0
- package/common/drone.js +448 -0
- package/common/drone.test.json +66665 -0
- package/common/edible.instance.json +9 -65
- package/common/emotions.instance.json +47 -70
- package/common/errors.js +3 -3
- package/common/fastfood.instance.json +758 -266
- package/common/fastfood.js +7 -7
- package/common/fastfood.test.json +6970 -6829
- package/common/gdefaults.js +58 -13
- package/common/help.js +9 -9
- package/common/help.test.json +65 -11
- package/common/helpers/dialogues.js +6 -1
- package/common/helpers/properties.js +36 -16
- package/common/helpers.js +32 -2
- package/common/hierarchy.js +3 -1
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +27611 -2889
- package/common/length.js +6 -1
- package/common/length.test.json +45315 -3925
- package/common/math.instance.json +1 -1
- package/common/menus.instance.json +4 -7
- package/common/menus.js +1 -8
- package/common/meta.js +1 -0
- package/common/nameable.js +13 -6
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +4 -2
- package/common/ordering.test.json +104 -174
- package/common/people.instance.json +60 -315
- package/common/pipboy.instance.json +1 -57
- package/common/pokemon.instance.json +5 -5
- package/common/pressure.instance.json +3959 -1990
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +5 -16
- package/common/properties.js +3 -3
- package/common/properties.test.json +9565 -6951
- package/common/rates.instance.json +59 -0
- package/common/rates.js +97 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.js +2 -2
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +2 -2
- package/common/spock.test.json +606 -430
- package/common/stm.js +13 -2
- package/common/temperature.instance.json +3658 -1689
- package/common/temperature.test.json +433 -477
- package/common/time.instance.json +24762 -0
- package/common/time.js +135 -139
- package/common/time.test.json +31876 -3757
- package/common/ui.instance.json +2 -5
- package/common/ui.js +1 -8
- package/common/weight.instance.json +10359 -4077
- package/common/weight.test.json +2601 -2263
- 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 +330 -58
- package/common/wp.js +4 -0
- package/common/wp.test.json +7385 -6906
- package/main.js +4 -2
- package/package.json +16 -5
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/can.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
|
-
const { defaultContextCheck } = require('./helpers')
|
|
2
|
+
const { defaultContextCheck, propertyToArray } = require('./helpers')
|
|
3
3
|
const hierarchy = require("./hierarchy")
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const tests = require('./can.test.json')
|
|
5
|
+
const instance = require('./can.instance.json')
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
you can make these coffees -> list of coffees
|
|
@@ -46,28 +46,7 @@ const config = {
|
|
|
46
46
|
// who can coffee be made by
|
|
47
47
|
"((*) [whatCanQuestionPassive|can] (*) ([beCanPassive|be]) (canableAction) ([byCanPassive|by]))",
|
|
48
48
|
"((*) [canPassive|can] ([beCanPassive|be]) (canableAction) ([byCanPassive|by]) (*))",
|
|
49
|
-
/*
|
|
50
|
-
bridge: [
|
|
51
|
-
// b=[do] o=c a=[s, ca]
|
|
52
|
-
apply operator { ...after[1], can } to operator
|
|
53
|
-
// b=[do] o=[ca+c] a=[s, ca]
|
|
54
|
-
rewire before[0] -> after[0] + after[0] -> before[0]
|
|
55
|
-
// b=[s] o=[ca+c] a=[do, ca]
|
|
56
|
-
apply operator
|
|
57
|
-
]
|
|
58
|
-
*/
|
|
59
|
-
// Bridge('{ ...before }'-(Rewire before[0] to after[0] Set after to [ListableType(Listable(Type('likee')))]), '{ ...next(operator), likee*: after[0], liker: before[0] }')
|
|
60
49
|
],
|
|
61
|
-
/*
|
|
62
|
-
associations: {
|
|
63
|
-
positive: [
|
|
64
|
-
{ context: [['what', 0], ['whatCanQuestionPassive', 0], ['unknown', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0]], choose: 1 },
|
|
65
|
-
{ context: [['what', 1], ['whatCanQuestionPassive', 0], ['unknown', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0]], choose: 1 },
|
|
66
|
-
{ context: [['unknown', 0], ['canPassive', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0], ['unknown', 0]], choose: 1 },
|
|
67
|
-
{ context: [['unknown', 1], ['canPassive', 0], ['beCanPassive', 0], ['make', 0], ['byCanPassive', 0], ['unknown', 0]], choose: 1 },
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
*/
|
|
71
50
|
bridges: [
|
|
72
51
|
{ id: 'beCanPassive' },
|
|
73
52
|
{ id: 'byCanPassive' },
|
|
@@ -78,13 +57,12 @@ const config = {
|
|
|
78
57
|
{
|
|
79
58
|
id: "canStatement",
|
|
80
59
|
before: ['verb'],
|
|
81
|
-
bridge: "{ ...after[0], can: operator, verb: after[0], interpolate: [{ property: 'can' }, { property: 'verb', context: { number: 'one' } }]}",
|
|
60
|
+
bridge: "{ ...after[0], can: operator, verb: after[0], voice: 'active', interpolate: [{ property: 'can' }, { property: 'verb', context: { number: 'one' } }]}",
|
|
82
61
|
},
|
|
83
62
|
{
|
|
84
63
|
id: "canQuestion",
|
|
85
64
|
before: ['verb'],
|
|
86
|
-
|
|
87
|
-
bridge: "{ ...after[0], operator.number: 'infinitive', truthValueOnly: true, query: true, can: operator, interpolate: append([{ property: 'can'}], after[0].interpolate)}",
|
|
65
|
+
bridge: "{ ...after[0], operator.form: 'infinitive', voice: 'active', truthValueOnly: true, query: true, can: operator, interpolate: append([{ property: 'can'}], after[0].interpolate)}",
|
|
88
66
|
},
|
|
89
67
|
{
|
|
90
68
|
// "((*) [canPassive|can] ([beCanPassive|be]) (canableAction) ([byCanPassive|by]) (*))",
|
|
@@ -100,7 +78,7 @@ const config = {
|
|
|
100
78
|
]
|
|
101
79
|
},
|
|
102
80
|
{ "apply": true, "operator": "operator", "set": "context" },
|
|
103
|
-
{ "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], {
|
|
81
|
+
{ "apply": true, "bridge": "{ ...context, voice: 'passive', interpolate: [context.interpolate[2], { word: { marker: 'canPassive' } }, { word: { marker: 'beCanPassive' } }, context.interpolate[1], { word: { marker: 'byCanPassive' } }, context.interpolate[0]] }", "set": "context" },
|
|
104
82
|
// { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
|
|
105
83
|
],
|
|
106
84
|
},
|
|
@@ -112,7 +90,7 @@ const config = {
|
|
|
112
90
|
// { "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1], interpolate: [{ property: 'can' }, { property: 'operator' }] }", "set": "operator" },
|
|
113
91
|
{ "apply": true, "bridge": "{ ...after[2], can: operator, be: after[1], operator: after[2], by: after[3] }", "set": "operator" },
|
|
114
92
|
{ "apply": true, "operator": "operator", "set": "context" },
|
|
115
|
-
{ "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[0], {
|
|
93
|
+
{ "apply": true, "bridge": "{ ...context, voice: 'passive', interpolate: [context.interpolate[0], { word: { marker: 'canPassive' } }, context.interpolate[2], { word: { marker: 'beCanPassive' } }, context.interpolate[1], { word: { marker: 'byCanPassive' } }] }", "set": "context" },
|
|
116
94
|
// { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
|
|
117
95
|
],
|
|
118
96
|
},
|
|
@@ -121,7 +99,7 @@ const config = {
|
|
|
121
99
|
before: ['verb'],
|
|
122
100
|
bridge: [
|
|
123
101
|
// { "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1], interpolate: [{ property: 'can' }, { property: 'operator' }] }", "set": "operator" },
|
|
124
|
-
{ "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1] }", "set": "operator" },
|
|
102
|
+
{ "apply": true, "bridge": "{ ...after[1], can: operator, voice: 'active', operator: after[1] }", "set": "operator" },
|
|
125
103
|
{
|
|
126
104
|
"rewire": [
|
|
127
105
|
{ "from": 'before[0]', "to": 'after[0]' },
|
|
@@ -129,14 +107,69 @@ const config = {
|
|
|
129
107
|
]
|
|
130
108
|
},
|
|
131
109
|
{ "apply": true, "operator": "operator", "set": "context" },
|
|
132
|
-
{ "apply": true, "bridge": "{ ...context, operator.
|
|
110
|
+
{ "apply": true, "bridge": "{ ...context, operator.form: 'infinitive', interpolate: [context.interpolate[2], { property: 'can' }, context.interpolate[0], context.interpolate[1]] }", "set": "context" },
|
|
133
111
|
// { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
|
|
134
112
|
],
|
|
135
113
|
},
|
|
136
114
|
],
|
|
115
|
+
semantics: [
|
|
116
|
+
{
|
|
117
|
+
match: ({context}) => context.toVoice == 'passive',
|
|
118
|
+
apply: async ({g, context, fragmentMapper}) => {
|
|
119
|
+
for (const element of propertyToArray(context)) {
|
|
120
|
+
if (!element.voice) {
|
|
121
|
+
continue
|
|
122
|
+
}
|
|
123
|
+
if (element.voice === 'passive') {
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
// From
|
|
127
|
+
// [{"property":"canSubject"},{"property":"operator","number":"canSubject"},{"property":"canObject"}]
|
|
128
|
+
element.interpolate = [
|
|
129
|
+
element.interpolate[2],
|
|
130
|
+
{ word: { marker: "canPassive" } },
|
|
131
|
+
{ word: { marker: "beCanPassive" } },
|
|
132
|
+
// { tense: "perfect", property: "verb" },
|
|
133
|
+
{ semantic: [{ property: "verb" }, { overrides: { tense: "perfect", evaluateWord: true } }] },
|
|
134
|
+
{ word: { marker: "byCanPassive" } },
|
|
135
|
+
element.interpolate[0],
|
|
136
|
+
]
|
|
137
|
+
element.voice = 'passive'
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
match: ({context}) => context.toVoice == 'active',
|
|
143
|
+
apply: async ({g, context, fragmentMapper}) => {
|
|
144
|
+
// From
|
|
145
|
+
// [{"property":"canSubject"},{"property":"operator","number":"canSubject"},{"property":"canObject"}]
|
|
146
|
+
for (const element of propertyToArray(context)) {
|
|
147
|
+
if (!element.voice) {
|
|
148
|
+
continue
|
|
149
|
+
}
|
|
150
|
+
if (element.voice === 'active') {
|
|
151
|
+
continue
|
|
152
|
+
}
|
|
153
|
+
element.interpolate = [
|
|
154
|
+
element.interpolate[5],
|
|
155
|
+
{ "word": { "marker": "canPassive" } },
|
|
156
|
+
// { "number": element.interpolate[5].property, "property": "operator" },
|
|
157
|
+
{ semantic: [{ property: "operator" }, { overrides: { form: "infinitive", evaluateWord: true } }] },
|
|
158
|
+
element.interpolate[0],
|
|
159
|
+
]
|
|
160
|
+
element.voice = 'active'
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
],
|
|
137
165
|
};
|
|
138
166
|
|
|
139
167
|
const template = {
|
|
168
|
+
fragments: [
|
|
169
|
+
"canobject can be canverb by cansubject",
|
|
170
|
+
"cansubject can canverb canobject",
|
|
171
|
+
],
|
|
172
|
+
|
|
140
173
|
configs: [
|
|
141
174
|
({isProcess, isTesting, testModuleName, apis, config, addHierarchy}) => {
|
|
142
175
|
if (isProcess || isTesting) {
|
|
@@ -163,7 +196,38 @@ const template = {
|
|
|
163
196
|
config,
|
|
164
197
|
})
|
|
165
198
|
}
|
|
166
|
-
|
|
199
|
+
const api = apis('properties')
|
|
200
|
+
api.createActionPrefix({
|
|
201
|
+
before: [{tag: 'canSubject', id: 'canSubject'}],
|
|
202
|
+
operator: 'canVerb',
|
|
203
|
+
after: [{tag: 'canObject', id: 'canObject'}],
|
|
204
|
+
relation: true,
|
|
205
|
+
flatten: true,
|
|
206
|
+
can: true,
|
|
207
|
+
create: [
|
|
208
|
+
{
|
|
209
|
+
id: 'canVerb',
|
|
210
|
+
},
|
|
211
|
+
'canObject',
|
|
212
|
+
'canSubject'
|
|
213
|
+
],
|
|
214
|
+
localHierarchy: [
|
|
215
|
+
['unknown', 'canObject'],
|
|
216
|
+
['unknown', 'canSubject'],
|
|
217
|
+
],
|
|
218
|
+
config,
|
|
219
|
+
})
|
|
220
|
+
},
|
|
221
|
+
async ({fragments, addWordToDictionary}) => {
|
|
222
|
+
const fragment = await fragments("canobject can be canverb by cansubject")
|
|
223
|
+
// only run after rebuild template
|
|
224
|
+
if (fragment) {
|
|
225
|
+
const context = fragment.contexts()[0]
|
|
226
|
+
addWordToDictionary(context.be)
|
|
227
|
+
addWordToDictionary(context.by)
|
|
228
|
+
addWordToDictionary(context.can)
|
|
229
|
+
}
|
|
230
|
+
},
|
|
167
231
|
]
|
|
168
232
|
}
|
|
169
233
|
|
|
@@ -175,14 +239,16 @@ knowledgeModule( {
|
|
|
175
239
|
description: 'talk about what can be done',
|
|
176
240
|
test: {
|
|
177
241
|
name: './can.test.json',
|
|
178
|
-
contents:
|
|
242
|
+
contents: tests,
|
|
179
243
|
checks: {
|
|
180
|
-
context: [
|
|
244
|
+
context: [
|
|
245
|
+
defaultContextCheck({ extra: ['can', 'evalue', 'makeable', 'maker', 'operator', 'interpolate', 'number', 'property', 'word'] }),
|
|
246
|
+
],
|
|
181
247
|
},
|
|
182
248
|
},
|
|
183
249
|
template: {
|
|
184
250
|
template,
|
|
185
|
-
instance
|
|
251
|
+
instance,
|
|
186
252
|
},
|
|
187
253
|
|
|
188
254
|
})
|