tpmkms_4wp 8.9.1-beta.3 → 8.9.1-beta.30

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.
Files changed (137) hide show
  1. package/common/animals.instance.json +6714 -809
  2. package/common/articles.js +22 -9
  3. package/common/articles.test.json +640 -2
  4. package/common/asking.js +3 -3
  5. package/common/asking.test.json +1599 -140
  6. package/common/avatar.js +9 -1
  7. package/common/avatar.test.json +6008 -2749
  8. package/common/characters.js +1 -1
  9. package/common/characters.test.json +1371 -95
  10. package/common/colors.instance.json +23070 -1697
  11. package/common/colors.test.json +704 -136
  12. package/common/comparable.instance.json +1340 -162
  13. package/common/comparable.js +13 -13
  14. package/common/comparable.test.json +3239 -558
  15. package/common/concept.js +11 -3
  16. package/common/concept.test.json +2853 -694
  17. package/common/conjunction.js +13 -1
  18. package/common/conjunction.test.json +229 -1
  19. package/common/countable.js +3 -9
  20. package/common/countable.test.json +1310 -638
  21. package/common/crew.instance.json +19487 -2160
  22. package/common/crew.js +19 -0
  23. package/common/crew.test.json +10218 -2145
  24. package/common/currency.js +2 -3
  25. package/common/currency.test.json +948 -64
  26. package/common/dialogues.js +99 -35
  27. package/common/dialogues.test.json +6611 -1905
  28. package/common/dimension.instance.json +760 -120
  29. package/common/dimension.js +18 -4
  30. package/common/dimension.test.json +23680 -11550
  31. package/common/edible.instance.json +21884 -2729
  32. package/common/edible.js +13 -0
  33. package/common/edible.test.json +1580 -304
  34. package/common/emotions.instance.json +2225 -254
  35. package/common/emotions.js +10 -2
  36. package/common/emotions.test.json +1134 -107
  37. package/common/errors.js +1 -1
  38. package/common/errors.test.json +88 -0
  39. package/common/evaluate.test.json +100 -1
  40. package/common/events.js +1 -1
  41. package/common/events.test.json +2197 -242
  42. package/common/fastfood.instance.json +82176 -10105
  43. package/common/fastfood.js +99 -12
  44. package/common/fastfood.test.json +65486 -21430
  45. package/common/formulas.instance.json +325 -58
  46. package/common/formulas.js +1 -1
  47. package/common/formulas.test.json +13202 -6757
  48. package/common/gdefaults.js +18 -8
  49. package/common/help.js +4 -4
  50. package/common/help.test.json +292 -4
  51. package/common/helpers/concept.js +6 -5
  52. package/common/helpers/conjunction.js +1 -1
  53. package/common/helpers/formulas.js +4 -4
  54. package/common/helpers/frankenhash.js +4 -4
  55. package/common/helpers/meta.js +4 -4
  56. package/common/helpers/ordering.js +2 -2
  57. package/common/helpers/properties.js +18 -48
  58. package/common/helpers.js +1 -1
  59. package/common/hierarchy.js +12 -3
  60. package/common/hierarchy.test.json +53813 -17340
  61. package/common/javascript.js +1 -1
  62. package/common/javascript.test.json +214 -11
  63. package/common/kirk.instance.json +322 -7
  64. package/common/kirk.test.json +1123 -254
  65. package/common/length.instance.json +9898 -805
  66. package/common/length.test.json +12055 -8184
  67. package/common/listener.test.json +39 -1
  68. package/common/math.instance.json +294 -57
  69. package/common/math.js +1 -1
  70. package/common/math.test.json +38557 -17754
  71. package/common/meta.instance.json +1 -0
  72. package/common/meta.js +13 -13
  73. package/common/meta.test.json +2770 -275
  74. package/common/nameable.js +1 -1
  75. package/common/nameable.test.json +5150 -1475
  76. package/common/negation.js +1 -1
  77. package/common/negation.test.json +146 -8
  78. package/common/numbers.js +1 -1
  79. package/common/numbers.test.json +234 -0
  80. package/common/ordering.instance.json +3862 -509
  81. package/common/ordering.test.json +2680 -1283
  82. package/common/ordinals.js +15 -3
  83. package/common/ordinals.test.json +627 -3
  84. package/common/people.instance.json +4032 -679
  85. package/common/people.js +1 -15
  86. package/common/people.test.json +27157 -13664
  87. package/common/percentages.js +1 -2
  88. package/common/percentages.test.json +313 -0
  89. package/common/pipboy.instance.json +13637 -1538
  90. package/common/pipboy.js +28 -48
  91. package/common/pipboy.test.json +17367 -5640
  92. package/common/pokemon.instance.json +6168 -695
  93. package/common/pokemon.test.json +1826 -389
  94. package/common/pos.js +16 -6
  95. package/common/pressure.instance.json +2637 -293
  96. package/common/pressure.test.json +2997 -1629
  97. package/common/properties.instance.json +907 -128
  98. package/common/properties.js +19 -28
  99. package/common/properties.test.json +46801 -14612
  100. package/common/punctuation.js +1 -1
  101. package/common/punctuation.test.json +327 -0
  102. package/common/reports.instance.json +997 -118
  103. package/common/reports.js +16 -9
  104. package/common/reports.test.json +16653 -2453
  105. package/common/scorekeeper.instance.json +1 -0
  106. package/common/scorekeeper.js +22 -12
  107. package/common/scorekeeper.test.json +42546 -15408
  108. package/common/sdefaults.js +2 -2
  109. package/common/sizeable.js +2 -2
  110. package/common/sizeable.test.json +1170 -215
  111. package/common/spock.instance.json +322 -7
  112. package/common/spock.test.json +1123 -254
  113. package/common/stgame.js +0 -1
  114. package/common/stgame.test.json +1371 -91
  115. package/common/stm.js +6 -6
  116. package/common/stm.test.json +842 -9
  117. package/common/tell.js +1 -1
  118. package/common/tell.test.json +224 -1
  119. package/common/temperature.instance.json +5983 -288
  120. package/common/temperature.test.json +2610 -1272
  121. package/common/tester.js +1 -1
  122. package/common/testing.test.json +84 -1
  123. package/common/time.test.json +5345 -272
  124. package/common/tokenize.js +3 -2
  125. package/common/tokenize.test.json +39 -0
  126. package/common/ui.instance.json +144 -26
  127. package/common/ui.js +0 -16
  128. package/common/ui.test.json +4620 -140
  129. package/common/weight.instance.json +9992 -790
  130. package/common/weight.js +10 -0
  131. package/common/weight.test.json +18658 -12176
  132. package/common/wp.instance.json +20091 -2018
  133. package/common/wp.js +197 -44
  134. package/common/wp.test.json +121113 -17800
  135. package/common/yesno.js +1 -1
  136. package/common/yesno.test.json +168 -4
  137. package/package.json +11 -6
package/common/wp.js CHANGED
@@ -9,15 +9,66 @@ 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
+ in the first and second paragraph bold the second word
33
+ underline the first three bolded words
34
+ capitalize the first letter of the words that start with t
35
+
36
+ current
37
+
38
+ change is editable to is really editable
39
+
40
+ todo
41
+
42
+ the first to fifth word
43
+ underline the last three words
44
+ for paragraph 1 and 2 bold the first word
45
+ in the second paragraph for the words that start with t bold the first letter
46
+ underline the bolded paragraphs
47
+ bold the first three words after the second bolded letter
48
+ underline the words that start with t in the paragraph with 3 bolded words
49
+ underline the paragraph that contains three bolded words
50
+ underline the first bolded word that start with t
51
+ bold the first word of the second paragraph and third paragraph
52
+ the paragraph that contains the word boobies
53
+
54
+ after
55
+ make the words that start with t blue
56
+
12
57
  the bolded words that start with t
13
58
 
59
+ replace better with worse
60
+
61
+ change underlines to bolds
62
+
14
63
  start inserting text until I say banana
15
64
  ...
16
65
  or
17
66
  stop inserting text
18
67
 
19
68
  make the text of the 1st to 3rd paragraphs blue
20
-
69
+
70
+ capitalize the words banana and word
71
+ capitalize banana and tree
21
72
 
22
73
  make the words that start with a bold
23
74
 
@@ -76,7 +127,7 @@ const setUpdate = (isA, update, states) => {
76
127
  if (!update.styles) {
77
128
  update.styles = []
78
129
  }
79
- let style = root(state.value)
130
+ const style = root(state.value)
80
131
  /*
81
132
  if (style == 'underlined') {
82
133
  style = 'underline'
@@ -93,36 +144,68 @@ const setUpdate = (isA, update, states) => {
93
144
 
94
145
  const api = new API()
95
146
 
96
- let config = {
147
+ const config = {
97
148
  name: 'wp',
98
149
  };
99
150
 
100
151
  const changeState = ({api, isA, context, toArray, element, state}) => {
101
- let unit = root(context.element.marker)
102
152
  let scope
103
- let conditions = []
104
- if (isA(context.element, 'everything')) {
105
- scope = 'all'
106
- } else if (context.element.conditions) {
107
- for (const condition of context.element.conditions) {
108
- if (condition.marker == 'wordComparisonWith_wp') {
109
- // with or not with that is the question
110
- const letters = condition.letters.letters.text
111
- conditions.push({ comparison: condition.comparison, letters })
112
- } else if (condition.marker == 'wordComparison_wp') {
113
- // with or not with that is the question
114
- const letters = condition.letters.text
115
- conditions.push({ comparison: condition.comparison, letters })
116
- } else if (isA(condition, 'styleModifier_wp')) {
117
- for (const style of toArray(condition)) {
118
- conditions.push({ hasStyle: style.marker })
153
+
154
+ const getElement = (selector, update) => {
155
+ const unit = root(selector.marker)
156
+ const conditions = []
157
+ let scope;
158
+ const condition = []
159
+ if (selector.ordinal) {
160
+ // TODO think this out better but its just POC so good enough for now
161
+ const condition = { ordinals: toArray(selector.ordinal).map((context) => context.value) }
162
+ if (selector.quantity) {
163
+ condition.count = selector.quantity.value
164
+ }
165
+ conditions.push(condition)
166
+ } else if (isA(selector, 'everything')) {
167
+ scope = 'all'
168
+ } else if (selector.quantity) {
169
+ scope = selector.quantity.quantity
170
+ } if (selector.distributer) {
171
+ scope = selector.distributer.value
172
+ }
173
+
174
+ if (selector.conditions) {
175
+ for (const condition of selector.conditions) {
176
+ if (condition.marker == 'wordComparisonWithVerb_wp') {
177
+ // with or not with that is the question
178
+ const letters = condition.letters.letters.text
179
+ conditions.push({ comparison: condition.comparison, letters })
180
+ } else if (condition.marker == 'wordComparison_wp') {
181
+ // with or not with that is the question
182
+ const letters = condition.letters.text
183
+ conditions.push({ comparison: condition.comparison, letters })
184
+ } else if (condition.marker == 'paragraphComparisonVerb_wp') {
185
+ // with or not with that is the question
186
+ const update = { selectors: [] }
187
+ const words = getElement(condition.words, update)
188
+ conditions.push({ comparison: condition.comparison, words: update})
189
+ } else if (isA(condition, 'styleModifier_wp')) {
190
+ for (const style of toArray(condition)) {
191
+ conditions.push({ hasStyle: style.marker })
192
+ }
119
193
  }
120
194
  }
121
195
  }
122
- } else {
123
- scope = context.element.quantity.quantity
196
+
197
+ if (selector.context) {
198
+ for (const context of toArray(selector.context)) {
199
+ getElement(context, update)
200
+ }
201
+ }
202
+
203
+ update.selectors.push({ unit, scope, conditions })
124
204
  }
125
- const update = { unit, scope, conditions }
205
+
206
+ const update = { selectors: [] }
207
+ getElement(context.element, update)
208
+
126
209
  setUpdate(isA, update, toArray(context.state))
127
210
  api.changeState(update)
128
211
  }
@@ -130,10 +213,11 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
130
213
  template = {
131
214
  configs: [
132
215
  'setidsuffix _wp',
133
- 'words are countable and statefulElements',
134
- 'characters are countable',
135
- 'paragraphs are countable and statefulElement',
216
+ 'words are countable distributable orderable textContainers and statefulElements',
217
+ 'characters are countable distributable orderable and statefulElements',
218
+ 'paragraphs are countable distributable orderable textContainers and statefulElement',
136
219
  'text is a statefulElement',
220
+ 'letters means characters',
137
221
  'bold, italic, code, capitalize, lowercase and underline are styles',
138
222
  'underlined means underline',
139
223
  'capitalized means capitalize',
@@ -141,20 +225,94 @@ template = {
141
225
  'italicize means italic',
142
226
  'italicized means italic',
143
227
  // TODO have a mode where I can stay this is a definition sentence then just say style modifies and it will do it right
144
- 'capitalized, bolded, italicized and underlined are styleModifiers',
228
+ 'uppercased, lowercased, capitalized, bolded, italicized and underlined are styleModifiers',
145
229
  // 'start end and contain are wordComparisonWiths',
146
230
  // 'styles are negatable',
147
231
  "resetIdSuffix",
148
232
  {
149
233
  operators: [
234
+ "([change_wp|change] (context.text !== 'to')* (context.text == 'to'))",
150
235
  "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
151
236
  "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
152
- "((word_wp/*) [wordComparisonWith_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
237
+ "((word_wp/*) [wordComparisonWithVerb_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
153
238
  "((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
154
239
  // this one is "the bolded/underlined/italized/... word"
155
240
  "((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/* && context.determiner == undefined))",
241
+ // the first letter of each paragraph
242
+ "((statefulElement_wp/*)? <statefulElementInContext_wp|of,in> (statefulElement_wp/*))",
243
+ // the paragraph that contains words that start with t
244
+ "((paragraph_wp/*) [paragraphComparisonVerb_wp] (word_wp/*))",
156
245
  ],
246
+ associations: {
247
+ negative: [
248
+ ],
249
+ positive: [
250
+ // TODO remove these after crucible work done and fix the associator rules
251
+ // [['style_wp', 0], ['statefulElement_wp', 0], ['statefulElementInContext_wp', 0], ['every', 0], ['statefulElement_wp', 0]],
252
+ { context: [['style_wp', 0], ['word_wp', 0], ['statefulElementInContext_wp', 0], ['paragraph_wp', 0]], choose: 0 },
253
+ { context: [['style_wp', 0], ['letter_wp', 0], ['statefulElementInContext_wp', 0], ['word_wp', 0]], choose: 0 },
254
+ { context: [['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['word_wp', 0]], choose: 0 },
255
+ { context: [['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['styleModifier_wp', 0], ['word_wp', 0]], choose: 0 },
256
+ { context: [['word_wp', 0], ['thatVerb', 0], ['wordComparison_wp', 0]], choose: 0 },
257
+ { context: [["style_wp",1],["article",0],["statefulElement_wp",1],["thatVerb",0],["paragraphComparisonVerb_wp",0],["styleModifier_wp",0],["statefulElement_wp",0]], choose: 0 },
258
+ { context: [["style_wp",1],["article",0],["statefulElement_wp",1],["thatVerb",0],["paragraphComparisonVerb_wp",0],["word_wp",0],["thatVerb",0],["wordComparisonWithVerb_wp",0],["comparisonWith_wp",0],["unknown",0]], choose: 0 },
259
+ { context: [["article",0],["statefulElement_wp",1],["thatVerb",0],["paragraphComparisonVerb_wp",0],["styleModifier_wp",0],["statefulElement_wp",0]], choose: 0 },
260
+
261
+ { context: [["style_wp",1],["article",0],["statefulElement_wp",1],["thatVerb",0],["wordComparison_wp",0],["unknown",0]], choose: 0 },
262
+ { context: [["style_wp",1],["statefulElement_wp",1],["thatVerb",0],["wordComparison_wp",0],["unknown",0]], choose: 0 },
263
+ ]
264
+ },
265
+
157
266
  bridges: [
267
+ {
268
+ id: 'change_wp',
269
+ bridge: "{ ...next(operator), from: after[0][0], generate: [operator, 'from', after[1]] }",
270
+ },
271
+ {
272
+ id: 'paragraphComparisonVerb_wp',
273
+ parents: ['verb'],
274
+ words: [
275
+ { word: 'contain', comparison: 'include' },
276
+ { word: 'contains', comparison: 'include' },
277
+ { word: 'include', comparison: 'include' },
278
+ { word: 'includes', comparison: 'include' },
279
+ ],
280
+ bridge: "{ ...next(operator), element: before[0], subject: before[0], words: after[0], verb: operator, generate: ['element', 'verb', 'words'] }",
281
+ },
282
+ {
283
+ id: 'statefulElementInContext_wp',
284
+ parents: ['preposition'],
285
+ optional: {
286
+ '-1': "{ ...operator, invisible: true }",
287
+ },
288
+ bridge: "{ ...next(before[0]), context: append(before[0].context, [after[0]]), generate: [before[0], operator, after[0]], modifiers: [] }",
289
+ semantic: (args) => {
290
+ const { context, contexts } = args
291
+ for (let i = context.context_index + 1; i < contexts.length; ++i) {
292
+ if (contexts[i].marker == 'applyStyle_wp') {
293
+ const element = contexts[i].element
294
+ if (!element.context) {
295
+ element.context = []
296
+ }
297
+ element.context = element.context.concat(context.context)
298
+ }
299
+ }
300
+ console.log(JSON.stringify(Object.keys(args)))
301
+ },
302
+ },
303
+ {
304
+ id: 'applyStyle_wp',
305
+ parents: ['verb'],
306
+ convolution: true,
307
+ bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
308
+ localHierarchy: [
309
+ ['thisitthat', 'statefulElement_wp'],
310
+ ['everything', 'statefulElement_wp'],
311
+ ],
312
+ semantic: (args) => {
313
+ changeState({...args, element: args.context.element, state: args.context.state})
314
+ }
315
+ },
158
316
  {
159
317
  id: 'modifiedByStyle_wp',
160
318
  // parents: ['verb'],
@@ -163,7 +321,7 @@ template = {
163
321
  bridge: "{ ...after[0], style: before[0], target: after[0], generate: ['style', 'target'], conditions: append(after[0].conditions, [before[0]]) }",
164
322
  },
165
323
  {
166
- id: 'wordComparisonWith_wp',
324
+ id: 'wordComparisonWithVerb_wp',
167
325
  parents: ['verb'],
168
326
  words: [
169
327
  { word: 'start', comparison: 'prefix' },
@@ -195,19 +353,6 @@ template = {
195
353
  },
196
354
  bridge: "{ ...next(operator), operator: operator, letters: after[1], generate: ['operator', 'letters'] }",
197
355
  },
198
- {
199
- id: 'applyStyle_wp',
200
- parents: ['verb'],
201
- convolution: true,
202
- bridge: "{ ...next(operator), element: after[0], state: before[0], operator: operator, generate: ['state', 'element'] }",
203
- localHierarchy: [
204
- ['thisitthat', 'statefulElement_wp'],
205
- ['everything', 'statefulElement_wp'],
206
- ],
207
- semantic: (args) => {
208
- changeState({...args, element: args.context.element, state: args.context.state})
209
- }
210
- },
211
356
  {
212
357
  id: 'changeState_wp',
213
358
  parents: ['verb'],
@@ -249,7 +394,15 @@ template = {
249
394
  },
250
395
  ],
251
396
  priorities: [
252
- // { "context": [['underline_wp',0], ['statefulElement_wp', 1], ['thatVerb', 0]], ordered: true, choose: [2] },
397
+ { "context": [['ordinal', 1], ['list', 0], ['ordinal', 1], ['statefulElement_wp', 0]], ordered: true, choose: [1] },
398
+ { "context": [['word_wp', 1], ['wordComparisonWithVerb_wp', 0], ['comparisonWith_wp', 1], ['statefulElementInContext_wp', 0]], ordered: true, choose: [1] },
399
+ { "context": [['paragraphComparisonVerb_wp', 0], ['word_wp', 0], ['wordComparisonWithVerb_wp', 0]], ordered: true, choose: [2] },
400
+ { "context": [['statefulElementInContext_wp', 0], ['word_wp', 0], ['wordComparisonWithVerb_wp', 0]], ordered: true, choose: [2] },
401
+ { "context": [['statefulElementInContext_wp', 0], ['word_wp', 1], ['wordComparisonWithVerb_wp', 0], ['comparisonWith_wp', 1]], ordered: true, choose: [2,3] },
402
+ { "context": [['statefulElementInContext_wp', 0], ['comparisonWith_wp', 0]], choose: [1] },
403
+ { "context": [['paragraphComparisonVerb_wp', 0], ['wordComparisonWithVerb_wp', 0]], choose: [1] },
404
+ { "context": [['ordinal',1], ['list', 0], ['ordinal', 1], ['word_wp', 1]], ordered: true, choose: [1] },
405
+ { "context": [['changeState_wp',0], ['every', 0], ['word_wp', 1], ['list', 1]], ordered: true, choose: [1] },
253
406
  { "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
254
407
  { "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
255
408
  ],
@@ -272,7 +425,7 @@ knowledgeModule({
272
425
  contents: wp_tests,
273
426
  checks: {
274
427
  context: [
275
- ...defaultContextCheck(),
428
+ ...defaultContextCheck(['distributer', 'subject', 'element', 'letters', 'target', 'conditions' ]),
276
429
  ],
277
430
  objects: [
278
431
  'changeState',