tpmkms_4wp 8.9.0 → 8.9.1-beta.1

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 (44) hide show
  1. package/common/animals.instance.json +65 -36
  2. package/common/articles.js +4 -0
  3. package/common/colors.instance.json +77 -106
  4. package/common/comparable.instance.json +15 -0
  5. package/common/conjunction.js +27 -18
  6. package/common/countable.js +8 -2
  7. package/common/countable.test.json +586 -0
  8. package/common/crew.instance.json +142 -504
  9. package/common/dialogues.js +16 -11
  10. package/common/dimension.instance.json +10 -36
  11. package/common/edible.instance.json +324 -224
  12. package/common/emotions.instance.json +8 -60
  13. package/common/fastfood.instance.json +1464 -216
  14. package/common/formulas.instance.json +10 -0
  15. package/common/helpers/conjunction.js +75 -0
  16. package/common/helpers/dialogues.js +14 -8
  17. package/common/helpers/properties.js +2 -2
  18. package/common/helpers.js +29 -0
  19. package/common/hierarchy.js +5 -5
  20. package/common/hierarchy.test.json +1491 -0
  21. package/common/kirk.instance.json +5 -0
  22. package/common/length.instance.json +150 -0
  23. package/common/math.instance.json +10 -0
  24. package/common/meta.js +5 -3
  25. package/common/ordering.instance.json +78 -0
  26. package/common/people.instance.json +169 -4
  27. package/common/pipboy.instance.json +203 -177
  28. package/common/pipboy.js +0 -1
  29. package/common/pipboy.test.json +494 -251
  30. package/common/pokemon.instance.json +71 -6
  31. package/common/pos.js +12 -6
  32. package/common/pressure.instance.json +40 -0
  33. package/common/properties.instance.json +5 -44
  34. package/common/reports.instance.json +21 -1
  35. package/common/spock.instance.json +5 -0
  36. package/common/temperature.instance.json +40 -0
  37. package/common/ui.instance.json +135 -0
  38. package/common/ui.js +11 -5
  39. package/common/weight.instance.json +120 -0
  40. package/common/wp.instance.json +30067 -0
  41. package/common/wp.js +256 -0
  42. package/common/wp.test.json +41469 -0
  43. package/main.js +2 -0
  44. package/package.json +7 -2
@@ -268,6 +268,11 @@
268
268
  "verb",
269
269
  false
270
270
  ],
271
+ [
272
+ "every",
273
+ "quantifier",
274
+ false
275
+ ],
271
276
  [
272
277
  "hasCountOfPieces",
273
278
  "countable",
@@ -468,6 +473,11 @@
468
473
  "verb",
469
474
  false
470
475
  ],
476
+ [
477
+ "negatable",
478
+ "queryable",
479
+ false
480
+ ],
471
481
  [
472
482
  "noun",
473
483
  "theAble",
@@ -0,0 +1,75 @@
1
+ const { propertyToArray } = require('../helpers.js')
2
+
3
+ const asList = (context) => {
4
+ if (context.marker === 'list') {
5
+ return context
6
+ }
7
+ return {
8
+ marker: 'list',
9
+ types: [context.marker],
10
+ value: [context]
11
+ }
12
+ }
13
+
14
+ const listable = (hierarchy) => (c, type) => {
15
+ if (!c) {
16
+ return false
17
+ }
18
+ if (hierarchy.isA(c.marker, type)) {
19
+ return true
20
+ }
21
+ if (c.marker === 'list') {
22
+ for (const t of c.types) {
23
+ if (hierarchy.isA(t, type)) {
24
+ return true
25
+ }
26
+ }
27
+ }
28
+ return false
29
+ }
30
+
31
+ const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
32
+ if (!child || !parent) {
33
+ return false
34
+ }
35
+
36
+ if (strict) {
37
+ if (child.marker) {
38
+ child = child.marker
39
+ }
40
+ if (parent.marker) {
41
+ parent = parent.marker
42
+ }
43
+ return hierarchy.isA(child, parent)
44
+ } else {
45
+ const children = propertyToArray(child)
46
+ for (let child of children) {
47
+ let okay = false
48
+ if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
49
+ okay = true
50
+ } else {
51
+ for (const childT of child.types || [child]) {
52
+ if (okay) {
53
+ break
54
+ }
55
+ for (const parentT of parent.types || [parent]) {
56
+ if (hierarchy.isA(childT, parentT)) {
57
+ okay = true
58
+ break
59
+ }
60
+ }
61
+ }
62
+ }
63
+ if (!okay) {
64
+ return false
65
+ }
66
+ }
67
+ return true
68
+ }
69
+ }
70
+
71
+ module.exports = {
72
+ asList,
73
+ isA,
74
+ listable,
75
+ }
@@ -15,9 +15,15 @@ class API {
15
15
  if (typeof context == 'string') {
16
16
  return pluralize.singular(context) + this._objects.idSuffix
17
17
  } else {
18
- const { unknown, value, word } = context;
18
+ const { unknown, value, word, raw_text } = context;
19
19
  // return unknown ? pluralize.singular(word) + this._objects.idSuffix : pluralize.singular(value || word)
20
- return unknown ? pluralize.singular(word) + this._objects.idSuffix : value || pluralize.singular(word)
20
+ return unknown ? pluralize.singular(raw_text || word) + this._objects.idSuffix : value || pluralize.singular(word)
21
+ /*
22
+ if (raw_text && raw_text !== word) {
23
+ debugger
24
+ }
25
+ */
26
+ //return unknown ? pluralize.singular(word) + this._objects.idSuffix : value || pluralize.singular(word)
21
27
  }
22
28
  }
23
29
 
@@ -71,7 +77,7 @@ class API {
71
77
  }
72
78
 
73
79
  // word is for one or many
74
- makeObject({config, context, types=[], doPluralize=true} = {}) {
80
+ makeObject({config, context, types=[], source_value=undefined, doPluralize=true} = {}) {
75
81
  /*
76
82
  if (!context.unknown) {
77
83
  return context.value
@@ -83,9 +89,9 @@ class API {
83
89
  }
84
90
  // const concept = pluralize.singular(value)
85
91
  const concept = this.toScopedId(context)
86
- if (config.exists(concept)) {
87
- return concept
88
- }
92
+ if (config.exists(concept)) {
93
+ return concept
94
+ }
89
95
 
90
96
  // TODO handle the general case
91
97
  const fixUps = (concept) => {
@@ -96,9 +102,9 @@ class API {
96
102
  }
97
103
  // config.addOperator({ pattern: `(["${fixUps(concept)}"])`, allowDups: true })
98
104
  config.addOperator({ pattern: `(["${concept}"])`, allowDups: true })
99
- config.addBridge({ id: concept, level: 0, bridge: `{ ...next(operator), value: '${concept}' }` , allowDups: true })
105
+ config.addBridge({ id: concept, level: 0, bridge: `{ ...next(operator), value: '${source_value || concept}' }` , allowDups: true })
100
106
  const addConcept = (word, number) => {
101
- config.addWord(word, { id: concept, initial: `{ value: "${concept}", number: "${number}" }` } )
107
+ config.addWord(word, { id: concept, initial: `{ value: "${source_value || concept}", number: "${number}" }` } )
102
108
  const baseTypes = [
103
109
  'theAble',
104
110
  'queryable',
@@ -230,8 +230,8 @@ class API {
230
230
  // config.addBridge({ id: "owner", level: 0, bridge: "{ ...next(operator) }"})
231
231
 
232
232
  {
233
- const whoIsWhatVerbedBy = `${before[0].tag}Var is ${after[0].tag}Var ${edAble.word} by`
234
- const thisIsVerbedByThat = `${after[0].tag}Var is ${edAble.word} by ${before[0].tag}Var`
233
+ const whoIsWhatVerbedBy = `${before[0].tag}var is ${after[0].tag}var ${edAble.word} by`
234
+ const thisIsVerbedByThat = `${after[0].tag}var is ${edAble.word} by ${before[0].tag}var`
235
235
 
236
236
  // greg32 check this out
237
237
  // config.addFragments([whoIsWhatVerbedBy])
package/common/helpers.js CHANGED
@@ -163,6 +163,34 @@ const defaultContextCheck = (properties = []) => {
163
163
  ]
164
164
  }
165
165
 
166
+ const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
167
+ if (!child || !parent) {
168
+ return false
169
+ }
170
+
171
+ if (strict) {
172
+ if (child.marker) {
173
+ child = child.marker
174
+ }
175
+ if (parent.marker) {
176
+ parent = parent.marker
177
+ }
178
+ return hierarchy.isA(child, parent)
179
+ } else {
180
+ if (hierarchy.isA(child.marker || child, parent.marker || parent)) {
181
+ return true
182
+ }
183
+ for (const childT of child.types || [child]) {
184
+ for (const parentT of parent.types || [parent]) {
185
+ if (hierarchy.isA(childT, parentT)) {
186
+ return true
187
+ }
188
+ }
189
+ }
190
+ return false
191
+ }
192
+ }
193
+
166
194
  module.exports = {
167
195
  defaultContextCheck,
168
196
  defaultContextCheckProperties,
@@ -178,4 +206,5 @@ module.exports = {
178
206
  propertyToArray,
179
207
  wordNumber,
180
208
  requiredArgument,
209
+ isA,
181
210
  }
@@ -252,9 +252,9 @@ let config = {
252
252
  const twoConcepts = asList(context.same);
253
253
  for (let oneConcept of oneConcepts.value) {
254
254
  for (let twoConcept of twoConcepts.value) {
255
- oneConcept = api.makeObject({config, context: oneConcept})
256
- twoConcept = api.makeObject({config, context: twoConcept})
257
- api.rememberIsA(oneConcept, twoConcept)
255
+ oneConceptId = api.makeObject({config, context: oneConcept})
256
+ twoConceptId = api.makeObject({config, context: twoConcept})
257
+ api.rememberIsA(oneConceptId, twoConceptId)
258
258
  context.sameWasProcessed = true
259
259
  }
260
260
  }
@@ -305,8 +305,8 @@ knowledgeModule( {
305
305
  checks: {
306
306
  objects: ['children', 'concept', 'parents', 'properties'],
307
307
  checks: {
308
- context: defaultContextCheck(),
309
- },
308
+ context: defaultContextCheck(),
309
+ },
310
310
 
311
311
  },
312
312
  includes: {