ekms 9.6.0-beta.16 → 9.6.0-beta.17

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.
@@ -1,7 +1,7 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
- const gdefaults = require('./gdefaults.js')
2
+ const stm = require('./stm.js')
3
3
  const conjunction_tests = require('./conjunction.test.json')
4
- const { defaultObjectCheck, defaultContextCheck, propertyToArray } = require('./helpers')
4
+ const { toFinalValue, defaultObjectCheck, defaultContextCheck, propertyToArray } = require('./helpers')
5
5
  const { isA, asList, listable } = require('./helpers/conjunction.js')
6
6
 
7
7
  const config = {
@@ -40,6 +40,20 @@ const config = {
40
40
  bridge: "{ ...operator, value: append(before, operator.value) }"
41
41
  },
42
42
  ],
43
+ semantics: [
44
+ {
45
+ where: where(),
46
+ notes: 'evaluate elements of the list individually',
47
+ match: ({context, callId}) => context.marker == 'list' && context.evaluate,
48
+ apply: async ({context, toArray, toList, e, resolveEvaluate}) => {
49
+ const list = []
50
+ for (const element of toArray(context)) {
51
+ list.push(await e(element))
52
+ }
53
+ resolveEvaluate(context, toList(list))
54
+ }
55
+ },
56
+ ],
43
57
  generators: [
44
58
  {
45
59
  where: where(),
@@ -67,9 +81,9 @@ const config = {
67
81
  match: ({context, hierarchy}) => context.marker == 'list' && context.value,
68
82
  apply: async ({context, gs}) => {
69
83
  if (context.newLinesOnly) {
70
- return await gs(context.value, '\n')
84
+ return await gs(toFinalValue(context), '\n')
71
85
  } else {
72
- return await gs(context.value, ', ', ' and ')
86
+ return await gs(toFinalValue(context), ', ', ' and ')
73
87
  }
74
88
  }
75
89
  },
@@ -108,7 +122,7 @@ function initializer({objects, config, isModule}) {
108
122
 
109
123
  knowledgeModule( {
110
124
  config,
111
- includes: [gdefaults],
125
+ includes: [stm],
112
126
  initializer,
113
127
 
114
128
  module,
@@ -30402,6 +30402,7 @@
30402
30402
  "modifiers": [
30403
30403
  "determiner"
30404
30404
  ],
30405
+ "propertyOf": true,
30405
30406
  "object": {
30406
30407
  "value": "phasers",
30407
30408
  "unknown": true,
@@ -30552,6 +30553,24 @@
30552
30553
  0
30553
30554
  ]
30554
30555
  ],
30556
+ [
30557
+ [
30558
+ "is",
30559
+ 0
30560
+ ],
30561
+ [
30562
+ "propertyOf",
30563
+ 0
30564
+ ],
30565
+ [
30566
+ "the",
30567
+ 0
30568
+ ],
30569
+ [
30570
+ "unknown",
30571
+ 0
30572
+ ]
30573
+ ],
30555
30574
  [
30556
30575
  [
30557
30576
  "is",
@@ -34676,6 +34695,7 @@
34676
34695
  "modifiers": [
34677
34696
  "determiner"
34678
34697
  ],
34698
+ "propertyOf": true,
34679
34699
  "object": {
34680
34700
  "value": "photon_torpedo",
34681
34701
  "number": "many",
@@ -46938,6 +46958,7 @@
46938
46958
  "modifiers": [
46939
46959
  "determiner"
46940
46960
  ],
46961
+ "propertyOf": true,
46941
46962
  "object": {
46942
46963
  "value": "weapon",
46943
46964
  "unknown": true,
@@ -50507,6 +50528,7 @@
50507
50528
  "modifiers": [
50508
50529
  "determiner"
50509
50530
  ],
50531
+ "propertyOf": true,
50510
50532
  "object": {
50511
50533
  "value": "weapon",
50512
50534
  "unknown": true,
@@ -53284,6 +53306,24 @@
53284
53306
  0
53285
53307
  ]
53286
53308
  ],
53309
+ [
53310
+ [
53311
+ "is",
53312
+ 0
53313
+ ],
53314
+ [
53315
+ "propertyOf",
53316
+ 0
53317
+ ],
53318
+ [
53319
+ "the",
53320
+ 0
53321
+ ],
53322
+ [
53323
+ "unknown",
53324
+ 0
53325
+ ]
53326
+ ],
53287
53327
  [
53288
53328
  [
53289
53329
  "is",
@@ -476,7 +476,12 @@ const config = {
476
476
  }
477
477
  // greg101
478
478
  if (focus == 'one') {
479
- return `${await g(context.two)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gp(context.one)}`
479
+ let number = 'one'
480
+ if (context.two.evalue && isMany(context.two.evalue)) {
481
+ number = 'many'
482
+ }
483
+ return `${await g(context.two)} ${number == 'many' ? "are" : "is"} ${await gp({ ...context.one, number })}`
484
+ // return `${await g(context.two)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gp(context.one)}`
480
485
  } else {
481
486
  // TODO fix this using the assumed and that whole mess. change isResponse to useValue
482
487
  if (context.isResponse) {