tpmkms_4wp 9.8.0 → 9.9.0-beta.0

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 (99) hide show
  1. package/common/actions.instance.json +12 -10
  2. package/common/actions.js +14 -12
  3. package/common/angle.instance.json +37 -17
  4. package/common/animals.instance.json +54 -28
  5. package/common/askfor.instance.json +89 -192
  6. package/common/askfor.js +49 -12
  7. package/common/asking.js +13 -5
  8. package/common/avatar.js +3 -3
  9. package/common/can.instance.json +32 -20
  10. package/common/can.js +2 -2
  11. package/common/colors.instance.json +44 -16
  12. package/common/colors.js +1 -1
  13. package/common/comparable.instance.json +25 -22
  14. package/common/compass.instance.json +9 -3
  15. package/common/compass.js +1 -1
  16. package/common/concept.instance.json +14 -6
  17. package/common/concept.js +2 -0
  18. package/common/conjunction.js +20 -12
  19. package/common/control.js +10 -18
  20. package/common/countable.js +4 -3
  21. package/common/crew.instance.json +95 -27
  22. package/common/dateTimeSelectors.instance.json +4 -4
  23. package/common/dateTimeSelectors.js +4 -7
  24. package/common/dates.instance.json +52 -28
  25. package/common/dates.js +16 -11
  26. package/common/debug.instance.json +52 -0
  27. package/common/debug.js +52 -0
  28. package/common/debug.test.json +1 -0
  29. package/common/dialogues.js +126 -70
  30. package/common/dimension.instance.json +259 -492
  31. package/common/dimension.js +72 -12
  32. package/common/drone.instance.json +441 -84
  33. package/common/drone.js +57 -56
  34. package/common/drone_v1.instance.json +36 -12
  35. package/common/drone_v1.js +20 -15
  36. package/common/edible.instance.json +96 -32
  37. package/common/emotions.instance.json +15 -1
  38. package/common/evaluate.js +10 -13
  39. package/common/fastfood.instance.json +282 -100
  40. package/common/fastfood.js +30 -15
  41. package/common/formulas.instance.json +162 -24
  42. package/common/formulas.js +18 -9
  43. package/common/gdefaults.js +20 -96
  44. package/common/helpers/concept.js +2 -9
  45. package/common/helpers/conjunction.js +11 -1
  46. package/common/helpers/dialogues.js +48 -24
  47. package/common/helpers/gdefaults.js +15 -5
  48. package/common/helpers/properties.js +132 -326
  49. package/common/helpers.js +28 -58
  50. package/common/hierarchy.js +71 -41
  51. package/common/kirk.instance.json +3 -1
  52. package/common/latin.instance.json +14 -14
  53. package/common/latin.js +7 -7
  54. package/common/length.instance.json +331 -61
  55. package/common/linear_orderings.instance.json +1 -0
  56. package/common/linear_orderings.js +90 -0
  57. package/common/linear_orderings.test.json +1 -0
  58. package/common/math.instance.json +144 -5
  59. package/common/math.js +18 -7
  60. package/common/menus.instance.json +29 -11
  61. package/common/menus.js +8 -5
  62. package/common/meta.js +14 -13
  63. package/common/nameable.js +9 -5
  64. package/common/numbers.instance.json +8 -3
  65. package/common/numbers.js +59 -35
  66. package/common/ordering.instance.json +53 -4
  67. package/common/ordinals.js +25 -25
  68. package/common/people.instance.json +66 -12
  69. package/common/percentages.js +4 -2
  70. package/common/pipboy.instance.json +89 -44
  71. package/common/pipboy.js +21 -14
  72. package/common/pokemon.instance.json +39 -13
  73. package/common/pressure.instance.json +20 -6
  74. package/common/properties.instance.json +2648 -501
  75. package/common/properties.js +561 -82
  76. package/common/punctuation.js +1 -0
  77. package/common/rates.instance.json +2 -2
  78. package/common/rates.js +3 -3
  79. package/common/reminders.instance.json +16 -0
  80. package/common/reminders.js +24 -20
  81. package/common/reports.instance.json +11 -12
  82. package/common/reports.js +12 -12
  83. package/common/scorekeeper.js +20 -10
  84. package/common/sdefaults.js +30 -9
  85. package/common/spock.instance.json +3 -1
  86. package/common/stm.js +16 -21
  87. package/common/temperature.instance.json +40 -11
  88. package/common/testing.js +2 -2
  89. package/common/time.instance.json +149 -47
  90. package/common/time.js +9 -8
  91. package/common/ui.instance.json +4 -2
  92. package/common/ui.js +5 -5
  93. package/common/weight.instance.json +113 -21
  94. package/common/weight.js +5 -1
  95. package/common/words.js +113 -2
  96. package/common/wp.instance.json +125 -18
  97. package/common/wp.js +6 -2
  98. package/main.js +2 -0
  99. package/package.json +10 -3
@@ -11,6 +11,7 @@
11
11
  {
12
12
  "id": "modifies",
13
13
  "enhanced_associations": false,
14
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:28",
14
15
  "isA": [
15
16
  "verb"
16
17
  ],
@@ -100,6 +101,7 @@
100
101
  "bridges": [
101
102
  {
102
103
  "id": "isOpenCompound",
104
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:154",
103
105
  "isA": [
104
106
  "verb"
105
107
  ],
@@ -142,6 +144,7 @@
142
144
  {
143
145
  "id": "modifies",
144
146
  "enhanced_associations": false,
147
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:28",
145
148
  "isA": [
146
149
  "verb"
147
150
  ],
@@ -160,7 +163,7 @@
160
163
  "bridge": "{ ...next(operator), conceptModifiers: before[0], concept: after[0] }",
161
164
  "semantic": {
162
165
  "notes": "define a modifier",
163
- "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:34"
166
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:35"
164
167
  },
165
168
  "check": [
166
169
  "marker",
@@ -217,10 +220,10 @@
217
220
  "generators": [
218
221
  {
219
222
  "notes": "\"fire type, water type and earth type\" to \"fire water and earth type\"",
220
- "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:84"
223
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:85"
221
224
  },
222
225
  {
223
- "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:123"
226
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:124"
224
227
  }
225
228
  ]
226
229
  },
@@ -324,7 +327,6 @@
324
327
  "level": 1,
325
328
  "context_index": 1,
326
329
  "topLevel": true,
327
- "context_id": 2,
328
330
  "touchedBy": [
329
331
  "concept#call2"
330
332
  ]
@@ -470,6 +472,9 @@
470
472
  }
471
473
  ],
472
474
  "learned_contextual_priorities": [],
475
+ "explain_associations_details": [
476
+ null
477
+ ],
473
478
  "query": "open modifies compound",
474
479
  "key": {
475
480
  "query": "open modifies compound"
@@ -554,7 +559,6 @@
554
559
  "level": 1,
555
560
  "context_index": 1,
556
561
  "topLevel": true,
557
- "context_id": 2,
558
562
  "touchedBy": [
559
563
  "concept#call2"
560
564
  ]
@@ -665,6 +669,9 @@
665
669
  }
666
670
  ],
667
671
  "learned_contextual_priorities": [],
672
+ "explain_associations_details": [
673
+ null
674
+ ],
668
675
  "query": "compound modifies noun",
669
676
  "key": {
670
677
  "query": "compound modifies noun"
@@ -678,6 +685,7 @@
678
685
  "bridges": [
679
686
  {
680
687
  "id": "isOpenCompound",
688
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:154",
681
689
  "isA": [
682
690
  "verb"
683
691
  ],
@@ -686,7 +694,7 @@
686
694
  "is"
687
695
  ],
688
696
  "semantic": {
689
- "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:163"
697
+ "where": "/home/dev/code/theprogrammablemind/kms/common/concept.js:165"
690
698
  },
691
699
  "enhanced_associations": true,
692
700
  "check": [
package/common/concept.js CHANGED
@@ -25,6 +25,7 @@ const config = {
25
25
  {
26
26
  id: "modifies",
27
27
  enhanced_associations: false,
28
+ where: where(),
28
29
  isA: ['verb'],
29
30
  words: [{ word: 'modifies', number: 'one', flatten: false }, { word: 'modify', number: 'many', flatten: true }],
30
31
  // bridge: "{ ...next(operator), modifiers: before, concept: after[0], flatten: true }"
@@ -150,6 +151,7 @@ const template = {
150
151
  bridges: [
151
152
  {
152
153
  id: 'isOpenCompound',
154
+ where: where(),
153
155
  isA: ['verb'],
154
156
  bridge: `{
155
157
  ...operator,
@@ -10,34 +10,42 @@ const config = {
10
10
  "(x [list|and] y)",
11
11
  ],
12
12
  bridges: [
13
- // context.instance == variables.instance (unification)
14
13
  {
15
14
  id: "list",
16
15
  level: 0,
17
16
  enhanced_associations: false,
18
17
  selector: {
19
- match: "same",
20
- left: [ { pattern: '($type && context.instance == variables.instance && context.dead == variables.dead && !@<=$contexts[1].notConjunctableWith)' } ],
21
- right: [ { pattern: '($type && context.instance == variables.instance && context.dead == variables.dead && !@<=$contexts[-1].notConjunctableWith)' } ],
18
+ match: "applicable",
19
+ left: [ { pattern: '($type && context.isInstance == variables.isInstance && context.dead == variables.dead && !@<=$contexts[1].notConjunctableWith)' } ],
20
+ right: [ { pattern: '($type && context.isInstance == variables.isInstance && context.dead == variables.dead && !@<=$contexts[-1].notConjunctableWith)' } ],
22
21
  passthrough: true
23
22
  },
24
- bridge: "{ ...next(operator), flattenInPlaceRemove: ['types', 'listable', 'isList', 'value'], flattenInPlace: [['value']], listable: true, isList: true, value: append(before, after) }"
23
+ bridge: `{
24
+ ...next(operator),
25
+ flattenInPlaceRemove: ['types', 'listable', 'isList', 'value'],
26
+ flattenInPlace: [['value']],
27
+ listable: true,
28
+ isList: true,
29
+ value: append(before, after)
30
+ }`
25
31
  },
26
32
  {
27
33
  id: "list",
28
34
  level: 1,
29
35
  enhanced_associations: false,
30
36
  selector: {
31
- match: "same",
32
- left: [ { pattern: '($type && context.instance == variables.instance && context.dead == variables.dead && contexts[0] !@<= contexts[-1].notConjunctableWith)' } ],
37
+ match: "applicable",
38
+ left: [ { pattern: '($type && context.isInstance == variables.isInstance && context.dead == variables.dead && contexts[0] !@<= contexts[-1].notConjunctableWith)' } ],
33
39
  passthrough: true
34
- },
40
+ },
35
41
  bridge: "{ ...operator, value: append(before, operator.value) }",
42
+ where: where(),
36
43
  semantic: {
37
44
  match: ({context, namespaced}) => !namespaced.get('conjunction', context, 'atomic'),
38
- apply: async ({context, flatten, s}) => {
45
+ apply: async ({context, flatten, e}) => {
39
46
  for (const value of flatten(context)) {
40
- await s(value)
47
+ value.topLevel = context.topLevel;
48
+ await e(value, where())
41
49
  }
42
50
  }
43
51
  }
@@ -47,11 +55,11 @@ const config = {
47
55
  {
48
56
  where: where(),
49
57
  notes: 'evaluate elements of the list individually',
50
- match: ({context, callId}) => context.marker == 'list' && context.evaluate,
58
+ match: ({context, callId}) => context.marker == 'list' && !context.topLevel,
51
59
  apply: async ({context, toArray, toList, e, resolveEvaluate}) => {
52
60
  const list = []
53
61
  for (const element of toArray(context)) {
54
- list.push(await e(element))
62
+ list.push(await e(element, where()))
55
63
  }
56
64
  resolveEvaluate(context, toList(list))
57
65
  }
package/common/control.js CHANGED
@@ -1,34 +1,26 @@
1
- const { knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where, debug } = require('./runtime').theprogrammablemind
2
2
  const tests = require('./control.test.json')
3
3
 
4
4
  function initializer({config}) {
5
5
  config.addArgs((args) => ({
6
- callOnce: (args, condition) => {
7
- if (condition(args)) {
6
+ callOnce: async (args, tag, condition) => {
7
+ if (args.context.control?.seen[tag]) {
8
+ return false
9
+ }
10
+ if (await condition(args)) {
8
11
  const { context } = args
9
12
 
10
13
  if (!context.control) {
11
14
  context.control = {
12
- seen: [],
13
- nextId: 2,
15
+ seen: {},
14
16
  }
15
- context.control_id = 1
16
- }
17
-
18
- if (!context.control_id) {
19
- context.control_id = context.control.nextId
20
- context.control.nextId += 1
21
17
  }
18
+ context.control.seen[tag] = true
22
19
 
23
- if (context.control.seen.includes(context.control_id)) {
24
- return false
25
- }
26
-
27
- context.control.seen.push(context.control_id)
28
20
  args._finally( () => {
29
- const index = context.control.seen.find((value) => context.control_id)
30
- context.control.seen.splice(index, 1)
21
+ delete context.control.seen[tag]
31
22
  })
23
+
32
24
  return true
33
25
  }
34
26
  return false
@@ -34,7 +34,7 @@ const config = {
34
34
  modifiers: append(['quantity'], after[0].modifiers),
35
35
  quantity: before[0],
36
36
  number: default(before[0].number, before[0].value),
37
- instance: true
37
+ isInstance: true
38
38
  }`
39
39
  },
40
40
  {
@@ -47,7 +47,7 @@ const config = {
47
47
  modifiers: append(['count'], after[0].modifiers),
48
48
  count: before[0],
49
49
  word: after.word,
50
- instance: true }`
50
+ isInstance: true }`
51
51
  },
52
52
  {
53
53
  id: "countingPieces",
@@ -58,7 +58,7 @@ const config = {
58
58
  interpolate: [ { property: 'pieces' }, { property: 'countingPiecesOperator' }],
59
59
  modifiers: append(['pieces'], after[0].modifiers),
60
60
  pieces: before[0],
61
- instance: true
61
+ isInstance: true
62
62
  }`
63
63
  },
64
64
  {
@@ -98,6 +98,7 @@ const config = {
98
98
  },
99
99
  {
100
100
  id: "all",
101
+ where: where(),
101
102
  generatorp: ({context}) => 'all',
102
103
  bridge: "{ ...next(operator), number: 'many', quantity: 'all' }"
103
104
  },