ekms 9.6.0-beta.6 → 9.6.0-beta.7

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.
@@ -128,7 +128,7 @@
128
128
  ]
129
129
  ],
130
130
  "generatorp": "async ({context, g}) => `${await g(context.from)} ${context.word} ${await g(context.to)}`",
131
- "evaluator": "async ({context, kms, e, error, toArray, gp, gr, toList}) => {\n const from = context.from;\n const tos = toArray(context.to);\n let evalue;\n let efrom = from\n if (!from.unit) {\n efrom = (await e(from)).evalue\n }\n async function convert(to) {\n if (to.value == efrom.unit.value) {\n evalue = efrom.amount\n evalue.evalue = efrom.amount.value\n } else {\n const formula = kms.formulas.api.get(to, [efrom.unit])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: efrom.unit, to } }\n kms.stm.api.mentioned({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(efrom.unit.value, efrom.amount)\n evalue = await e(formula)\n }\n return evalue\n }\n\n let evalues = []\n for (const to of tos) {\n evalues.push({ value: await convert(to), to: structuredClone(to) })\n }\n evalues.sort((a, b) => a.evalue - b.evalue )\n\n let fractionalPart = 0\n let scale = 1\n for (const evalue of evalues) {\n const value = evalue.value.evalue * scale\n const integerPart = Math.trunc(value)\n fractionalPart = Math.abs(value - integerPart)\n evalue.value.evalue = integerPart\n scale = fractionalPart / value * scale\n }\n // evalues[evalues.length-1].value.evalue = Number((integerPart * (1+scale)).toFixed(4))\n evalues[evalues.length-1].value.evalue += fractionalPart\n evalues[evalues.length-1].value.evalue = Number(evalues[evalues.length-1].value.evalue.toFixed(4))\n\n // remove the zeros\n evalues = evalues.filter( (evalue) => evalue.value.evalue )\n\n /*\n '{\n \"marker\":\"dimension\",\n \"unit\":{\"marker\":\"unit\",\"range\":{\"start\":19,\"end\":25},\"word\":\"celcius\",\"text\":\"celcius\",\"value\":\"celcius\",\"unknown\":true,\"types\":[\"unit\",\"unknown\"]},\n \"value\":10,\n \"amount\":{\"word\":\"degrees\",\"number\":\"many\",\"text\":\"10 degrees\",\"marker\":\"degree\",\"range\":{\"start\":8,\"end\":17},\"value\":10,\"amount\":{\"value\":10,\"text\":\"10\",\"marker\":\"number\",\"word\":\"10\",\"range\":{\"start\":8,\"end\":9},\"types\":[\"number\"]}},\n \"text\":\"10 degrees celcius\",\"range\":{\"start\":8,\"end\":25}}'\n */\n evalues = evalues.map((evalue) => {\n const number = evalue.value.evalue == 1 ? 'one' : 'many'\n evalue.to.number = number\n return { \n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: evalue.to,\n amount: { evalue: evalue.value, paraphrase: undefined }\n }\n })\n if (evalues.length > 1) {\n context.evalue = toList(evalues)\n } else {\n context.evalue = evalues[0]\n }\n }"
131
+ "evaluator": "async ({context, kms, e, error, toArray, gp, gr, toList}) => {\n const from = context.from;\n const tos = toArray(context.to);\n let evalue;\n let efrom = from\n if (!from.unit) {\n efrom = (await e(from)).evalue\n }\n async function convert(to) {\n if (to.value == efrom.unit.value) {\n evalue = efrom.amount\n evalue.evalue = efrom.amount.value\n } else {\n const formula = kms.formulas.api.get(to, [efrom.unit])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: efrom.unit, to } }\n kms.stm.api.mentioned({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(efrom.unit.value, efrom.amount)\n evalue = await e(formula)\n }\n return evalue\n }\n\n let evalues = []\n for (const to of tos) {\n evalues.push({ value: await convert(to), to: structuredClone(to) })\n }\n evalues.sort((a, b) => a.evalue - b.evalue )\n\n let fractionalPart = 0\n let scale = 1\n for (const evalue of evalues) {\n const value = toFinalValue(evalue) * scale\n const integerPart = Math.trunc(value)\n fractionalPart = Math.abs(value - integerPart)\n evalue.value.evalue = integerPart\n scale = fractionalPart / value * scale\n }\n // evalues[evalues.length-1].value.evalue = Number((integerPart * (1+scale)).toFixed(4))\n evalues[evalues.length-1].value.evalue += fractionalPart\n evalues[evalues.length-1].value.evalue = Number(evalues[evalues.length-1].value.evalue.toFixed(4))\n\n // remove the zeros\n evalues = evalues.filter( (evalue) => evalue.value.evalue )\n\n /*\n '{\n \"marker\":\"dimension\",\n \"unit\":{\"marker\":\"unit\",\"range\":{\"start\":19,\"end\":25},\"word\":\"celcius\",\"text\":\"celcius\",\"value\":\"celcius\",\"unknown\":true,\"types\":[\"unit\",\"unknown\"]},\n \"value\":10,\n \"amount\":{\"word\":\"degrees\",\"number\":\"many\",\"text\":\"10 degrees\",\"marker\":\"degree\",\"range\":{\"start\":8,\"end\":17},\"value\":10,\"amount\":{\"value\":10,\"text\":\"10\",\"marker\":\"number\",\"word\":\"10\",\"range\":{\"start\":8,\"end\":9},\"types\":[\"number\"]}},\n \"text\":\"10 degrees celcius\",\"range\":{\"start\":8,\"end\":25}}'\n */\n evalues = evalues.map((evalue) => {\n const number = evalue.value.evalue == 1 ? 'one' : 'many'\n evalue.to.number = number\n return { \n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: evalue.to,\n amount: { evalue: evalue.value, paraphrase: undefined }\n }\n })\n if (evalues.length > 1) {\n context.evalue = toList(evalues)\n } else {\n context.evalue = evalues[0]\n }\n }"
132
132
  },
133
133
  {
134
134
  "id": "unit",
@@ -1,5 +1,5 @@
1
1
  const { debug, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
2
- const { defaultObjectCheck, defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
2
+ const { toFinalValue, defaultObjectCheck, defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
3
3
  const hierarchy = require('./hierarchy.js')
4
4
  const formulas = require('./formulas.js')
5
5
  const testing = require('./testing.js')
@@ -174,7 +174,7 @@ const config = {
174
174
  let fractionalPart = 0
175
175
  let scale = 1
176
176
  for (const evalue of evalues) {
177
- const value = evalue.value.evalue * scale
177
+ const value = toFinalValue(evalue) * scale
178
178
  const integerPart = Math.trunc(value)
179
179
  fractionalPart = Math.abs(value - integerPart)
180
180
  evalue.value.evalue = integerPart
package/common/drone.js CHANGED
@@ -167,7 +167,7 @@ The time t needed to turn by angle θ is:
167
167
  */
168
168
  class API {
169
169
  constructor() {
170
- this.overrideCheck = new OverrideCheck(API, ['forwardDrone', 'backwardDrone', 'rotateDrone', 'sonicDrone', 'tiltAngleDrone', 'panAngleDrone', 'stopDrone'])
170
+ this.overrideCheck = new OverrideCheck(API, ['forwardDrone', 'backwardDrone', 'rotateDrone', 'sonicDrone', 'tiltAngleDrone', 'panAngleDrone', 'stopDrone', 'minimumSpeedDrone', 'maximumSpeedDrone'])
171
171
  this.overriden = this.constructor !== API
172
172
  }
173
173
 
@@ -175,6 +175,15 @@ class API {
175
175
  if (this.overriden) {
176
176
  this.overrideCheck.check(this)
177
177
  }
178
+
179
+ if (!this.minimumSpeedDrone()) {
180
+ throw new Error(`minimumSpeedDrone is not returning a positive number. Its returning ${this.minimumSpeedDrone()}`)
181
+ }
182
+
183
+ if (!this.maximumSpeedDrone()) {
184
+ throw new Error(`maximumSpeedDrone is not returning a positive number. Its returning ${this.maximumSpeedDrone()}`)
185
+ }
186
+
178
187
  this._objects = objects
179
188
  this._objects.defaultTime = { hour: 9, minute: 0, second: 0, millisecond: 0 }
180
189
  delete this.testDate
@@ -293,13 +302,13 @@ class API {
293
302
  await this.backward(command.speed, { batched: command.distance })
294
303
  break
295
304
  case 'right':
296
- await this.rotate(-Math.PI/4)
305
+ await this.rotate(-Math.PI/2)
297
306
  break
298
307
  case 'left':
299
- await this.rotate(Math.PI/4)
308
+ await this.rotate(Math.PI/2)
300
309
  break
301
310
  case 'around':
302
- await this.rotate(Math.PI/2)
311
+ await this.rotate(Math.PI)
303
312
  break
304
313
  }
305
314
 
@@ -12745,7 +12745,7 @@
12745
12745
  },
12746
12746
  "drone1": {
12747
12747
  "current": {
12748
- "angleInRadians": -0.7853981633974483,
12748
+ "angleInRadians": -1.5707963267948966,
12749
12749
  "direction": "right",
12750
12750
  "ordinal": 1,
12751
12751
  "speed": 0.25
@@ -12759,7 +12759,7 @@
12759
12759
  "history": [
12760
12760
  {
12761
12761
  "marker": "history",
12762
- "turn": -0.7853981633974483
12762
+ "turn": -1.5707963267948966
12763
12763
  }
12764
12764
  ],
12765
12765
  "km": "drone1",
@@ -19020,7 +19020,7 @@
19020
19020
  },
19021
19021
  "drone1": {
19022
19022
  "current": {
19023
- "angleInRadians": 0.7853981633974483,
19023
+ "angleInRadians": 1.5707963267948966,
19024
19024
  "direction": "left",
19025
19025
  "ordinal": 1,
19026
19026
  "speed": 0.25
@@ -19034,7 +19034,7 @@
19034
19034
  "history": [
19035
19035
  {
19036
19036
  "marker": "history",
19037
- "turn": 0.7853981633974483
19037
+ "turn": 1.5707963267948966
19038
19038
  }
19039
19039
  ],
19040
19040
  "km": "drone1",
@@ -31491,7 +31491,7 @@
31491
31491
  },
31492
31492
  "drone1": {
31493
31493
  "current": {
31494
- "angleInRadians": 1.5707963267948966,
31494
+ "angleInRadians": 3.141592653589793,
31495
31495
  "direction": "around",
31496
31496
  "ordinal": 1,
31497
31497
  "speed": 0.25
@@ -31505,7 +31505,7 @@
31505
31505
  "history": [
31506
31506
  {
31507
31507
  "marker": "history",
31508
- "turn": 1.5707963267948966
31508
+ "turn": 3.141592653589793
31509
31509
  }
31510
31510
  ],
31511
31511
  "km": "drone1",
@@ -57171,7 +57171,6 @@
57171
57171
  "verbatim": "The drone cannot go that slow. The minimum speed is 900 meters per hour"
57172
57172
  }
57173
57173
  ],
57174
- "developerTest": false,
57175
57174
  "generatedParenthesized": [
57176
57175
  "",
57177
57176
  "",
@@ -63749,7 +63748,6 @@
63749
63748
  "word": "back"
63750
63749
  }
63751
63750
  ],
63752
- "developerTest": false,
63753
63751
  "generatedParenthesized": [
63754
63752
  "",
63755
63753
  "",
@@ -4888,8 +4888,15 @@
4888
4888
  "default": true,
4889
4889
  "evalue": {
4890
4890
  "dead": true,
4891
- "evalue": 14,
4891
+ "evalue": {
4892
+ "isResponse": true,
4893
+ "marker": "number",
4894
+ "paraphrase": false,
4895
+ "value": 14
4896
+ },
4892
4897
  "instance": true,
4898
+ "isModule": false,
4899
+ "isProcess": true,
4893
4900
  "isResponse": true,
4894
4901
  "level": 1,
4895
4902
  "marker": "plusExpression",
@@ -4943,6 +4950,8 @@
4943
4950
  }
4944
4951
  },
4945
4952
  "instance": true,
4953
+ "isModule": false,
4954
+ "isProcess": true,
4946
4955
  "level": 1,
4947
4956
  "marker": "x",
4948
4957
  "range": {
@@ -4992,10 +5001,11 @@
4992
5001
  "word": "calculate"
4993
5002
  }
4994
5003
  ],
5004
+ "developerTest": false,
4995
5005
  "generatedParenthesized": [
4996
5006
  "",
4997
5007
  "",
4998
- "(((14)))"
5008
+ "((((14))))"
4999
5009
  ],
5000
5010
  "metadata": {
5001
5011
  "opChoices": [
@@ -5312,6 +5322,8 @@
5312
5322
  ]
5313
5323
  },
5314
5324
  "objects": {
5325
+ "associations": [
5326
+ ],
5315
5327
  "nameToUUID": {
5316
5328
  "articles": "articles2",
5317
5329
  "asking": "asking2",
@@ -5333,33 +5345,42 @@
5333
5345
  "punctuation": "punctuation2",
5334
5346
  "sdefaults": "sdefaults2",
5335
5347
  "stm": "stm2",
5336
- "tokenize": "tokenize2"
5348
+ "tokenize": "tokenize2",
5349
+ "words": "words2"
5337
5350
  },
5338
5351
  "namespaced": {
5339
5352
  "articles2": {
5353
+ "km": "articles2"
5340
5354
  },
5341
5355
  "asking2": {
5356
+ "km": "asking2"
5342
5357
  },
5343
5358
  "comparable2": {
5359
+ "km": "comparable2"
5344
5360
  },
5345
5361
  "concept2": {
5346
5362
  "defaultTypesForHierarchy": {
5347
5363
  },
5364
+ "km": "concept2",
5348
5365
  "valueToWords": [
5349
5366
  ]
5350
5367
  },
5351
5368
  "conjunction2": {
5369
+ "km": "conjunction2"
5352
5370
  },
5353
5371
  "countable2": {
5372
+ "km": "countable2"
5354
5373
  },
5355
5374
  "dialogues2": {
5356
5375
  "idSuffix": "",
5376
+ "km": "dialogues2",
5357
5377
  "mentioned": [
5358
5378
  ],
5359
5379
  "variables": {
5360
5380
  }
5361
5381
  },
5362
5382
  "evaluate2": {
5383
+ "km": "evaluate2"
5363
5384
  },
5364
5385
  "formulas1": {
5365
5386
  "formulas": {
@@ -5606,25 +5627,35 @@
5606
5627
  }
5607
5628
  }
5608
5629
  ]
5609
- }
5630
+ },
5631
+ "km": "formulas1"
5610
5632
  },
5611
5633
  "gdefaults2": {
5634
+ "km": "gdefaults2"
5612
5635
  },
5613
5636
  "hierarchy2": {
5637
+ "km": "hierarchy2"
5614
5638
  },
5615
5639
  "math2": {
5640
+ "km": "math2"
5616
5641
  },
5617
5642
  "meta2": {
5643
+ "km": "meta2"
5618
5644
  },
5619
5645
  "negation2": {
5646
+ "km": "negation2"
5620
5647
  },
5621
5648
  "numbers2": {
5649
+ "km": "numbers2"
5622
5650
  },
5623
5651
  "pos2": {
5652
+ "km": "pos2"
5624
5653
  },
5625
5654
  "properties2": {
5626
5655
  "children": {
5627
5656
  "adjective": [
5657
+ "stm_previous",
5658
+ "stm_current",
5628
5659
  "stm_before"
5629
5660
  ],
5630
5661
  "article": [
@@ -5712,8 +5743,7 @@
5712
5743
  "modifies",
5713
5744
  "is",
5714
5745
  "isQuery",
5715
- "remember",
5716
- "evaluate"
5746
+ "remember"
5717
5747
  ]
5718
5748
  },
5719
5749
  "concepts": [
@@ -5756,11 +5786,12 @@
5756
5786
  "reason",
5757
5787
  "memorable",
5758
5788
  "remember",
5759
- "stm_before",
5789
+ "stm_previous",
5760
5790
  "adjective",
5791
+ "stm_current",
5792
+ "stm_before",
5761
5793
  "orAble",
5762
5794
  "ifAble",
5763
- "evaluate",
5764
5795
  "each",
5765
5796
  "every",
5766
5797
  "distributable",
@@ -5772,6 +5803,7 @@
5772
5803
  "descending",
5773
5804
  "formula"
5774
5805
  ],
5806
+ "km": "properties2",
5775
5807
  "parents": {
5776
5808
  "a": [
5777
5809
  "article"
@@ -5798,9 +5830,6 @@
5798
5830
  "each": [
5799
5831
  "article"
5800
5832
  ],
5801
- "evaluate": [
5802
- "verb"
5803
- ],
5804
5833
  "every": [
5805
5834
  "article"
5806
5835
  ],
@@ -5876,6 +5905,12 @@
5876
5905
  "stm_before": [
5877
5906
  "adjective"
5878
5907
  ],
5908
+ "stm_current": [
5909
+ "adjective"
5910
+ ],
5911
+ "stm_previous": [
5912
+ "adjective"
5913
+ ],
5879
5914
  "that": [
5880
5915
  "thisitthat"
5881
5916
  ],
@@ -5943,8 +5978,6 @@
5943
5978
  },
5944
5979
  "each": {
5945
5980
  },
5946
- "evaluate": {
5947
- },
5948
5981
  "every": {
5949
5982
  },
5950
5983
  "formula": {
@@ -5999,6 +6032,10 @@
5999
6032
  },
6000
6033
  "stm_before": {
6001
6034
  },
6035
+ "stm_current": {
6036
+ },
6037
+ "stm_previous": {
6038
+ },
6002
6039
  "that": {
6003
6040
  },
6004
6041
  "the": {
@@ -6035,16 +6072,25 @@
6035
6072
  }
6036
6073
  },
6037
6074
  "punctuation2": {
6075
+ "km": "punctuation2"
6038
6076
  },
6039
6077
  "sdefaults2": {
6078
+ "km": "sdefaults2"
6040
6079
  },
6041
6080
  "stm2": {
6081
+ "km": "stm2",
6042
6082
  "mentioned": [
6043
6083
  ],
6044
6084
  "variables": {
6045
6085
  }
6046
6086
  },
6047
6087
  "tokenize2": {
6088
+ "km": "tokenize2"
6089
+ },
6090
+ "words2": {
6091
+ "km": "words2",
6092
+ "words": [
6093
+ ]
6048
6094
  }
6049
6095
  },
6050
6096
  "processed": [
@@ -6059,8 +6105,15 @@
6059
6105
  "default": true,
6060
6106
  "evalue": {
6061
6107
  "dead": true,
6062
- "evalue": 14,
6108
+ "evalue": {
6109
+ "isResponse": true,
6110
+ "marker": "number",
6111
+ "paraphrase": false,
6112
+ "value": 14
6113
+ },
6063
6114
  "instance": true,
6115
+ "isModule": false,
6116
+ "isProcess": true,
6064
6117
  "isResponse": true,
6065
6118
  "level": 1,
6066
6119
  "marker": "plusExpression",
@@ -6114,6 +6167,8 @@
6114
6167
  }
6115
6168
  },
6116
6169
  "instance": true,
6170
+ "isModule": false,
6171
+ "isProcess": true,
6117
6172
  "level": 1,
6118
6173
  "marker": "x",
6119
6174
  "range": {
@@ -6338,7 +6393,7 @@
6338
6393
  },
6339
6394
  {
6340
6395
  "context": {
6341
- "context_id": 2,
6396
+ "context_id": null,
6342
6397
  "context_index": 1,
6343
6398
  "dead": true,
6344
6399
  "level": 2,
@@ -6350,7 +6405,7 @@
6350
6405
  "marker": "unknown",
6351
6406
  "number": "many",
6352
6407
  "range": {
6353
- "end": 20,
6408
+ "end": 7,
6354
6409
  "start": 0
6355
6410
  },
6356
6411
  "text": "formulas",
@@ -6414,13 +6469,7 @@
6414
6469
  "value": "operator",
6415
6470
  "word": "operator"
6416
6471
  },
6417
- "context_id": 2,
6418
- "context_index": 1,
6419
- "dead": true,
6420
- "flatten": false,
6421
- "level": 1,
6422
- "marker": "modifies",
6423
- "modifiers": [
6472
+ "conceptModifiers": [
6424
6473
  {
6425
6474
  "dead": true,
6426
6475
  "level": 0,
@@ -6435,6 +6484,12 @@
6435
6484
  "word": "mathematical"
6436
6485
  }
6437
6486
  ],
6487
+ "context_id": null,
6488
+ "context_index": 1,
6489
+ "dead": true,
6490
+ "flatten": false,
6491
+ "level": 1,
6492
+ "marker": "modifies",
6438
6493
  "number": "one",
6439
6494
  "range": {
6440
6495
  "end": 29,
@@ -6460,7 +6515,7 @@
6460
6515
  },
6461
6516
  {
6462
6517
  "context": {
6463
- "context_id": 2,
6518
+ "context_id": null,
6464
6519
  "context_index": 1,
6465
6520
  "dead": true,
6466
6521
  "level": 2,
@@ -6472,7 +6527,7 @@
6472
6527
  "marker": "unknown",
6473
6528
  "number": "one",
6474
6529
  "range": {
6475
- "end": 28,
6530
+ "end": 9,
6476
6531
  "start": 0
6477
6532
  },
6478
6533
  "text": "descending",
@@ -6512,7 +6567,7 @@
6512
6567
  "word": "a"
6513
6568
  },
6514
6569
  "instance": true,
6515
- "level": 1,
6570
+ "level": 0,
6516
6571
  "marker": "sort_ordering",
6517
6572
  "modifier_sort": {
6518
6573
  "level": 0,
package/common/helpers.js CHANGED
@@ -200,6 +200,17 @@ function toEValue(context) {
200
200
  return context;
201
201
  }
202
202
 
203
+ function toFinalValue(context) {
204
+ while( context.evalue || context.value ) {
205
+ if (context.evalue) {
206
+ context = context.evalue
207
+ } else {
208
+ context = context.value
209
+ }
210
+ }
211
+ return context;
212
+ }
213
+
203
214
  function defaultObjectCheck(extra = []) {
204
215
  return {
205
216
  objects: [
@@ -405,6 +416,7 @@ module.exports = {
405
416
  defaultContextCheckProperties,
406
417
  defaultObjectCheck,
407
418
  toEValue,
419
+ toFinalValue,
408
420
  millisecondsUntilHourOfDay,
409
421
  indent,
410
422
  isMany,
@@ -88,7 +88,7 @@
88
88
  "mathematicalExpression"
89
89
  ],
90
90
  "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
91
- "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
91
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = { marker: 'number', value: apply(x, y) }\n // context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
92
92
  },
93
93
  {
94
94
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
@@ -120,7 +120,7 @@
120
120
  "mathematicalExpression"
121
121
  ],
122
122
  "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
123
- "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
123
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = { marker: 'number', value: apply(x, y) }\n // context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
124
124
  },
125
125
  {
126
126
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
@@ -161,7 +161,7 @@
161
161
  "mathematicalExpression"
162
162
  ],
163
163
  "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
164
- "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
164
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = { marker: 'number', value: apply(x, y) }\n // context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
165
165
  },
166
166
  {
167
167
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33",
@@ -201,7 +201,7 @@
201
201
  "mathematicalExpression"
202
202
  ],
203
203
  "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
204
- "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
204
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = { marker: 'number', value: apply(x, y) }\n // context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
205
205
  }
206
206
  ]
207
207
  }
package/common/math.js CHANGED
@@ -54,7 +54,8 @@ function mathematicalOperator(name, words, apply, before = []) {
54
54
  // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
55
55
  context.isResponse = false
56
56
  } else {
57
- context.evalue = apply(x, y)
57
+ context.evalue = { marker: 'number', value: apply(x, y) }
58
+ // context.evalue = apply(x, y)
58
59
  context.evalue.isResponse = true
59
60
  context.evalue.paraphrase = false
60
61
  // context.paraphrase = false