tpmkms 9.5.1-beta.11 → 9.5.1-beta.13
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/can.instance.json +2168 -5
- package/common/can.js +99 -35
- package/common/colors.instance.json +28 -0
- package/common/crew.instance.json +138 -124
- package/common/dates.instance.json +84 -0
- package/common/dialogues.js +12 -9
- package/common/dimension.instance.json +15 -11
- package/common/dimension.js +23 -4
- package/common/dimension.test.json +1758 -2351
- package/common/edible.instance.json +56 -0
- package/common/emotions.instance.json +47 -70
- package/common/fastfood.instance.json +542 -210
- package/common/gdefaults.js +49 -10
- package/common/help.test.json +65 -11
- package/common/helpers/properties.js +32 -12
- package/common/hierarchy.js +1 -0
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +18 -0
- package/common/length.test.json +2241 -1801
- package/common/ordering.instance.json +4 -2
- package/common/people.instance.json +54 -1
- package/common/pipboy.instance.json +56 -0
- package/common/pressure.instance.json +4 -0
- package/common/properties.instance.json +3 -11
- package/common/reports.instance.json +2 -2
- package/common/temperature.instance.json +4 -0
- package/common/weight.instance.json +17 -0
- package/common/wp.instance.json +56 -0
- package/main.js +0 -2
- package/package.json +3 -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,
|
|
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,
|
|
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,16 +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
244
|
context: [
|
|
181
|
-
defaultContextCheck({ extra: ['can', 'evalue', 'makeable', 'maker', 'operator', 'interpolate', 'number', 'property'] }),
|
|
245
|
+
defaultContextCheck({ extra: ['can', 'evalue', 'makeable', 'maker', 'operator', 'interpolate', 'number', 'property', 'word'] }),
|
|
182
246
|
],
|
|
183
247
|
},
|
|
184
248
|
},
|
|
185
249
|
template: {
|
|
186
250
|
template,
|
|
187
|
-
instance
|
|
251
|
+
instance,
|
|
188
252
|
},
|
|
189
253
|
|
|
190
254
|
})
|
|
@@ -3586,6 +3586,20 @@
|
|
|
3586
3586
|
0
|
|
3587
3587
|
]
|
|
3588
3588
|
],
|
|
3589
|
+
[
|
|
3590
|
+
[
|
|
3591
|
+
"is",
|
|
3592
|
+
0
|
|
3593
|
+
],
|
|
3594
|
+
[
|
|
3595
|
+
"list",
|
|
3596
|
+
1
|
|
3597
|
+
],
|
|
3598
|
+
[
|
|
3599
|
+
"unknown",
|
|
3600
|
+
0
|
|
3601
|
+
]
|
|
3602
|
+
],
|
|
3589
3603
|
[
|
|
3590
3604
|
[
|
|
3591
3605
|
"is",
|
|
@@ -35813,6 +35827,20 @@
|
|
|
35813
35827
|
0
|
|
35814
35828
|
]
|
|
35815
35829
|
],
|
|
35830
|
+
[
|
|
35831
|
+
[
|
|
35832
|
+
"is",
|
|
35833
|
+
0
|
|
35834
|
+
],
|
|
35835
|
+
[
|
|
35836
|
+
"list",
|
|
35837
|
+
1
|
|
35838
|
+
],
|
|
35839
|
+
[
|
|
35840
|
+
"unknown",
|
|
35841
|
+
0
|
|
35842
|
+
]
|
|
35843
|
+
],
|
|
35816
35844
|
[
|
|
35817
35845
|
[
|
|
35818
35846
|
"is",
|