tpmkms_4wp 8.9.1-beta.2 → 8.9.1-beta.20
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 +260 -68
- package/common/articles.js +20 -4
- package/common/articles.test.json +338 -0
- package/common/asking.js +2 -2
- package/common/asking.test.json +41 -0
- package/common/avatar.js +1 -1
- package/common/characters.js +1 -1
- package/common/colors.instance.json +280 -129
- package/common/comparable.instance.json +60 -12
- package/common/comparable.js +2 -2
- package/common/concept.js +1 -1
- package/common/conjunction.js +1 -1
- package/common/countable.js +3 -9
- package/common/countable.test.json +0 -586
- package/common/crew.instance.json +604 -380
- package/common/currency.js +2 -2
- package/common/dialogues.js +28 -11
- package/common/dimension.instance.json +16 -8
- package/common/dimension.js +2 -2
- package/common/edible.instance.json +512 -278
- package/common/emotions.instance.json +20 -4
- package/common/errors.js +3 -1
- package/common/events.js +1 -1
- package/common/fastfood.instance.json +2138 -1357
- package/common/fastfood.js +4 -4
- package/common/formulas.instance.json +16 -5
- package/common/formulas.js +1 -1
- package/common/formulas.test.json +461 -10
- package/common/gdefaults.js +22 -14
- package/common/help.js +4 -4
- package/common/help.test.json +4 -4
- package/common/helpers/concept.js +5 -5
- 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 +17 -17
- package/common/helpers.js +17 -1
- package/common/hierarchy.js +3 -3
- package/common/javascript.js +1 -1
- package/common/kirk.instance.json +20 -4
- package/common/length.instance.json +240 -80
- package/common/math.instance.json +16 -5
- 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 +41 -63
- package/common/ordinals.js +9 -3
- package/common/ordinals.test.json +327 -0
- package/common/people.instance.json +160 -32
- package/common/people.js +1 -1
- package/common/percentages.js +1 -1
- package/common/pipboy.instance.json +282 -252
- package/common/pipboy.js +6 -6
- package/common/pokemon.instance.json +260 -57
- package/common/pos.js +16 -6
- package/common/pressure.instance.json +64 -23
- package/common/properties.instance.json +20 -4
- package/common/properties.js +5 -5
- package/common/punctuation.js +1 -1
- package/common/reports.instance.json +34 -12
- package/common/reports.js +8 -8
- package/common/scorekeeper.js +5 -5
- package/common/sdefaults.js +2 -2
- package/common/sizeable.js +2 -2
- package/common/spock.instance.json +20 -4
- package/common/stm.js +6 -6
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +64 -24
- package/common/tester.js +1 -1
- package/common/ui.instance.json +21 -5
- package/common/weight.instance.json +192 -64
- package/common/wp.instance.json +6378 -463
- package/common/wp.js +188 -41
- package/common/wp.test.json +109609 -3828
- package/common/yesno.js +1 -1
- package/package.json +11 -6
package/common/wp.js
CHANGED
@@ -9,15 +9,64 @@ const wp_tests = require('./wp.test.json')
|
|
9
9
|
const instance = require('./wp.instance.json')
|
10
10
|
|
11
11
|
/*
|
12
|
+
done
|
13
|
+
|
14
|
+
bold the first word
|
15
|
+
bold the first paragraph
|
16
|
+
bold the first letter
|
17
|
+
bold the first word of every paragraph
|
18
|
+
bold the first word of the second and third paragraph
|
19
|
+
bold the paragraph that contains words that start with t
|
20
|
+
underline the paragraph that contains bolded words
|
21
|
+
underline the paragraphs that contain bolded words
|
22
|
+
bold the first letter of every word
|
23
|
+
bold the third letter of the second paragraph
|
24
|
+
bold the first letter of every word that starts with t
|
25
|
+
underline the bolded words in the second paragraph
|
26
|
+
bold the words that start with t in the second paragraph
|
27
|
+
bold the first letter of the words that start with t in the second paragraph
|
28
|
+
in the second paragraph bold the first word
|
29
|
+
in the second paragraph bold the first letter of the words that start with t
|
30
|
+
underline the first bolded word
|
31
|
+
underline the first three words
|
32
|
+
|
33
|
+
current
|
34
|
+
|
35
|
+
in the first and second paragraph bold the first word
|
36
|
+
|
37
|
+
todo
|
38
|
+
|
39
|
+
underline the last three words
|
40
|
+
underline the first three bolded words
|
41
|
+
for paragraph 1 and 2 bold the first word
|
42
|
+
in the second paragraph for the words that start with t bold the first letter
|
43
|
+
underline the bolded paragraphs
|
44
|
+
bold the first three words after the second bolded letter
|
45
|
+
underline the words that start with t in the paragraph with 3 bolded words
|
46
|
+
bold the paragraph that contains three bolded words
|
47
|
+
capitalize the first letter of the words that start with t
|
48
|
+
underline the first bolded word that start with t
|
49
|
+
bold the first word of the second paragraph and third paragraph
|
50
|
+
the paragraph that contains the word boobies
|
51
|
+
|
52
|
+
after
|
53
|
+
make the words that start with t blue
|
54
|
+
|
12
55
|
the bolded words that start with t
|
13
56
|
|
57
|
+
replace better with worse
|
58
|
+
|
59
|
+
change underlines to bolds
|
60
|
+
|
14
61
|
start inserting text until I say banana
|
15
62
|
...
|
16
63
|
or
|
17
64
|
stop inserting text
|
18
65
|
|
19
66
|
make the text of the 1st to 3rd paragraphs blue
|
20
|
-
|
67
|
+
|
68
|
+
capitalize the words banana and word
|
69
|
+
capitalize banana and tree
|
21
70
|
|
22
71
|
make the words that start with a bold
|
23
72
|
|
@@ -40,6 +89,8 @@ const instance = require('./wp.instance.json')
|
|
40
89
|
words containing a
|
41
90
|
every 5th word
|
42
91
|
|
92
|
+
the words that are capitalized
|
93
|
+
|
43
94
|
in the first paragraph make the words that start with abc bold
|
44
95
|
bold the first three words that start with t
|
45
96
|
bold much and many
|
@@ -74,7 +125,7 @@ const setUpdate = (isA, update, states) => {
|
|
74
125
|
if (!update.styles) {
|
75
126
|
update.styles = []
|
76
127
|
}
|
77
|
-
|
128
|
+
const style = root(state.value)
|
78
129
|
/*
|
79
130
|
if (style == 'underlined') {
|
80
131
|
style = 'underline'
|
@@ -91,31 +142,68 @@ const setUpdate = (isA, update, states) => {
|
|
91
142
|
|
92
143
|
const api = new API()
|
93
144
|
|
94
|
-
|
145
|
+
const config = {
|
95
146
|
name: 'wp',
|
96
147
|
};
|
97
148
|
|
98
149
|
const changeState = ({api, isA, context, toArray, element, state}) => {
|
99
|
-
let unit = root(context.element.marker)
|
100
150
|
let scope
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
conditions.push(
|
151
|
+
|
152
|
+
const getElement = (selector, update) => {
|
153
|
+
const unit = root(selector.marker)
|
154
|
+
const conditions = []
|
155
|
+
let scope;
|
156
|
+
const condition = []
|
157
|
+
if (selector.ordinal) {
|
158
|
+
// TODO think this out better but its just POC so good enough for now
|
159
|
+
const condition = { ordinals: toArray(selector.ordinal).map((context) => context.value) }
|
160
|
+
if (selector.quantity) {
|
161
|
+
condition.count = selector.quantity.value
|
162
|
+
}
|
163
|
+
conditions.push(condition)
|
164
|
+
} else if (isA(selector, 'everything')) {
|
165
|
+
scope = 'all'
|
166
|
+
} else if (selector.quantity) {
|
167
|
+
scope = selector.quantity.quantity
|
168
|
+
} if (selector.distributer) {
|
169
|
+
scope = selector.distributer.value
|
170
|
+
}
|
171
|
+
|
172
|
+
if (selector.conditions) {
|
173
|
+
for (const condition of selector.conditions) {
|
174
|
+
if (condition.marker == 'wordComparisonWithVerb_wp') {
|
175
|
+
// with or not with that is the question
|
176
|
+
const letters = condition.letters.letters.text
|
177
|
+
conditions.push({ comparison: condition.comparison, letters })
|
178
|
+
} else if (condition.marker == 'wordComparison_wp') {
|
179
|
+
// with or not with that is the question
|
180
|
+
const letters = condition.letters.text
|
181
|
+
conditions.push({ comparison: condition.comparison, letters })
|
182
|
+
} else if (condition.marker == 'paragraphComparisonVerb_wp') {
|
183
|
+
// with or not with that is the question
|
184
|
+
const update = { selectors: [] }
|
185
|
+
const words = getElement(condition.words, update)
|
186
|
+
conditions.push({ comparison: condition.comparison, words: update})
|
187
|
+
} else if (isA(condition, 'styleModifier_wp')) {
|
188
|
+
for (const style of toArray(condition)) {
|
189
|
+
conditions.push({ hasStyle: style.marker })
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
114
193
|
}
|
115
|
-
|
116
|
-
|
194
|
+
|
195
|
+
if (selector.context) {
|
196
|
+
for (const context of toArray(selector.context)) {
|
197
|
+
getElement(context, update)
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
update.selectors.push({ unit, scope, conditions })
|
117
202
|
}
|
118
|
-
|
203
|
+
|
204
|
+
const update = { selectors: [] }
|
205
|
+
getElement(context.element, update)
|
206
|
+
|
119
207
|
setUpdate(isA, update, toArray(context.state))
|
120
208
|
api.changeState(update)
|
121
209
|
}
|
@@ -123,10 +211,11 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
|
|
123
211
|
template = {
|
124
212
|
configs: [
|
125
213
|
'setidsuffix _wp',
|
126
|
-
'words are countable and statefulElements',
|
127
|
-
'characters are countable',
|
128
|
-
'paragraphs are countable and statefulElement',
|
214
|
+
'words are countable distributable orderable textContainers and statefulElements',
|
215
|
+
'characters are countable distributable orderable and statefulElements',
|
216
|
+
'paragraphs are countable distributable orderable textContainers and statefulElement',
|
129
217
|
'text is a statefulElement',
|
218
|
+
'letters means characters',
|
130
219
|
'bold, italic, code, capitalize, lowercase and underline are styles',
|
131
220
|
'underlined means underline',
|
132
221
|
'capitalized means capitalize',
|
@@ -134,7 +223,7 @@ template = {
|
|
134
223
|
'italicize means italic',
|
135
224
|
'italicized means italic',
|
136
225
|
// TODO have a mode where I can stay this is a definition sentence then just say style modifies and it will do it right
|
137
|
-
'capitalized, bolded, italicized and underlined are styleModifiers',
|
226
|
+
'uppercased, lowercased, capitalized, bolded, italicized and underlined are styleModifiers',
|
138
227
|
// 'start end and contain are wordComparisonWiths',
|
139
228
|
// 'styles are negatable',
|
140
229
|
"resetIdSuffix",
|
@@ -142,19 +231,81 @@ template = {
|
|
142
231
|
operators: [
|
143
232
|
"([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
|
144
233
|
"((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
|
145
|
-
"((word_wp/*) [
|
234
|
+
"((word_wp/*) [wordComparisonWithVerb_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
|
146
235
|
"((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
|
147
|
-
"
|
236
|
+
// this one is "the bolded/underlined/italized/... word"
|
237
|
+
"((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/* && context.determiner == undefined))",
|
238
|
+
// the first letter of each paragraph
|
239
|
+
"((statefulElement_wp/*)? <statefulElementInContext_wp|of,in> (statefulElement_wp/*))",
|
240
|
+
// the paragraph that contains words that start with t
|
241
|
+
"((paragraph_wp/*) [paragraphComparisonVerb_wp] (word_wp/*))",
|
148
242
|
],
|
243
|
+
associations: {
|
244
|
+
negative: [
|
245
|
+
],
|
246
|
+
positive: [
|
247
|
+
// TODO remove these after crucible work done and fix the associator rules
|
248
|
+
[['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['word_wp', 0]],
|
249
|
+
[['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['styleModifier_wp', 0], ['word_wp', 0]],
|
250
|
+
[['word_wp', 0], ['thatVerb', 0], ['wordComparison_wp', 0]],
|
251
|
+
]
|
252
|
+
},
|
253
|
+
|
149
254
|
bridges: [
|
255
|
+
{
|
256
|
+
id: 'paragraphComparisonVerb_wp',
|
257
|
+
parents: ['verb'],
|
258
|
+
words: [
|
259
|
+
{ word: 'contain', comparison: 'include' },
|
260
|
+
{ word: 'contains', comparison: 'include' },
|
261
|
+
{ word: 'include', comparison: 'include' },
|
262
|
+
{ word: 'includes', comparison: 'include' },
|
263
|
+
],
|
264
|
+
bridge: "{ ...next(operator), element: before[0], subject: before[0], words: after[0], verb: operator, generate: ['element', 'verb', 'words'] }",
|
265
|
+
},
|
266
|
+
{
|
267
|
+
id: 'statefulElementInContext_wp',
|
268
|
+
parents: ['preposition'],
|
269
|
+
optional: {
|
270
|
+
'-1': "{ ...operator, invisible: true }",
|
271
|
+
},
|
272
|
+
bridge: "{ ...next(before[0]), context: append(before[0].context, [after[0]]), generate: [before[0], operator, after[0]], modifiers: [] }",
|
273
|
+
semantic: (args) => {
|
274
|
+
const { context, contexts } = args
|
275
|
+
for (let i = context.context_index + 1; i < contexts.length; ++i) {
|
276
|
+
if (contexts[i].marker == 'applyStyle_wp') {
|
277
|
+
const element = contexts[i].element
|
278
|
+
if (!element.context) {
|
279
|
+
element.context = []
|
280
|
+
}
|
281
|
+
element.context = element.context.concat(context.context)
|
282
|
+
}
|
283
|
+
}
|
284
|
+
console.log(JSON.stringify(Object.keys(args)))
|
285
|
+
},
|
286
|
+
},
|
287
|
+
{
|
288
|
+
id: 'applyStyle_wp',
|
289
|
+
parents: ['verb'],
|
290
|
+
convolution: true,
|
291
|
+
bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
|
292
|
+
localHierarchy: [
|
293
|
+
['thisitthat', 'statefulElement_wp'],
|
294
|
+
['everything', 'statefulElement_wp'],
|
295
|
+
],
|
296
|
+
semantic: (args) => {
|
297
|
+
changeState({...args, element: args.context.element, state: args.context.state})
|
298
|
+
}
|
299
|
+
},
|
150
300
|
{
|
151
301
|
id: 'modifiedByStyle_wp',
|
302
|
+
// parents: ['verb'],
|
152
303
|
parents: ['adjective'],
|
153
304
|
convolution: true,
|
154
305
|
bridge: "{ ...after[0], style: before[0], target: after[0], generate: ['style', 'target'], conditions: append(after[0].conditions, [before[0]]) }",
|
155
306
|
},
|
156
307
|
{
|
157
|
-
id: '
|
308
|
+
id: 'wordComparisonWithVerb_wp',
|
158
309
|
parents: ['verb'],
|
159
310
|
words: [
|
160
311
|
{ word: 'start', comparison: 'prefix' },
|
@@ -186,19 +337,6 @@ template = {
|
|
186
337
|
},
|
187
338
|
bridge: "{ ...next(operator), operator: operator, letters: after[1], generate: ['operator', 'letters'] }",
|
188
339
|
},
|
189
|
-
{
|
190
|
-
id: 'applyStyle_wp',
|
191
|
-
parents: ['verb'],
|
192
|
-
convolution: true,
|
193
|
-
bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
|
194
|
-
localHierarchy: [
|
195
|
-
['thisitthat', 'statefulElement_wp'],
|
196
|
-
['everything', 'statefulElement_wp'],
|
197
|
-
],
|
198
|
-
semantic: (args) => {
|
199
|
-
changeState({...args, element: args.context.element, state: args.context.state})
|
200
|
-
}
|
201
|
-
},
|
202
340
|
{
|
203
341
|
id: 'changeState_wp',
|
204
342
|
parents: ['verb'],
|
@@ -240,6 +378,15 @@ template = {
|
|
240
378
|
},
|
241
379
|
],
|
242
380
|
priorities: [
|
381
|
+
{ "context": [['ordinal', 1], ['list', 0], ['ordinal', 1], ['statefulElement_wp', 0]], ordered: true, choose: [1] },
|
382
|
+
{ "context": [['word_wp', 1], ['wordComparisonWithVerb_wp', 0], ['comparisonWith_wp', 1], ['statefulElementInContext_wp', 0]], ordered: true, choose: [1] },
|
383
|
+
{ "context": [['paragraphComparisonVerb_wp', 0], ['word_wp', 0], ['wordComparisonWithVerb_wp', 0]], ordered: true, choose: [2] },
|
384
|
+
{ "context": [['statefulElementInContext_wp', 0], ['word_wp', 0], ['wordComparisonWithVerb_wp', 0]], ordered: true, choose: [2] },
|
385
|
+
{ "context": [['statefulElementInContext_wp', 0], ['word_wp', 1], ['wordComparisonWithVerb_wp', 0], ['comparisonWith_wp', 1]], ordered: true, choose: [2,3] },
|
386
|
+
{ "context": [['statefulElementInContext_wp', 0], ['comparisonWith_wp', 0]], choose: [1] },
|
387
|
+
{ "context": [['paragraphComparisonVerb_wp', 0], ['wordComparisonWithVerb_wp', 0]], choose: [1] },
|
388
|
+
{ "context": [['ordinal',1], ['list', 0], ['ordinal', 1], ['word_wp', 1]], ordered: true, choose: [1] },
|
389
|
+
{ "context": [['changeState_wp',0], ['every', 0], ['word_wp', 1], ['list', 1]], ordered: true, choose: [1] },
|
243
390
|
{ "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
|
244
391
|
{ "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
|
245
392
|
],
|
@@ -262,7 +409,7 @@ knowledgeModule({
|
|
262
409
|
contents: wp_tests,
|
263
410
|
checks: {
|
264
411
|
context: [
|
265
|
-
...defaultContextCheck(),
|
412
|
+
...defaultContextCheck(['distributer', 'subject', 'element', 'letters', 'target', 'conditions' ]),
|
266
413
|
],
|
267
414
|
objects: [
|
268
415
|
'changeState',
|