ekms 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
package/common/drone.js CHANGED
@@ -228,7 +228,7 @@ https://www.amazon.ca/Freenove-Raspberry-Tracking-Avoidance-Ultrasonic/dp/B0BNDQ
228
228
 
229
229
  function expectDirection(args) {
230
230
  args.config.addSemantic({
231
- match: ({context, isA}) => isA(context.marker, 'direction') && !context.evaluate,
231
+ match: ({context, isA}) => isA(context.marker, 'direction'),
232
232
  apply: ({objects, context}) => {
233
233
  objects.runCommand = true
234
234
  objects.current.direction = context.marker
@@ -255,15 +255,15 @@ function roundTo(num, decimals = 2) {
255
255
  }
256
256
 
257
257
  async function handleDistance(args, distance) {
258
- const {objects, fragments, e, say, gp} = args
258
+ const {objects, fragments, e, say, gp, toEValue} = args
259
259
  if (!distance) {
260
260
  distance = args.context
261
261
  }
262
262
  const instantiation = await fragments("quantity in meters", { quantity: distance })
263
263
  try {
264
- const result = await e(instantiation)
264
+ const result = await e(instantiation, where())
265
265
  objects.runCommand = true
266
- objects.current.distance = result.evalue.amount.evalue.evalue
266
+ objects.current.distance = toEValue(result.evalue.amount)
267
267
  } catch (e) {
268
268
  say(`Don't know how to interpret ${await gp(distance)} in meters`)
269
269
  }
@@ -444,7 +444,7 @@ class API {
444
444
  // const valueInUsersUnits = await fragments("quantity in meters", { quantity: minimumValueInDroneUnits, meter: unitsOfUser })
445
445
  if (unitsOfUser) {
446
446
  const valueInUsersUnits = await quantityInMeters(minimumValueInDroneUnits, unitsOfUser )
447
- const evaluated = await e(valueInUsersUnits)
447
+ const evaluated = await e(valueInUsersUnits, where())
448
448
  say(`The drone cannot go that slow. The minimum speed is ${await gr(evaluated.evalue)}`)
449
449
  } else {
450
450
  say(`The drone cannot go that fast. The minimum speed is ${await gr(minimumValueInDroneUnits)}`)
@@ -462,7 +462,7 @@ class API {
462
462
  // const valueInUsersUnits = await fragments("quantity in meters", { quantity: maximumValueInDroneUnits, meter: unitsOfUser })
463
463
  if (unitsOfUser) {
464
464
  const valueInUsersUnits = await quantityInMeters(maximumValueInDroneUnits, unitsOfUser)
465
- const evaluated = await e(valueInUsersUnits)
465
+ const evaluated = await e(valueInUsersUnits, where())
466
466
  say(`The drone cannot go that fast. The maximum speed is ${await gr(evaluated.evalue)}`)
467
467
  } else {
468
468
  say(`The drone cannot go that fast. The maximum speed is ${await gr(maximumValueInDroneUnits)}`)
@@ -794,11 +794,11 @@ function expectDistanceForMove(args) {
794
794
  // TODO save id for recalibration
795
795
  args.config.addSemantic({
796
796
  match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
797
- apply: async ({context, objects, fragments, e}) => {
797
+ apply: async ({context, objects, fragments, e, toEValue}) => {
798
798
  const instantiation = await fragments("quantity in meters", { quantity: context })
799
- const result = await e(instantiation)
799
+ const result = await e(instantiation, where())
800
800
  objects.runCommand = true
801
- objects.current.distance = result.evalue.amount.evalue.evalue
801
+ objects.current.distance = toEValue(result.evalue.amount)
802
802
  }
803
803
  })
804
804
  }
@@ -858,11 +858,11 @@ const template = {
858
858
 
859
859
  args.config.addSemantic({
860
860
  match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit?.marker, 'unitPerUnit'),
861
- apply: async ({context, objects, api, gr, fragments, e, say}) => {
861
+ apply: async ({context, objects, api, gr, toEValue, fragments, e, say}) => {
862
862
  // send a command to the drone
863
863
  const instantiation = await fragments("quantity in meters per second", { quantity: context })
864
- const result = await e(instantiation)
865
- const desired_speed = result.evalue.amount.evalue.evalue
864
+ const result = await e(instantiation, where())
865
+ const desired_speed = toEValue(result.evalue.amount)
866
866
  objects.runCommand = true
867
867
  objects.current.speed = desired_speed
868
868
  objects.current.speedUnitsOfUser = context.unit
@@ -939,6 +939,7 @@ const template = {
939
939
  },
940
940
  {
941
941
  id: 'startPath',
942
+ where: where(),
942
943
  isA: ['verb'],
943
944
  bridge: "{ ...next(operator), path: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'path' }] }",
944
945
  check: defaultContextCheckProperties(['path']),
@@ -979,6 +980,7 @@ const template = {
979
980
  },
980
981
  {
981
982
  id: 'patrol',
983
+ where: where(),
982
984
  isA: ['verb', 'repeatable', 'action'],
983
985
  bridge: `{
984
986
  ...next(operator),
@@ -992,7 +994,7 @@ const template = {
992
994
  for (const context_path of paths) {
993
995
  const evaluated = await(e(context_path))
994
996
  const path = toEValue(evaluated)
995
- if (path.marker == 'answerNotKnown') {
997
+ if (path.marker === 'undefined') {
996
998
  verbatim(`${await g(context_path)} is not a known path`)
997
999
  continue
998
1000
  }
@@ -1007,7 +1009,7 @@ const template = {
1007
1009
  const timeAtPoints = toArray(context.pause.timeAtPoint)
1008
1010
  for (const timeAtPoint of timeAtPoints) {
1009
1011
  const instantiation = await fragments("quantity in seconds", { quantity: timeAtPoint.time })
1010
- const result = await e(instantiation)
1012
+ const result = await e(instantiation, where())
1011
1013
  const seconds = toFinalValue(toFinalValue(result).amount)
1012
1014
 
1013
1015
  const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })
@@ -1061,25 +1063,9 @@ const template = {
1061
1063
  objects.runCommand = true
1062
1064
  }
1063
1065
  },
1064
- /*
1065
- {
1066
- id: 'do',
1067
- isA: ['verb'],
1068
- bridge: `{
1069
- ...next(operator), operator: operator, path: after[0], interpolate: [{ property: 'operator'}, { property: 'path' }]
1070
- }`,
1071
- semantic: async ({context, e, toEValue, objects}) => {
1072
- const evaluated = await(e(context.path))
1073
- const path = toEValue(evaluated)
1074
- for (const point of path.points) {
1075
- objects.current.path.push(point)
1076
- }
1077
- objects.runCommand = true
1078
- }
1079
- },
1080
- */
1081
1066
  {
1082
1067
  id: 'lift',
1068
+ where: where(),
1083
1069
  isA: ['verb'],
1084
1070
  bridge: `{
1085
1071
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1091,6 +1077,7 @@ const template = {
1091
1077
  },
1092
1078
  {
1093
1079
  id: 'lower',
1080
+ where: where(),
1094
1081
  isA: ['verb'],
1095
1082
  bridge: `{
1096
1083
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1102,6 +1089,7 @@ const template = {
1102
1089
  },
1103
1090
  {
1104
1091
  id: 'openDrone',
1092
+ where: where(),
1105
1093
  isA: ['verb'],
1106
1094
  bridge: `{
1107
1095
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1113,6 +1101,7 @@ const template = {
1113
1101
  },
1114
1102
  {
1115
1103
  id: 'close',
1104
+ where: where(),
1116
1105
  isA: ['verb'],
1117
1106
  bridge: `{
1118
1107
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1124,6 +1113,7 @@ const template = {
1124
1113
  },
1125
1114
  {
1126
1115
  id: 'back',
1116
+ where: where(),
1127
1117
  isA: ['noun'],
1128
1118
  semantic: async ({objects, api, e, context, say}) => {
1129
1119
  await api.back()
@@ -1135,18 +1125,20 @@ const template = {
1135
1125
  },
1136
1126
  {
1137
1127
  id: "toPoint",
1128
+ where: where(),
1138
1129
  isA: ['preposition'],
1139
1130
  after: [['propertyOf', 1]],
1140
1131
  bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
1141
1132
  check: defaultContextCheckProperties(['point']),
1142
1133
  semantic: async ({objects, api, e, context}) => {
1143
1134
  objects.runCommand = true
1144
- const point = await e(context.point)
1135
+ const point = await e(context.point, where())
1145
1136
  objects.current.path.push(point.evalue)
1146
1137
  }
1147
1138
  },
1148
1139
  {
1149
1140
  id: "go",
1141
+ where: where(),
1150
1142
  level: 0,
1151
1143
  // convolution: true,
1152
1144
  isA: ['verb', 'repeatable', 'doAction'],
@@ -1154,6 +1146,7 @@ const template = {
1154
1146
  ...conjugateVerb('go'),
1155
1147
  ],
1156
1148
  check: defaultContextCheckProperties(['direction', 'distance', 'to', 'points']),
1149
+
1157
1150
  bridge: `{
1158
1151
  ...next(operator),
1159
1152
  distance: distance?,
@@ -1190,7 +1183,7 @@ const template = {
1190
1183
  objects.current.timeRepeats = toFinalValue(context.repeats.repeats)
1191
1184
  }
1192
1185
  if (context.to) {
1193
- const evaluation = await e(context.to.point)
1186
+ const evaluation = await e(context.to.point, where())
1194
1187
  const point = toEValue(evaluation)
1195
1188
  objects.current.path.push(point)
1196
1189
  }
@@ -1200,6 +1193,7 @@ const template = {
1200
1193
  },
1201
1194
  {
1202
1195
  id: 'turn',
1196
+ where: where(),
1203
1197
  isA: ['verb', 'action', 'repeatable'],
1204
1198
  before: ['thenAction'],
1205
1199
  words: ['turn'],
@@ -1239,7 +1233,7 @@ const template = {
1239
1233
  if (context.angle) {
1240
1234
  const instantiation = await toRadians(context.angle)
1241
1235
  try {
1242
- const result = await e(instantiation)
1236
+ const result = await e(instantiation, where())
1243
1237
  current.turnAngle = toFinalValue(result.evalue.amount)
1244
1238
  objects.runCommand = true
1245
1239
  } catch (e) {
@@ -1258,6 +1252,7 @@ const template = {
1258
1252
  },
1259
1253
  {
1260
1254
  id: 'pause',
1255
+ where: where(),
1261
1256
  isA: ['verb'],
1262
1257
  words: [
1263
1258
  ...conjugateVerb('pause'),
@@ -1281,7 +1276,7 @@ const template = {
1281
1276
  time = time.quantity
1282
1277
  }
1283
1278
  const instantiation = await fragments("quantity in seconds", { quantity: time})
1284
- const result = await e(instantiation)
1279
+ const result = await e(instantiation, where())
1285
1280
  const seconds = toFinalValue(toFinalValue(result).amount)
1286
1281
  context.pauseSeconds = seconds
1287
1282
  remember(context)
@@ -1302,6 +1297,7 @@ const template = {
1302
1297
  },
1303
1298
  {
1304
1299
  id: 'stop',
1300
+ where: where(),
1305
1301
  isA: ['verb'],
1306
1302
  optional: {
1307
1303
  1: "{ marker: 'drone' }",
@@ -1313,6 +1309,13 @@ const template = {
1313
1309
  }
1314
1310
  },
1315
1311
  ],
1312
+
1313
+ associations: {
1314
+ positive: [
1315
+ { context: [['go', 0], ['toPoint', 0]], choose: 0 },
1316
+ ]
1317
+ },
1318
+
1316
1319
  generators: [
1317
1320
  {
1318
1321
  match: ({context}) => context.marker == 'help' && !context.paraphrase && context.isResponse,
@@ -1327,17 +1330,16 @@ const template = {
1327
1330
  {
1328
1331
  where: where(),
1329
1332
  match: ({context}) => context.marker == 'doAction',
1330
- apply: async ({context, fragments, e, s, toEValue, toFinalValue, namespaced, objects}) => {
1333
+ apply: async ({context, fragments, e, toEValue, toFinalValue, namespaced, objects}) => {
1331
1334
  const updated = { ...context, marker: 'patrol', path: context.action }
1332
1335
  namespaced.set('actions', updated, 'logged', true)
1333
- await s(updated)
1334
- // await s({ ...context, marker: 'patrol', path: context.action })
1336
+ await e(updated, where())
1335
1337
  }
1336
1338
  },
1337
1339
  {
1338
1340
  where: where(),
1339
1341
  match: ({context, contextHierarchy}) => {
1340
- if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.instance) {
1342
+ if (!context.pullFromContext || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.isInstance) {
1341
1343
  return false
1342
1344
  }
1343
1345
 
@@ -1353,7 +1355,7 @@ const template = {
1353
1355
  }))
1354
1356
  const path = (await fragments('path')).contexts()[0]
1355
1357
  delete path.value
1356
- path.instance = true
1358
+ path.isInstance = true
1357
1359
  path.points = pathComponents.reverse()
1358
1360
  frameOfReference(path, { mentioned: 'points', reversed: true })
1359
1361
  await remember(path)
@@ -1364,7 +1366,7 @@ const template = {
1364
1366
  {
1365
1367
  where: where(),
1366
1368
  match: ({context, contextHierarchy}) => {
1367
- if (!context.pullFromContext || !context.evaluate || !contextHierarchy.under('call') || context.notUnderCall) {
1369
+ if (!context.pullFromContext || !contextHierarchy.under('call') || context.notUnderCall) {
1368
1370
  return false
1369
1371
  }
1370
1372
 
@@ -1373,13 +1375,13 @@ const template = {
1373
1375
  }
1374
1376
  },
1375
1377
  apply: async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
1376
- const evaluated = await e({...context, notUnderCall: true})
1378
+ const evaluated = await e({...context, notUnderCall: true}, where())
1377
1379
  const pointsContext = toEValue(evaluated)
1378
1380
  const pathComponents = toArray(pointsContext)
1379
1381
 
1380
1382
  const path = (await fragments('path')).contexts()[0]
1381
1383
  delete path.value
1382
- path.instance = true
1384
+ path.isInstance = true
1383
1385
  path.points = [...pathComponents]
1384
1386
  frameOfReference(path, { mentioned: 'points', reversed: true })
1385
1387
  await remember(path)
@@ -1398,7 +1400,7 @@ const template = {
1398
1400
  */
1399
1401
  {
1400
1402
  where: where(),
1401
- match: ({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
1403
+ match: ({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
1402
1404
  apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {
1403
1405
  const path = await recall({ context: context.objects[1] })
1404
1406
  if (!path?.points) {
@@ -1413,7 +1415,6 @@ const template = {
1413
1415
  },
1414
1416
  {
1415
1417
  match: ({context, contextHierarchy}) =>
1416
- context.evaluate &&
1417
1418
  ['start', 'end', 'point'].includes(context.marker) &&
1418
1419
  !context.propertyOf &&
1419
1420
  contextHierarchy.under('go') &&
@@ -1438,15 +1439,15 @@ const template = {
1438
1439
  where: where(),
1439
1440
  match: ({context}) => {
1440
1441
  // from stm lookup
1441
- if (context.marker == 'mentions' && context.evaluate && context.args.context.marker == 'speed') {
1442
+ if (context.marker == 'mentions' && context.args.context.marker == 'speed') {
1442
1443
  return true
1443
1444
  }
1444
1445
  // from property directly
1445
- if (context.marker == 'speed' && context.evaluate) {
1446
+ if (context.marker == 'speed') {
1446
1447
  return true
1447
1448
  }
1448
1449
  },
1449
- apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {
1450
+ apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
1450
1451
  let return_context = context
1451
1452
  if (context.marker == 'speed') {
1452
1453
  // okay
@@ -1464,22 +1465,22 @@ const template = {
1464
1465
  }
1465
1466
  }
1466
1467
  const speed = await fragments("number meters per second", { number: { marker: 'integer', value, word: undefined} })
1467
- const preferred = await s({ marker: 'preferredUnits', quantity: speed })
1468
- resolveEvaluate(return_context, preferred.response || speed)
1468
+ const preferred = await e({ marker: 'preferredUnits', quantity: speed }, where())
1469
+ resolveEvaluate(return_context, preferred.evalue || speed)
1469
1470
  }
1470
1471
  },
1471
1472
  {
1472
1473
  where: where(),
1473
1474
  // recallOverride(context(), frameOfReference())
1474
1475
  match: ({context}) => {
1475
- if (context.marker == 'mentions' && context.evaluate && ['direction', 'drone_direction'].includes(context.args.context.marker)) {
1476
+ if (context.marker == 'mentions' && ['direction', 'drone_direction'].includes(context.args.context.marker)) {
1476
1477
  return true
1477
1478
  }
1478
- if (['direction', 'drone_direction'].includes(context.marker) && context.evaluate) {
1479
+ if (['direction', 'drone_direction'].includes(context.marker)) {
1479
1480
  return true
1480
1481
  }
1481
1482
  },
1482
- apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {
1483
+ apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
1483
1484
  const value = objects.current.angleInRadians
1484
1485
  const fi = await fragments("number radians")
1485
1486
  const direction = await fi.instantiate([
@@ -1490,8 +1491,8 @@ const template = {
1490
1491
  }
1491
1492
  }
1492
1493
  ])
1493
- const preferred = await s({ marker: 'preferredUnits', quantity: direction })
1494
- resolveEvaluate(context, preferred.response || direction)
1494
+ const preferred = await e({ marker: 'preferredUnits', quantity: direction }, where())
1495
+ resolveEvaluate(context, preferred.evalue || direction)
1495
1496
  }
1496
1497
  },
1497
1498
  {
@@ -1537,7 +1538,7 @@ knowledgeModule( {
1537
1538
  defaultContextCheck({ marker: 'path', exported: true,
1538
1539
  extra: [
1539
1540
  'points',
1540
- 'instance',
1541
+ 'isInstance',
1541
1542
  {
1542
1543
  property: 'namespaced',
1543
1544
  check: [
@@ -6,7 +6,7 @@
6
6
  "point is a concept",
7
7
  "points are nameable orderable and memorable",
8
8
  {
9
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
9
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, toEValue, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = toEValue(result.evalue.amount)\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
10
10
  },
11
11
  {
12
12
  "operators": [
@@ -20,17 +20,19 @@
20
20
  "bridges": [
21
21
  {
22
22
  "id": "toPoint",
23
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
23
24
  "isA": [
24
25
  "preposition"
25
26
  ],
26
27
  "bridge": "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
27
- "semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point)\n objects.current.destination = point.evalue\n }\n }"
28
+ "semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point, where())\n objects.current.destination = point.evalue\n }\n }"
28
29
  },
29
30
  {
30
31
  "id": "go"
31
32
  },
32
33
  {
33
34
  "id": "turn",
35
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
34
36
  "isA": [
35
37
  "verb"
36
38
  ],
@@ -39,6 +41,7 @@
39
41
  },
40
42
  {
41
43
  "id": "calibrate",
44
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
42
45
  "isA": [
43
46
  "verb"
44
47
  ],
@@ -47,6 +50,7 @@
47
50
  },
48
51
  {
49
52
  "id": "pause",
53
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
50
54
  "isA": [
51
55
  "verb"
52
56
  ],
@@ -55,6 +59,7 @@
55
59
  },
56
60
  {
57
61
  "id": "stop",
62
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
58
63
  "isA": [
59
64
  "verb"
60
65
  ],
@@ -210,7 +215,6 @@
210
215
  "level": 2,
211
216
  "context_index": 1,
212
217
  "topLevel": true,
213
- "context_id": 2,
214
218
  "touchedBy": [
215
219
  "drone_v1#call2"
216
220
  ]
@@ -391,6 +395,9 @@
391
395
  }
392
396
  ],
393
397
  "learned_contextual_priorities": [],
398
+ "explain_associations_details": [
399
+ null
400
+ ],
394
401
  "query": "drone is a concept",
395
402
  "key": {
396
403
  "query": "drone is a concept"
@@ -1048,7 +1055,6 @@
1048
1055
  "level": 2,
1049
1056
  "context_index": 1,
1050
1057
  "topLevel": true,
1051
- "context_id": 2,
1052
1058
  "touchedBy": [
1053
1059
  "drone_v1#call2"
1054
1060
  ]
@@ -2579,6 +2585,9 @@
2579
2585
  }
2580
2586
  ],
2581
2587
  "learned_contextual_priorities": [],
2588
+ "explain_associations_details": [
2589
+ null
2590
+ ],
2582
2591
  "query": "around, forward, left, right, and backward are directions",
2583
2592
  "key": {
2584
2593
  "query": "around, forward, left, right, and backward are directions"
@@ -2802,7 +2811,6 @@
2802
2811
  "level": 2,
2803
2812
  "context_index": 1,
2804
2813
  "topLevel": true,
2805
- "context_id": 2,
2806
2814
  "touchedBy": [
2807
2815
  "drone_v1#call2"
2808
2816
  ]
@@ -3093,6 +3101,9 @@
3093
3101
  }
3094
3102
  ],
3095
3103
  "learned_contextual_priorities": [],
3104
+ "explain_associations_details": [
3105
+ null
3106
+ ],
3096
3107
  "query": "speed and power are properties",
3097
3108
  "key": {
3098
3109
  "query": "speed and power are properties"
@@ -3233,7 +3244,6 @@
3233
3244
  "level": 2,
3234
3245
  "context_index": 1,
3235
3246
  "topLevel": true,
3236
- "context_id": 2,
3237
3247
  "touchedBy": [
3238
3248
  "drone_v1#call2"
3239
3249
  ]
@@ -3414,6 +3424,9 @@
3414
3424
  }
3415
3425
  ],
3416
3426
  "learned_contextual_priorities": [],
3427
+ "explain_associations_details": [
3428
+ null
3429
+ ],
3417
3430
  "query": "point is a concept",
3418
3431
  "key": {
3419
3432
  "query": "point is a concept"
@@ -3664,7 +3677,6 @@
3664
3677
  "level": 2,
3665
3678
  "context_index": 1,
3666
3679
  "topLevel": true,
3667
- "context_id": 2,
3668
3680
  "touchedBy": [
3669
3681
  "drone_v1#call2"
3670
3682
  ]
@@ -4060,13 +4072,16 @@
4060
4072
  }
4061
4073
  ],
4062
4074
  "learned_contextual_priorities": [],
4075
+ "explain_associations_details": [
4076
+ null
4077
+ ],
4063
4078
  "query": "points are nameable orderable and memorable",
4064
4079
  "key": {
4065
4080
  "query": "points are nameable orderable and memorable"
4066
4081
  }
4067
4082
  },
4068
4083
  {
4069
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
4084
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, toEValue, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = toEValue(result.evalue.amount)\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
4070
4085
  },
4071
4086
  {
4072
4087
  "extraConfig": true,
@@ -4081,6 +4096,7 @@
4081
4096
  "bridges": [
4082
4097
  {
4083
4098
  "id": "toPoint",
4099
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
4084
4100
  "isA": [
4085
4101
  "preposition"
4086
4102
  ],
@@ -4091,6 +4107,7 @@
4091
4107
  },
4092
4108
  {
4093
4109
  "id": "turn",
4110
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
4094
4111
  "isA": [
4095
4112
  "verb"
4096
4113
  ],
@@ -4098,6 +4115,7 @@
4098
4115
  },
4099
4116
  {
4100
4117
  "id": "calibrate",
4118
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
4101
4119
  "isA": [
4102
4120
  "verb"
4103
4121
  ],
@@ -4105,6 +4123,7 @@
4105
4123
  },
4106
4124
  {
4107
4125
  "id": "pause",
4126
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
4108
4127
  "isA": [
4109
4128
  "verb"
4110
4129
  ],
@@ -4112,6 +4131,7 @@
4112
4131
  },
4113
4132
  {
4114
4133
  "id": "stop",
4134
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
4115
4135
  "isA": [
4116
4136
  "verb"
4117
4137
  ],
@@ -4210,8 +4230,7 @@
4210
4230
  },
4211
4231
  "level": 1,
4212
4232
  "context_index": 1,
4213
- "topLevel": true,
4214
- "context_id": 2
4233
+ "topLevel": true
4215
4234
  }
4216
4235
  ],
4217
4236
  "generated": [
@@ -4319,6 +4338,9 @@
4319
4338
  }
4320
4339
  ],
4321
4340
  "learned_contextual_priorities": [],
4341
+ "explain_associations_details": [
4342
+ null
4343
+ ],
4322
4344
  "query": "quantity in meters",
4323
4345
  "skipSemantics": true,
4324
4346
  "key": {
@@ -4510,8 +4532,7 @@
4510
4532
  },
4511
4533
  "level": 1,
4512
4534
  "context_index": 1,
4513
- "topLevel": true,
4514
- "context_id": 2
4535
+ "topLevel": true
4515
4536
  }
4516
4537
  ],
4517
4538
  "generated": [
@@ -4729,6 +4750,9 @@
4729
4750
  }
4730
4751
  ],
4731
4752
  "learned_contextual_priorities": [],
4753
+ "explain_associations_details": [
4754
+ null
4755
+ ],
4732
4756
  "query": "quantity in meters per second",
4733
4757
  "skipSemantics": true,
4734
4758
  "key": {