ekms 9.8.0-beta.8 → 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 (78) hide show
  1. package/common/actions.instance.json +6 -6
  2. package/common/actions.js +10 -10
  3. package/common/angle.instance.json +12 -0
  4. package/common/askfor.instance.json +12 -184
  5. package/common/askfor.js +19 -11
  6. package/common/asking.js +13 -5
  7. package/common/can.instance.json +2 -18
  8. package/common/can.js +2 -2
  9. package/common/comparable.instance.json +6 -12
  10. package/common/compass.js +1 -1
  11. package/common/concept.instance.json +8 -4
  12. package/common/concept.js +2 -0
  13. package/common/conjunction.js +9 -7
  14. package/common/control.js +5 -5
  15. package/common/countable.js +1 -0
  16. package/common/dateTimeSelectors.instance.json +1 -1
  17. package/common/dateTimeSelectors.js +1 -1
  18. package/common/dates.instance.json +11 -1
  19. package/common/dates.js +6 -1
  20. package/common/debug.instance.json +9 -1
  21. package/common/debug.js +4 -0
  22. package/common/dialogues.js +37 -35
  23. package/common/dimension.instance.json +198 -477
  24. package/common/dimension.js +48 -24
  25. package/common/drone.instance.json +89 -19
  26. package/common/drone.js +43 -41
  27. package/common/drone_v1.instance.json +13 -3
  28. package/common/drone_v1.js +20 -15
  29. package/common/evaluate.js +3 -3
  30. package/common/fastfood.instance.json +12 -4
  31. package/common/fastfood.js +27 -12
  32. package/common/formulas.instance.json +138 -12
  33. package/common/formulas.js +15 -6
  34. package/common/gdefaults.js +2 -71
  35. package/common/helpers/dialogues.js +1 -10
  36. package/common/helpers/properties.js +10 -7
  37. package/common/helpers.js +5 -2
  38. package/common/hierarchy.js +11 -7
  39. package/common/latin.instance.json +4 -4
  40. package/common/latin.js +2 -2
  41. package/common/length.instance.json +84 -0
  42. package/common/linear_orderings.instance.json +1 -0
  43. package/common/linear_orderings.js +90 -0
  44. package/common/linear_orderings.test.json +1 -0
  45. package/common/math.instance.json +141 -4
  46. package/common/math.js +18 -7
  47. package/common/menus.instance.json +6 -2
  48. package/common/menus.js +5 -2
  49. package/common/meta.js +12 -12
  50. package/common/nameable.js +6 -2
  51. package/common/numbers.instance.json +3 -0
  52. package/common/numbers.js +56 -32
  53. package/common/ordering.instance.json +1 -2
  54. package/common/percentages.js +4 -2
  55. package/common/pipboy.instance.json +38 -27
  56. package/common/pipboy.js +21 -14
  57. package/common/pressure.instance.json +6 -0
  58. package/common/properties.instance.json +2575 -528
  59. package/common/properties.js +211 -41
  60. package/common/punctuation.js +1 -0
  61. package/common/rates.instance.json +1 -1
  62. package/common/rates.js +2 -2
  63. package/common/reminders.instance.json +16 -0
  64. package/common/reminders.js +23 -19
  65. package/common/reports.instance.json +4 -6
  66. package/common/reports.js +12 -12
  67. package/common/sdefaults.js +11 -9
  68. package/common/stm.js +11 -14
  69. package/common/temperature.instance.json +21 -0
  70. package/common/testing.js +2 -2
  71. package/common/time.instance.json +87 -15
  72. package/common/time.js +7 -6
  73. package/common/ui.js +5 -5
  74. package/common/weight.instance.json +27 -0
  75. package/common/words.js +106 -1
  76. package/common/wp.instance.json +10 -3
  77. package/common/wp.js +5 -1
  78. package/package.json +5 -2
@@ -14,6 +14,7 @@
14
14
  "bridges": [
15
15
  {
16
16
  "id": "close_menus",
17
+ "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:130",
17
18
  "isA": [
18
19
  "verb"
19
20
  ],
@@ -25,6 +26,7 @@
25
26
  },
26
27
  {
27
28
  "id": "show_menus",
29
+ "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:141",
28
30
  "isA": [
29
31
  "verb"
30
32
  ],
@@ -43,7 +45,7 @@
43
45
  "semantics": [
44
46
  {
45
47
  "match": "({context, isA}) => isA(context, 'showable_menus')",
46
- "apply": "async ({context, insert, s, fragments}) => {\n const instantiation = await fragments(\"show showable\", { 'showable_menus': context })\n await s(instantiation)\n }"
48
+ "apply": "async ({context, insert, e, fragments}) => {\n const instantiation = await fragments(\"show showable\", { 'showable_menus': context })\n await e(instantiation, where())\n }"
47
49
  }
48
50
  ]
49
51
  },
@@ -1702,6 +1704,7 @@
1702
1704
  "bridges": [
1703
1705
  {
1704
1706
  "id": "close_menus",
1707
+ "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:130",
1705
1708
  "isA": [
1706
1709
  "verb"
1707
1710
  ],
@@ -1712,6 +1715,7 @@
1712
1715
  },
1713
1716
  {
1714
1717
  "id": "show_menus",
1718
+ "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:141",
1715
1719
  "isA": [
1716
1720
  "verb"
1717
1721
  ],
@@ -1728,7 +1732,7 @@
1728
1732
  ],
1729
1733
  "semantics": [
1730
1734
  {
1731
- "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:156"
1735
+ "where": "/home/dev/code/theprogrammablemind/kms/common/menus.js:159"
1732
1736
  }
1733
1737
  ]
1734
1738
  },
package/common/menus.js CHANGED
@@ -127,6 +127,7 @@ const template = {
127
127
  bridges: [
128
128
  {
129
129
  id: 'close_menus',
130
+ where: where(),
130
131
  isA: ['verb'],
131
132
  associations: ['menus'],
132
133
  bridge: "{ ...next(operator), closee: after[0], generate: ['this', 'closee'] }",
@@ -136,6 +137,8 @@ const template = {
136
137
  },
137
138
  {
138
139
  id: 'show_menus',
140
+ where: where(),
141
+ where: where(),
139
142
  isA: ['verb'],
140
143
  bridge: "{ ...next(operator), show: after[0], generate: ['this', 'show'] }",
141
144
  semantic: ({context, api}) => {
@@ -155,9 +158,9 @@ const template = {
155
158
  {
156
159
  where: where(),
157
160
  match: ({context, isA}) => isA(context, 'showable_menus'),
158
- apply: async ({context, insert, s, fragments}) => {
161
+ apply: async ({context, insert, e, fragments}) => {
159
162
  const instantiation = await fragments("show showable", { 'showable_menus': context })
160
- await s(instantiation)
163
+ await e(instantiation, where())
161
164
  }
162
165
  },
163
166
  ]
package/common/meta.js CHANGED
@@ -78,7 +78,7 @@ const config = {
78
78
  id: 'synonymOfWord',
79
79
  operator: "((synonym/*) [synonymOfWord|of] (word))",
80
80
  bridge: "{ ...next(operator), word: after[0] }",
81
- evaluator: ({context}) => {
81
+ semantic: ({context}) => {
82
82
  }
83
83
  },
84
84
  */
@@ -192,10 +192,10 @@ const config = {
192
192
  {
193
193
  where: where(),
194
194
  match: ({context}) => context.marker == 'orList',
195
- apply: async ({context, s}) => {
195
+ apply: async ({context, e}) => {
196
196
  const response = []
197
197
  for (const value of context.value) {
198
- response.push(await s(value))
198
+ response.push(await e(value, where()))
199
199
  }
200
200
  context.evalue = {
201
201
  marker: 'orList',
@@ -219,7 +219,7 @@ const config = {
219
219
  function invertMappings(mappings) {
220
220
  return mappings.map( ({ from, to }) => { return { to: from, from: to } } )
221
221
  }
222
- return async ({context, s, config}) => {
222
+ return async ({context, e, config}) => {
223
223
  DEFINITIONs = _.cloneDeep(DEFINITIONs)
224
224
  //const mappings = mappingss[0]
225
225
  let toPrimes = []
@@ -229,7 +229,7 @@ const config = {
229
229
  }
230
230
  // next move add debug arg to s and g
231
231
  TO.query = true
232
- toPrimes.push([await s(TO), mappings])
232
+ toPrimes.push([await e(TO, where()), mappings])
233
233
  }
234
234
 
235
235
  let hasResponse = false
@@ -323,12 +323,12 @@ const config = {
323
323
  return ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
324
324
  }
325
325
  function apply(mappings, TO) {
326
- return async ({context, s}) => {
326
+ return async ({context, e}) => {
327
327
  TO = _.cloneDeep(TO)
328
328
  for (const { from, to } of mappings) {
329
329
  hashIndexesSet(TO, to, hashIndexesGet(context, from))
330
330
  }
331
- toPrime = await s(TO)
331
+ toPrime = await e(TO, where())
332
332
  context.result = toPrime.result
333
333
  }
334
334
  }
@@ -349,14 +349,15 @@ const config = {
349
349
 
350
350
  // setup the read semantic
351
351
  {
352
+ // TODO change this disable to callOnce
352
353
  function matchByMarker(defContext) {
353
- return ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
354
+ return ({context, uuid}) => context.marker == defContext.from.marker && !context[`disable${uuid}`]
354
355
  }
355
356
  function matchByValue(defContext) {
356
- return ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
357
+ return ({context, uuid, stack}) => context.value == defContext.from.value && !context[`disable${uuid}`]
357
358
  }
358
359
  function apply(mappings, TO) {
359
- return async ({uuid, context, s, g, config}) => {
360
+ return async ({uuid, context, e, g, config}) => {
360
361
  TO = _.cloneDeep(TO)
361
362
  for (const { from, to } of mappings) {
362
363
  hashIndexesSet(TO, to, hashIndexesGet(context, from))
@@ -366,11 +367,10 @@ const config = {
366
367
  if (context.query) {
367
368
  TO.query = context.query
368
369
  } else {
369
- TO.evaluate = context.evaluate
370
370
  TO.metaDefinition = true
371
371
  }
372
372
  TO[`disable${uuid}`] = true
373
- toPrime = await s(TO)
373
+ toPrime = await e(TO, where())
374
374
  if (context.query) {
375
375
  if (toPrime.evalue) {
376
376
  context.evalue = toPrime.evalue
@@ -88,6 +88,7 @@ const config = {
88
88
  },
89
89
  {
90
90
  id: 'getNamesByType',
91
+ where: where(),
91
92
  scope: "testing",
92
93
  isA: ['verb'],
93
94
  bridge: "{ ...next(operator), type: after[0] }",
@@ -113,6 +114,7 @@ const config = {
113
114
  },
114
115
  {
115
116
  id: 'call',
117
+ where: where(),
116
118
  isA: ['verb'],
117
119
  words: englishHelpers.conjugateVerb('call'),
118
120
  bridge: `{
@@ -124,7 +126,7 @@ const config = {
124
126
  `,
125
127
  // generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
126
128
  semantic: async ({config, context, api, e, verbatim, g}) => {
127
- const nameable = (await e(context.nameable))?.evalue
129
+ const nameable = (await e(context.nameable, where()))?.evalue
128
130
  if (!nameable) {
129
131
  verbatim(`${await g(context.nameable)} is not known`)
130
132
  return
@@ -188,7 +190,9 @@ knowledgeModule( {
188
190
  context: [
189
191
  defaultContextCheck({ extra: ['pullFromContext'] }),
190
192
  ],
191
- objects: ['mentioned', { km: 'stm' }],
193
+ objects: [
194
+ { km: 'stm' }
195
+ ],
192
196
  },
193
197
  include: {
194
198
  words: [ "peter james chunkington", "banana" ],
@@ -25,6 +25,9 @@
25
25
  {
26
26
  "isInstance": true,
27
27
  "value": 10.2345,
28
+ "rangeableWith": [
29
+ "number"
30
+ ],
28
31
  "text": "10.2345",
29
32
  "marker": "number",
30
33
  "word": "10.2345",
package/common/numbers.js CHANGED
@@ -4,6 +4,7 @@ const numbers_tests = require('./numbers.test.json')
4
4
  const instance = require('./numbers.instance.json')
5
5
  const gdefaults = require('./gdefaults')
6
6
  const sdefaults = require('./sdefaults')
7
+ const linear_orderings = require('./linear_orderings')
7
8
 
8
9
  /*
9
10
  TODO
@@ -20,61 +21,57 @@ const config = {
20
21
  "([integer])",
21
22
  ],
22
23
  bridges: [
23
- /*
24
- {
25
- id: "testNumber",
26
- scope: 'testing',
27
- },
28
- */
29
24
  {
30
25
  id: "number",
31
- bridge: "{ isInstance: false, ...next(operator) }"
26
+ bridge: "{ isInstance: false, ...next(operator) }",
27
+ isA: ['linearlyOrdered'],
32
28
  },
33
29
  {
34
30
  id: "integer",
35
31
  isA: ['number'],
32
+ initial: { rangeableWith: ['number'] },
36
33
  bridge: "{ isInstance: false, ...next(operator) }"
37
34
  },
38
35
  ],
39
36
  words: {
40
37
  "literals": {
41
- "one": [{"id": "integer", "initial": "{ value: 1, isInstance: true }" }],
42
- "ones": [{"id": "integer", "initial": "{ value: 1, integer: 'many', isInstance: true }" }],
43
- "two": [{"id": "integer", "initial": "{ value: 2 , isInstance: true}" }],
44
- "twos": [{"id": "integer", "initial": "{ value: 2 , integer: 'many', isInstance: true}" }],
45
- "three": [{"id": "integer", "initial": "{ value: 3, isInstance: true }" }],
46
- "threes": [{"id": "integer", "initial": "{ value: 3, integer: 'many', isInstance: true }" }],
47
- "four": [{"id": "integer", "initial": "{ value: 4, isInstance: true }" }],
48
- "fours": [{"id": "integer", "initial": "{ value: 4, integer: 'many', isInstance: true }" }],
49
- "five": [{"id": "integer", "initial": "{ value: 5, isInstance: true }" }],
50
- "fives": [{"id": "integer", "initial": "{ value: 5, integer: 'many', isInstance: true }" }],
51
- "six": [{"id": "integer", "initial": "{ value: 6, isInstance: true }" }],
52
- "sixes": [{"id": "integer", "initial": "{ value: 6, integer: 'many', isInstance: true }" }],
53
- "seven": [{"id": "integer", "initial": "{ value: 7, isInstance: true }" }],
54
- "sevens": [{"id": "integer", "initial": "{ value: 7, integer: 'many', isInstance: true }" }],
55
- "eight": [{"id": "integer", "initial": "{ value: 8, isInstance: true }" }],
56
- "eights": [{"id": "integer", "initial": "{ value: 8, integer: 'many', isInstance: true }" }],
57
- "nine": [{"id": "integer", "initial": "{ value: 9, isInstance: true }" }],
58
- "nines": [{"id": "integer", "initial": "{ value: 9, integer: 'many', isInstance: true }" }],
59
- "ten": [{"id": "integer", "initial": "{ value: 10, isInstance: true }" }],
60
- "tens": [{"id": "integer", "initial": "{ value: 10, integer: 'many', isInstance: true }" }],
61
- "pi": [{"id": "integer", "initial": { value: 3.1415926, integer: 'many', isInstance: true } }],
38
+ "one": [{"id": "integer", "initial": "{ value: 1, isInstance: true, rangeableWith: ['number'] }" }],
39
+ "ones": [{"id": "integer", "initial": "{ value: 1, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
40
+ "two": [{"id": "integer", "initial": "{ value: 2 , isInstance: true, rangeableWith: ['number'] }" }],
41
+ "twos": [{"id": "integer", "initial": "{ value: 2 , integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
42
+ "three": [{"id": "integer", "initial": "{ value: 3, isInstance: true, rangeableWith: ['number'] }" }],
43
+ "threes": [{"id": "integer", "initial": "{ value: 3, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
44
+ "four": [{"id": "integer", "initial": "{ value: 4, isInstance: true, rangeableWith: ['number'] }" }],
45
+ "fours": [{"id": "integer", "initial": "{ value: 4, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
46
+ "five": [{"id": "integer", "initial": "{ value: 5, isInstance: true, rangeableWith: ['number'] }" }],
47
+ "fives": [{"id": "integer", "initial": "{ value: 5, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
48
+ "six": [{"id": "integer", "initial": "{ value: 6, isInstance: true, rangeableWith: ['number'] }" }],
49
+ "sixes": [{"id": "integer", "initial": "{ value: 6, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
50
+ "seven": [{"id": "integer", "initial": "{ value: 7, isInstance: true, rangeableWith: ['number'] }" }],
51
+ "sevens": [{"id": "integer", "initial": "{ value: 7, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
52
+ "eight": [{"id": "integer", "initial": "{ value: 8, isInstance: true, rangeableWith: ['number'] }" }],
53
+ "eights": [{"id": "integer", "initial": "{ value: 8, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
54
+ "nine": [{"id": "integer", "initial": "{ value: 9, isInstance: true, rangeableWith: ['number'] }" }],
55
+ "nines": [{"id": "integer", "initial": "{ value: 9, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
56
+ "ten": [{"id": "integer", "initial": "{ value: 10, isInstance: true, rangeableWith: ['number'] }" }],
57
+ "tens": [{"id": "integer", "initial": "{ value: 10, integer: 'many', isInstance: true, rangeableWith: ['number'] }" }],
58
+ "pi": [{"id": "integer", "initial": { value: 3.1415926, integer: 'many', isInstance: true, rangeableWith: ['number'] } }],
62
59
  },
63
60
  patterns: [
64
61
  {
65
62
  pattern: [{ type: 'digit' }, { repeat: true }],
66
63
  allow_partial_matches: false,
67
- defs: [{id: "integer", uuid: '1', initial: "{ value: int(text), isInstance: true }" }]
64
+ defs: [{id: "integer", uuid: '1', initial: "{ value: int(text), isInstance: true, rangeableWith: ['number'] }" }]
68
65
  },
69
66
  {
70
67
  pattern: [{ type: 'digit' }, { repeat: true }, '.', { type: 'digit' }, { repeat: true }],
71
68
  allow_partial_matches: false,
72
- defs: [{id: "number", uuid: '1', initial: "{ value: float(text), isInstance: true }" }]
69
+ defs: [{id: "number", uuid: '1', initial: "{ value: float(text), isInstance: true, rangeableWith: ['number'] }" }]
73
70
  },
74
71
  {
75
72
  pattern: ['.', { type: 'digit' }, { repeat: true }],
76
73
  allow_partial_matches: false,
77
- defs: [{id: "number", uuid: '1', initial: "{ value: float(text), isInstance: true }" }]
74
+ defs: [{id: "number", uuid: '1', initial: "{ value: float(text), isInstance: true, rangeableWith: ['number'] }" }]
78
75
  },
79
76
  ],
80
77
  },
@@ -114,6 +111,33 @@ const config = {
114
111
  ],
115
112
 
116
113
  semantics: [
114
+ {
115
+ where: where(),
116
+ match: ({context, callId, isA, toFinalValue}) => {
117
+ const left = toFinalValue(context.left)
118
+ const right = toFinalValue(context.right)
119
+ return context.marker == 'linearlyOrderedCompare' && isA(context.left, ['number', 'mathematicalExpression']) && isA(context.right, ['number', 'mathematicalExpression'])
120
+ },
121
+ apply: ({context, callId, toFinalValue, resolveEvaluate}) => {
122
+ const { left, right } = context
123
+ const l = toFinalValue(left)
124
+ const r = toFinalValue(right)
125
+ if (l == r) {
126
+ resolveEvaluate(context, '==')
127
+ } else if (l < r) {
128
+ resolveEvaluate(context, '<')
129
+ } else if (r > l) {
130
+ resolveEvaluate(context, '>')
131
+ }
132
+ }
133
+ },
134
+ {
135
+ where: where(),
136
+ match: ({context, debug, isA}) => context.marker == 'unify' && context.terms.every((term) => term.isInstance && isA(term, 'number')),
137
+ apply: ({context, resolveEvaluate}) => {
138
+ resolveEvaluate(context, context.terms[0].value == context.terms[1].value)
139
+ }
140
+ },
117
141
  ],
118
142
  };
119
143
 
@@ -125,7 +149,7 @@ const template = {
125
149
 
126
150
  knowledgeModule( {
127
151
  config,
128
- includes: [gdefaults, sdefaults],
152
+ includes: [linear_orderings, gdefaults, sdefaults],
129
153
 
130
154
  instance,
131
155
  template,
@@ -203,8 +203,7 @@
203
203
  "types": [
204
204
  "unknown"
205
205
  ],
206
- "level": 0,
207
- "evaluate": false
206
+ "level": 0
208
207
  },
209
208
  "two": {
210
209
  "marker": "xfx",
@@ -12,6 +12,7 @@ const config = {
12
12
  bridges: [
13
13
  {
14
14
  id: "percent",
15
+ where: where(),
15
16
  words: ['percent', '%'],
16
17
  separators: '?',
17
18
  bridge: "{ ...next(operator), modifiers: ['scale'], scale: before[0] }",
@@ -19,11 +20,12 @@ const config = {
19
20
  },
20
21
  {
21
22
  id: "percentageOf",
23
+ where: where(),
22
24
  words: ['percent', '%'],
23
25
  bridge: "{ ...next(operator), percentage: before[0], isResponse: true, semanticIsEvaluate: true, value: after[0] }",
24
- evaluator: async ({context, e}) => {
26
+ semantic: async ({context, e}) => {
25
27
  const scale = context.percentage.scale
26
- const number = await e(context.value)
28
+ const number = await e(context.value, where())
27
29
  const percentage = number.value * scale.value / 100
28
30
  const result = { ...number, value: percentage, evalue: percentage, word: null, text: null }
29
31
  context.evalue = result