tpmkms_4wp 8.9.1-beta.1 → 8.9.1-beta.11

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 (76) hide show
  1. package/common/animals.instance.json +195 -16
  2. package/common/articles.js +18 -2
  3. package/common/articles.test.json +338 -0
  4. package/common/asking.js +2 -2
  5. package/common/avatar.js +1 -1
  6. package/common/characters.js +1 -1
  7. package/common/colors.instance.json +210 -45
  8. package/common/comparable.instance.json +45 -0
  9. package/common/comparable.js +1 -1
  10. package/common/concept.js +1 -1
  11. package/common/conjunction.js +1 -1
  12. package/common/countable.js +2 -8
  13. package/common/countable.test.json +0 -586
  14. package/common/crew.instance.json +390 -0
  15. package/common/currency.js +2 -2
  16. package/common/dialogues.js +6 -4
  17. package/common/dimension.instance.json +11 -4
  18. package/common/dimension.js +2 -2
  19. package/common/edible.instance.json +352 -58
  20. package/common/emotions.instance.json +15 -0
  21. package/common/errors.js +3 -1
  22. package/common/events.js +1 -1
  23. package/common/fastfood.instance.json +1753 -1074
  24. package/common/fastfood.js +3 -3
  25. package/common/formulas.instance.json +11 -1
  26. package/common/formulas.js +1 -1
  27. package/common/gdefaults.js +28 -17
  28. package/common/help.js +4 -4
  29. package/common/help.test.json +4 -4
  30. package/common/helpers/concept.js +3 -3
  31. package/common/helpers/conjunction.js +1 -1
  32. package/common/helpers/formulas.js +4 -4
  33. package/common/helpers/frankenhash.js +4 -4
  34. package/common/helpers/meta.js +4 -4
  35. package/common/helpers/ordering.js +2 -2
  36. package/common/helpers/properties.js +16 -16
  37. package/common/helpers.js +17 -1
  38. package/common/hierarchy.js +3 -3
  39. package/common/javascript.js +1 -1
  40. package/common/kirk.instance.json +15 -0
  41. package/common/length.instance.json +165 -20
  42. package/common/math.instance.json +11 -1
  43. package/common/math.js +1 -1
  44. package/common/meta.js +5 -5
  45. package/common/negation.js +1 -1
  46. package/common/numbers.js +1 -1
  47. package/common/ordering.instance.json +31 -71
  48. package/common/ordinals.js +5 -3
  49. package/common/people.instance.json +120 -0
  50. package/common/people.js +1 -1
  51. package/common/percentages.js +1 -1
  52. package/common/pipboy.instance.json +187 -46
  53. package/common/pipboy.js +1 -1
  54. package/common/pokemon.instance.json +195 -5
  55. package/common/pos.js +11 -1
  56. package/common/pressure.instance.json +44 -7
  57. package/common/properties.instance.json +15 -0
  58. package/common/properties.js +2 -2
  59. package/common/punctuation.js +1 -1
  60. package/common/reports.instance.json +24 -4
  61. package/common/reports.js +7 -7
  62. package/common/scorekeeper.js +5 -5
  63. package/common/sdefaults.js +2 -2
  64. package/common/sizeable.js +1 -1
  65. package/common/spock.instance.json +15 -0
  66. package/common/stm.js +6 -6
  67. package/common/tell.js +1 -1
  68. package/common/temperature.instance.json +44 -8
  69. package/common/tester.js +1 -1
  70. package/common/ui.instance.json +16 -1
  71. package/common/weight.instance.json +132 -16
  72. package/common/wp.instance.json +13996 -1532
  73. package/common/wp.js +150 -25
  74. package/common/wp.test.json +82657 -3824
  75. package/common/yesno.js +1 -1
  76. package/package.json +11 -6
package/common/wp.js CHANGED
@@ -9,13 +9,49 @@ const wp_tests = require('./wp.test.json')
9
9
  const instance = require('./wp.instance.json')
10
10
 
11
11
  /*
12
+ working on
13
+ bold the first word
14
+ bold the first paragraph
15
+ bold the first letter
16
+
17
+ current
18
+
19
+ underline the bolded paragraphs
20
+ underline the paragraphs that contain bolded words
21
+
22
+ after
23
+ bold the first word of every paragraph
24
+ bold the first word of the second and third paragraph
25
+ bold the first word of the second paragraph and third paragraph
26
+ bold the first letter of every word
27
+ bold the first letter of every word that starts with t
28
+ bold the first letter of the words that start with t in the third paragraph
29
+ bold the paragraph that contains words that start with t
30
+ underline the paragraph that contains bolded words
31
+ bold the paragraph that contains three bolded words
32
+
33
+ the paragraph that contains the word boobies
34
+
35
+ after
36
+ make the words that start with t blue
37
+
38
+ the bolded words that start with t
39
+
40
+ replace better with worse
41
+
42
+ change underlines to bolds
43
+
12
44
  start inserting text until I say banana
13
45
  ...
14
46
  or
15
47
  stop inserting text
16
48
 
17
49
  make the text of the 1st to 3rd paragraphs blue
50
+
51
+ capitalize the words banana and word
52
+ capitalize banana and tree
18
53
 
54
+ make the words that start with a bold
19
55
 
20
56
  make every word bold and underlines and blue -> weirdly "bold underlined and blue" works
21
57
 
@@ -23,6 +59,8 @@ const instance = require('./wp.instance.json')
23
59
  make the color blue
24
60
  make the color of the first paragraph blue
25
61
 
62
+ undeline the bolded text / the text that is bolded
63
+
26
64
  words that start with a
27
65
  make all the bold text uppercase
28
66
  underline all the bold text
@@ -34,10 +72,17 @@ const instance = require('./wp.instance.json')
34
72
  words containing a
35
73
  every 5th word
36
74
 
75
+ the words that are capitalized
76
+
37
77
  in the first paragraph make the words that start with abc bold
38
78
  bold the first three words that start with t
39
79
  bold much and many
40
80
  make the words that start with t bold and underlined
81
+ make all the capital letters|punctuation bold
82
+
83
+ move this paragraph up 2
84
+ move the next paragraph up 1
85
+ move the last paragraph before this one
41
86
  */
42
87
 
43
88
  class API {
@@ -63,7 +108,7 @@ const setUpdate = (isA, update, states) => {
63
108
  if (!update.styles) {
64
109
  update.styles = []
65
110
  }
66
- let style = root(state.value)
111
+ const style = root(state.value)
67
112
  /*
68
113
  if (style == 'underlined') {
69
114
  style = 'underline'
@@ -80,31 +125,63 @@ const setUpdate = (isA, update, states) => {
80
125
 
81
126
  const api = new API()
82
127
 
83
- let config = {
128
+ const config = {
84
129
  name: 'wp',
85
130
  };
86
131
 
87
132
  const changeState = ({api, isA, context, toArray, element, state}) => {
88
- let unit = root(context.element.marker)
89
133
  let scope
90
- let conditions = []
91
- if (isA(context.element, 'everything')) {
92
- scope = 'all'
93
- } else if (context.element.condition) {
94
- const condition = context.element.condition
95
- if (condition.marker == 'wordComparisonWith_wp') {
96
- // with or not with that is the question
97
- const letters = condition.letters.letters.text
98
- conditions.push({ comparison: condition.comparison, letters })
99
- } else if (condition.marker == 'wordComparison_wp') {
100
- // with or not with that is the question
101
- const letters = condition.letters.text
102
- conditions.push({ comparison: condition.comparison, letters })
134
+
135
+ const getElement = (selector, update) => {
136
+ const unit = root(selector.marker)
137
+ const conditions = []
138
+ let scope;
139
+ const condition = []
140
+ if (selector.ordinal) {
141
+ conditions.push({ ordinals: toArray(selector.ordinal).map((context) => context.value)})
142
+ } else if (isA(selector, 'everything')) {
143
+ scope = 'all'
144
+ } else if (selector.quantity) {
145
+ scope = selector.quantity.quantity
146
+ } if (selector.distributer) {
147
+ scope = selector.distributer.value
148
+ }
149
+
150
+ if (selector.conditions) {
151
+ for (const condition of selector.conditions) {
152
+ if (condition.marker == 'wordComparisonWithVerb_wp') {
153
+ // with or not with that is the question
154
+ const letters = condition.letters.letters.text
155
+ conditions.push({ comparison: condition.comparison, letters })
156
+ } else if (condition.marker == 'wordComparison_wp') {
157
+ // with or not with that is the question
158
+ const letters = condition.letters.text
159
+ conditions.push({ comparison: condition.comparison, letters })
160
+ } else if (condition.marker == 'paragraphComparisonVerb_wp') {
161
+ // with or not with that is the question
162
+ const update = { selectors: [] }
163
+ const words = getElement(condition.words, update)
164
+ conditions.push({ comparison: condition.comparison, words: update})
165
+ } else if (isA(condition, 'styleModifier_wp')) {
166
+ for (const style of toArray(condition)) {
167
+ conditions.push({ hasStyle: style.marker })
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ if (selector.context) {
174
+ for (const context of toArray(selector.context)) {
175
+ getElement(context, update)
176
+ }
103
177
  }
104
- } else {
105
- scope = context.element.quantity.quantity
178
+
179
+ update.selectors.push({ unit, scope, conditions })
106
180
  }
107
- const update = { unit, scope, conditions }
181
+
182
+ const update = { selectors: [] }
183
+ getElement(context.element, update)
184
+
108
185
  setUpdate(isA, update, toArray(context.state))
109
186
  api.changeState(update)
110
187
  }
@@ -112,15 +189,19 @@ const changeState = ({api, isA, context, toArray, element, state}) => {
112
189
  template = {
113
190
  configs: [
114
191
  'setidsuffix _wp',
115
- 'words are countable and statefulElements',
116
- 'characters are countable',
117
- 'paragraphs are countable',
192
+ 'words are countable distributable orderable textContainers and statefulElements',
193
+ 'characters are countable distributable orderable and statefulElements',
194
+ 'paragraphs are countable distributable orderable textContainers and statefulElement',
195
+ 'text is a statefulElement',
196
+ 'letters means characters',
118
197
  'bold, italic, code, capitalize, lowercase and underline are styles',
119
198
  'underlined means underline',
120
199
  'capitalized means capitalize',
121
200
  'uppercase means capitalize',
122
201
  'italicize means italic',
123
202
  'italicized means italic',
203
+ // TODO have a mode where I can stay this is a definition sentence then just say style modifies and it will do it right
204
+ 'uppercased, lowercased, capitalized, bolded, italicized and underlined are styleModifiers',
124
205
  // 'start end and contain are wordComparisonWiths',
125
206
  // 'styles are negatable',
126
207
  "resetIdSuffix",
@@ -128,12 +209,52 @@ template = {
128
209
  operators: [
129
210
  "([changeState_wp|make] ([statefulElement_wp]) ([stateValue_wp|]))",
130
211
  "((style_wp/*) [applyStyle_wp] ([statefulElement_wp|]))",
131
- "((word_wp/*) [wordComparisonWith_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
212
+ "((word_wp/*) [wordComparisonWithVerb_wp] ([comparisonWith_wp|with] (a/0)? (letters)))",
132
213
  "((word_wp/*) [wordComparison_wp] (a/0)? (letters))",
214
+ // this one is "the bolded/underlined/italized/... word"
215
+ "((styleModifier_wp/*) [modifiedByStyle_wp] (statefulElement_wp/* && context.determiner == undefined))",
216
+ // the first letter of each paragraph
217
+ "((statefulElement_wp/*) <statefulElementInContext_wp|of> (statefulElement_wp/*))",
218
+ // the paragraph that contains words that start with t
219
+ "((paragraph_wp/*) [paragraphComparisonVerb_wp] (word_wp/*))",
133
220
  ],
221
+ associations: {
222
+ negative: [
223
+ ],
224
+ positive: [
225
+ // TODO remove these after crucible work done and fix the associator rules
226
+ [['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['word_wp', 0]],
227
+ [['paragraph_wp', 0], ['thatVerb', 0], ['paragraphComparisonVerb_wp', 0], ['styleModifier_wp', 0], ['word_wp', 0]],
228
+ [['word_wp', 0], ['thatVerb', 0], ['wordComparison_wp', 0]],
229
+ ]
230
+ },
231
+
134
232
  bridges: [
135
233
  {
136
- id: 'wordComparisonWith_wp',
234
+ id: 'paragraphComparisonVerb_wp',
235
+ parents: ['verb'],
236
+ words: [
237
+ { word: 'contain', comparison: 'include' },
238
+ { word: 'contains', comparison: 'include' },
239
+ { word: 'include', comparison: 'include' },
240
+ { word: 'includes', comparison: 'include' },
241
+ ],
242
+ bridge: "{ ...next(operator), element: before[0], subject: before[0], words: after[0], verb: operator, generate: ['element', 'verb', 'words'] }",
243
+ },
244
+ {
245
+ id: 'statefulElementInContext_wp',
246
+ parents: ['preposition'],
247
+ bridge: "{ ...before[0], context: append(before[0].context, [after[0]]), generate: [before[0], operator, after[0]] }",
248
+ },
249
+ {
250
+ id: 'modifiedByStyle_wp',
251
+ // parents: ['verb'],
252
+ parents: ['adjective'],
253
+ convolution: true,
254
+ bridge: "{ ...after[0], style: before[0], target: after[0], generate: ['style', 'target'], conditions: append(after[0].conditions, [before[0]]) }",
255
+ },
256
+ {
257
+ id: 'wordComparisonWithVerb_wp',
137
258
  parents: ['verb'],
138
259
  words: [
139
260
  { word: 'start', comparison: 'prefix' },
@@ -219,6 +340,10 @@ template = {
219
340
  },
220
341
  ],
221
342
  priorities: [
343
+ { "context": [['paragraphComparisonVerb_wp', 0], ['word_wp', 0], ['wordComparisonWithVerb_wp', 0]], ordered: true, choose: [2] },
344
+ { "context": [['paragraphComparisonVerb_wp', 0], ['wordComparisonWithVerb_wp', 0]], choose: [1] },
345
+ { "context": [['ordinal',1], ['list', 0], ['ordinal', 1], ['word_wp', 1]], ordered: true, choose: [1] },
346
+ { "context": [['changeState_wp',0], ['every', 0], ['word_wp', 1], ['list', 1]], ordered: true, choose: [1] },
222
347
  { "context": [['changeState_wp',0], ['statefulElement_wp', 0], ['list', 0]], ordered: true, choose: [0] },
223
348
  { "context": [['comparisonWith_wp',0], ['unknown', 0], ['list', 1]], ordered: true, choose: [0] },
224
349
  ],
@@ -241,7 +366,7 @@ knowledgeModule({
241
366
  contents: wp_tests,
242
367
  checks: {
243
368
  context: [
244
- ...defaultContextCheck(),
369
+ ...defaultContextCheck(['distributer', 'subject', 'element', 'letters', 'target', 'conditions' ]),
245
370
  ],
246
371
  objects: [
247
372
  'changeState',