tpmkms
Version:
Reusable libraries for Entodicton, a natural language to json converter
1,539 lines • 1.84 MB
JSON
{
"configs": [
"arm, claw and drone are concepts",
"around, forward, left, right, back, forth and backward are directions",
"paths are nameable and memorable",
"start and end are properties of path",
{
"apply": "({apis}) => {\n apis('properties').addHierarchyWatcher({\n match: ({childId}) => childId == 'point',\n apply: ({config, childId}) => {\n config.updateBridge(childId, ({ bridge }) => {\n if (!bridge.init) {\n bridge.init = {}\n }\n bridge.init['notConjunctableWith'] = ['quantity']\n })\n }\n })\n }"
},
"start and end are points",
"rest and remaining are concepts",
{
"hierarchy": [
[
"point",
"distributable"
],
[
"thisitthat",
"path"
],
[
"path",
"action"
]
]
},
"speed and power are properties",
"speed and power are comparable",
"speed is a quantity",
"point is a concept",
"points are nameable orderable countable and memorable",
"drone modifies direction",
{
"apply": "(args) => {\n expectDirection(args)\n expectDistanceForMove(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, gr, fragments, e, say}) => {\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 objects.runCommand = true\n objects.current.speed = desired_speed\n objects.current.speedUnitsOfUser = context.unit\n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && 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 && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n await api.sendCommand()\n }\n }\n })\n }"
},
{
"operators": [
"([patrol] (path))",
"([lift|lift,raise] (@<= arm || @<= claw))",
"([lower] (@<= arm || @<=claw))",
"([open] (claw))",
"([close] (claw))",
"([startPath|start] (path))",
"([pathComponent])",
"([skipPoint|] (point))",
"(<another> (point))",
"([stop] ([drone|])?)",
"([toPoint|to] (point))",
"([atPoint|at] (point))",
"((context.unit.dimension == 'time') [timeAtPoint|] (atPoint))"
],
"bridges": [
{
"id": "skipPoint",
"words": [
"skip",
"skipping"
],
"isA": [
"verb"
],
"bridge": "{ ...next(operator), points: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'points' }] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"points"
]
},
{
"id": "skipPoint",
"level": 1,
"bridge": "{ \n ...repeatable, \n skip: operator, \n checks: append(repeatable.checks, ['skip']), \n repeatable: repeatable, \n interpolate: [{ property: 'repeatable' }, { property: 'skip', byPosition: true }] \n }",
"selector": {
"loose": "repeatable",
"arguments": {
"repeatable": "(@<= 'repeatable')"
}
},
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"repeatable",
"repeats"
]
},
{
"id": "startPath",
"isA": [
"verb"
],
"bridge": "{ ...next(operator), path: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'path' }] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"path"
],
"semantic": "async ({context, remember, recall, verbatim, g}) => {\n const point = await recall({ context: { marker: 'point' } })\n remember(context) \n remember(point) // put the last point before the startPath so when the new path is generated this is the start point\n verbatim(`New path started from ${await g(point)}`)\n }"
},
{
"id": "timeAtPoint",
"before": [
"verb"
],
"after": [
"preposition"
],
"convolution": true,
"bridge": "{ ...next(operator), time: before[0], point: after[0], operator: operator, interpolate: [{ property: 'time' }, { property: 'point' }] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"time",
"point"
]
},
{
"id": "atPoint",
"isA": [
"preposition"
],
"bridge": "{ ...next(operator), point: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'point' }] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"point"
]
},
{
"id": "another",
"bridge": "{\n ...next(after[0]),\n another: operator,\n after: after[0],\n interpolate: [ { property: 'another' }, { property: 'after' } ]\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"another",
"after"
]
},
{
"id": "pathComponent",
"children": [
"point",
"pause"
]
},
{
"id": "patrol",
"isA": [
"verb",
"repeatable",
"action"
],
"bridge": "{\n ...next(operator), \n operator: operator, \n path: after[0], \n interpolate: append(default(operator.interpolate, [{ property: 'operator'}]), [{ property: 'path' }])\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"path"
],
"semantic": "async ({context, g, e, toArray, fragments, toEValue, toFinalValue, recall, objects, verbatim}) => {\n const paths = toArray(context.path)\n for (const context_path of paths) {\n const evaluated = await(e(context_path))\n const path = toEValue(evaluated)\n if (path.marker == 'answerNotKnown') {\n verbatim(`${await g(context_path)} is not a known path`)\n continue\n }\n \n objects.current.path.push({ message: await g(context) })\n\n // TODO put this in a common place for use by do+patrol \n\n // ordinal to pause time in seconds \n const pauseTimeInSeconds = {}\n if (context.pause) {\n const timeAtPoints = toArray(context.pause.timeAtPoint)\n for (const timeAtPoint of timeAtPoints) {\n const instantiation = await fragments(\"quantity in seconds\", { quantity: timeAtPoint.time })\n const result = await e(instantiation)\n const seconds = toFinalValue(toFinalValue(result).amount)\n\n const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })\n for (const point of toArray(points)) {\n pauseTimeInSeconds[point.ordinal] = seconds\n }\n }\n }\n\n let skipPoints = []\n if (context.skip) {\n skipPoints = toArray(await recall({ context: context.skip.points, frameOfReference: path }))\n }\n\n // get to the start of the patrol \n objects.current.path.push(path.points[0])\n objects.current.path.push({ aimOnly: true, ...path.points[1] })\n objects.current.path.push({ repeatStart: true })\n for (const point of path.points) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n // if the patrol does not start and end at the same spot then \n // go back to the start along the same path\n\n\n // if the start is not the end of the patrol then go backwards along the patrol\n if (JSON.stringify(path.points[0].point) !== JSON.stringify(path.points[path.points.length-1].point)) {\n for (const point of [...path.points].reverse().slice(1)) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n\n const secondPoint = path.points[1]\n objects.current.path.push({ ...secondPoint, aimOnly: true })\n }\n }\n objects.runCommand = true\n }"
},
{
"id": "lift",
"isA": [
"verb"
],
"bridge": "{\n ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"object"
],
"semantic": "({api}) => {\n api.armAction('up')\n }"
},
{
"id": "lower",
"isA": [
"verb"
],
"bridge": "{\n ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"object"
],
"semantic": "({api}) => {\n api.armAction('down')\n }"
},
{
"id": "open",
"isA": [
"verb"
],
"bridge": "{\n ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"object"
],
"semantic": "({api}) => {\n api.clawAction('open')\n }"
},
{
"id": "close",
"isA": [
"verb"
],
"bridge": "{\n ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]\n }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"object"
],
"semantic": "({api}) => {\n api.clawAction('close')\n }"
},
{
"id": "back",
"isA": [
"noun"
],
"semantic": "async ({objects, api, e, context, say}) => {\n await api.back()\n }"
},
{
"id": "forth",
"isA": [
"noun"
]
},
{
"id": "toPoint",
"isA": [
"preposition"
],
"after": [
[
"propertyOf",
1
]
],
"bridge": "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"point"
],
"semantic": "async ({objects, api, e, context}) => {\n objects.runCommand = true\n const point = await e(context.point)\n objects.current.path.push(point.evalue)\n }"
},
{
"id": "go",
"level": 0,
"isA": [
"verb",
"repeatable",
"doAction"
],
"words": [
{
"form": "infinitive",
"word": "go",
"tense": "infinitive",
"aspect": null,
"number": "none",
"person": "none"
},
{
"form": "finite",
"word": "go",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "first"
},
{
"form": "finite",
"word": "go",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "second"
},
{
"form": "finite",
"word": "goes",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "third"
},
{
"form": "finite",
"word": "go",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "first"
},
{
"form": "finite",
"word": "go",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "second"
},
{
"form": "finite",
"word": "go",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "third"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "first"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "second"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "third"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "first"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "second"
},
{
"form": "finite",
"word": "went",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "third"
},
{
"form": "pastParticiple",
"word": "gone",
"tense": "perfect",
"aspect": "perfect",
"number": "none",
"person": "none"
},
{
"form": "presentParticiple",
"word": "going",
"tense": "progressive",
"aspect": "continuous",
"number": "none",
"person": "none"
}
],
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"direction",
"distance",
"to",
"points"
],
"bridge": "{ \n ...next(operator), \n distance: distance?, \n direction: direction?,\n points: points?,\n to: to?,\n operator: operator,\n interpolate: append(default(operator.interpolate, [{ property: 'operator' }]), [{ property: 'direction' }, { property: 'points' }, { property: 'to' }, { property: 'distance' }])\n }",
"selector": {
"arguments": {
"distance": "(@<= 'quantity' && context.unit.dimension == 'length')",
"direction": "(@<= 'direction')",
"to": "(@<= 'toPoint')",
"points": "(@<= 'point')"
}
},
"semantic": "async (args) => {\n const {api, toFinalValue, context, objects, e, toArray, toEValue} = args\n if (context.distance) {\n await handleDistance(args, context.distance)\n }\n if (context.direction) {\n const array = toArray(context.direction)\n if (array.length == 2 && array[0].marker == 'back' && array[1].marker == 'forth') {\n await args.api.backAndForth()\n } else if (context.direction.marker == 'back') {\n await args.api.back(context.points)\n } else {\n objects.current.direction = context.direction.marker\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n if (context.to) {\n const evaluation = await e(context.to.point)\n const point = toEValue(evaluation)\n objects.current.path.push(point)\n }\n objects.runCommand = true\n await api.sendCommand()\n }"
},
{
"id": "turn",
"isA": [
"verb",
"action",
"repeatable"
],
"before": [
"thenAction"
],
"words": [
"turn"
],
"bridge": "{ \n ...next(operator), \n direction: direction, \n operator: operator,\n angle: angle?,\n interpolate: append(default(operator.interpolate, [{ property: 'operator'}]), [{ property: 'direction' }, { property: 'angle' }])\n }\n ",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"direction",
"angle"
],
"selector": {
"arguments": {
"direction": "(@<= 'direction')",
"repeats": "(@<= 'timeRepeats')",
"angle": "(@<= 'quantity' && context.unit.dimension == 'angle')"
}
},
"semantic": "async ({context, fragments, objects, e, s, api, say, toFinalValue}) => {\n const current = objects.current\n current.direction = context.direction.marker\n if (context.repeats) {\n current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n async function toRadians(angle) {\n const fi = await fragments(\"40 degrees in radians\")\n return await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'from']),\n apply: ({context}) => {\n Object.assign(context, angle)\n }\n }\n ])\n }\n if (context.angle) {\n const instantiation = await toRadians(context.angle)\n try {\n const result = await e(instantiation)\n current.turnAngle = toFinalValue(result.evalue.amount)\n objects.runCommand = true\n } catch (e) {\n say(`Don't know how to interpret ${await gp(context.angle)} in radians`)\n return\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n current.justTurn = true\n objects.runCommand = true\n await api.sendCommand()\n }"
},
{
"id": "pause",
"isA": [
"verb"
],
"words": [
{
"form": "infinitive",
"word": "pause",
"tense": "infinitive",
"aspect": null,
"number": "none",
"person": "none"
},
{
"form": "finite",
"word": "pause",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "first"
},
{
"form": "finite",
"word": "pause",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "second"
},
{
"form": "finite",
"word": "pauses",
"tense": "present",
"aspect": "simple",
"number": "singular",
"person": "third"
},
{
"form": "finite",
"word": "pause",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "first"
},
{
"form": "finite",
"word": "pause",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "second"
},
{
"form": "finite",
"word": "pause",
"tense": "present",
"aspect": "simple",
"number": "plural",
"person": "third"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "first"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "second"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "singular",
"person": "third"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "first"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "second"
},
{
"form": "finite",
"word": "paused",
"tense": "past",
"aspect": "simple",
"number": "plural",
"person": "third"
},
{
"form": "pastParticiple",
"word": "paused",
"tense": "perfect",
"aspect": "perfect",
"number": "none",
"person": "none"
},
{
"form": "presentParticiple",
"word": "pausing",
"tense": "progressive",
"aspect": "continuous",
"number": "none",
"person": "none"
}
],
"bridge": "{ ...next(operator), timeAtPoint: timeAtPoint?, time: or(time?, forTime?), operator: operator, atPoint: atPoint?, interpolate: [{ property: 'operator' }, { property: 'time' }, { property: 'forTime' }, { property: 'atPoint' }, { property: 'timeAtPoint' } ] }",
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"timeAtPoint"
],
"selector": {
"arguments": {
"forTime": "(@<= 'forQuantity' && context.quantity.unit.dimension == 'time')",
"time": "(@<= 'quantity' && context.unit.dimension == 'time')",
"atPoint": "(@<= 'atPoint')",
"timeAtPoint": "(@<= 'timeAtPoint')"
}
},
"semantic": "async ({context, remember, api, e, fragments, toFinalValue}) => {\n let time = context.time \n if (!time) {\n return\n }\n if (time.marker == 'forQuantity') {\n time = time.quantity\n }\n const instantiation = await fragments(\"quantity in seconds\", { quantity: time})\n const result = await e(instantiation)\n const seconds = toFinalValue(toFinalValue(result).amount)\n context.pauseSeconds = seconds\n remember(context)\n api.pause(seconds)\n }"
},
{
"id": "pause",
"level": 1,
"bridge": "{ ...repeatable, pause: operator, checks: append(repeatable.checks, ['pause']), repeatable: repeatable, interpolate: [{ property: 'repeatable' }, { property: 'pause', byPosition: true }] }",
"selector": {
"loose": "repeatable",
"arguments": {
"repeatable": "(@<= 'repeatable')"
}
},
"check": [
"marker",
"text",
"verbatim",
"value",
"evalue",
"isResponse",
{
"properties": "modifiers"
},
{
"properties": "postModifiers"
},
"repeatable",
"repeats"
]
},
{
"id": "stop",
"isA": [
"verb"
],
"optional": {
"1": "{ marker: 'drone' }"
},
"bridge": "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
"semantic": "async ({context, objects, api, say}) => {\n await api.stop()\n await api.markCurrentPoint()\n }"
}
],
"generators": [
{
"match": "({context}) => context.marker == 'help' && !context.paraphrase && context.isResponse",
"apply": "() => ''"
},
{
"match": "({context}) => context.marker == 'point' && context.point",
"apply": "({context}) => `(${context.point.x.toFixed(2)}, ${context.point.y.toFixed(2)})`"
}
],
"semantics": [
{
"match": "({context}) => context.marker == 'doAction'",
"apply": "async ({context, fragments, e, s, toEValue, toFinalValue, objects}) => {\n await s({ ...context, marker: 'patrol', path: context.action})\n }"
},
{
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.instance) {\n return false\n }\n \n if (context.marker == 'path' || context.marker == 'this' || context.marker == 'that') {\n return true\n }\n }",
"apply": "async ({context, frameOfReference, toArray, fragments, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const pathComponents = toArray(await recall({ \n context: { marker: 'pathComponent' }, \n all: true,\n stopCondition: (context) => context.marker == 'startPath',\n }))\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.instance = true\n path.points = pathComponents.reverse()\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n\n _continue() // let the call pick the object out from the stm\n }"
},
{
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !context.evaluate || !contextHierarchy.under('call') || context.notUnderCall) {\n return false\n }\n \n if (context.marker == 'point' || context.marker == 'ordinal') {\n return true\n }\n }",
"apply": "async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const evaluated = await e({...context, notUnderCall: true})\n const pointsContext = toEValue(evaluated)\n const pathComponents = toArray(pointsContext)\n\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.instance = true\n path.points = [...pathComponents]\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n resolveEvaluate(context, path)\n }"
},
{
"match": "({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {\n const path = await recall({ context: context.objects[1] })\n if (!path?.points) {\n return\n }\n if (context.marker == 'start') {\n resolveEvaluate(context, path?.points[0])\n } else if (context.marker == 'end') {\n resolveEvaluate(context, path?.points[path?.points.length-1])\n }\n }"
},
{
"match": "({context, contextHierarchy}) => \n context.evaluate && \n ['start', 'end', 'point'].includes(context.marker) && \n !context.propertyOf && \n contextHierarchy.under('go') &&\n !contextHierarchy.under('call')",
"apply": "async ({gp, s, toArray, context, objects, fragments, resolveEvaluate, api, recall}) => {\n const path = await recall({ context: { marker: 'path' } })\n if (!path?.points) {\n return\n }\n \n if (context.marker == 'start') {\n resolveEvaluate(context, path?.points[0])\n } else if (context.marker == 'end') {\n resolveEvaluate(context, path?.points[path?.points.length-1])\n } else {\n const points = await recall({ context, frameOfReference: path })\n resolveEvaluate(context, toArray(points)[0])\n }\n }"
},
{
"match": "({context}) => context.marker == 'speed' && context.evaluate",
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n let value = objects.current.speed\n if (context.condition) {\n if (['highest', 'maximum'].includes(context.condition.marker)) {\n value = api.maximumSpeedDrone()\n } else if (['lowest', 'minimum'].includes(context.condition.marker)) {\n value = api.minimumSpeedDrone()\n }\n }\n const speed = await fragments(\"number meters per second\", { number: { marker: 'integer', value } })\n const preferred = await s({ marker: 'preferredUnits', quantity: speed }) \n resolveEvaluate(context, preferred.response || speed)\n }"
},
{
"match": "({context}) => ['direction', 'drone_direction'].includes(context.marker) && context.evaluate",
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n const value = objects.current.angleInRadians\n const fi = await fragments(\"number radians\")\n const direction = await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'amount']),\n apply: ({context}) => {\n Object.assign(context, { marker: 'number', value: value })\n }\n }\n ])\n const preferred = await s({ marker: 'preferredUnits', quantity: direction }) \n const sss = await gp(direction)\n resolveEvaluate(context, preferred.response || direction)\n }"
},
{
"match": "({context}) => context.marker == 'timeRepeats'",
"apply": "({context, objects, toFinalValue}) => {\n objects.current.timeRepeats = toFinalValue(context.repeats)\n }"
},
{
"match": "({context, toArray}) => {\n if (context.marker !== 'list') {\n return false\n }\n\n const array = toArray(context)\n if (array[0].marker == 'back' && array[1].marker == 'forth') {\n return true\n }\n }",
"apply": "async ({api}) => {\n await api.backAndForth()\n }"
}
]
}
],
"resultss": [
{
"hierarchy": [
[
"a",
"article",
false
],
[
"action",
"thisAble",
false
],
[
"adjective",
"adjective",
false
],
[
"all",
"quantifier",
false
],
[
"amount",
"concept",
false
],
[
"amount",
"hierarchyAble",
false
],
[
"amount",
"isEdee",
false
],
[
"amount",
"isEder",
false
],
[
"amount",
"object",
false
],
[
"amount",
"property",
false
],
[
"amount",
"queryable",
false
],
[
"amount",
"theAble",
false
],
[
"amount",
"thisAble",
false
],
[
"ampm",
"adjective",
false
],
[
"angle",
"dimension",
false
],
[
"angle",
"hierarchyAble",
false
],
[
"angle",
"isEdee",
false
],
[
"angle",
"isEder",
false
],
[
"angle",
"object",
false
],
[
"angle",
"property",
false
],
[
"angle",
"queryable",
false
],
[
"angle",
"theAble",
false
],
[
"angle",
"thisAble",
false
],
[
"article",
"article",
false
],
[
"ascending",
"hierarchyAble",
false
],
[
"ascending",
"isEdee",
false
],
[
"ascending",
"isEder",
false
],
[
"ascending",
"object",
false
],
[
"ascending",
"property",
false
],
[
"ascending",
"queryable",
false
],
[
"ascending",
"sort_ordering",
false
],
[
"ascending",
"theAble",
false
],
[
"ascending",
"thisAble",
false
],
[
"atTime",
"preposition",
false
],
[
"between",
"preposition",
false
],
[
"calculate",
"verb",
false
],
[
"call",
"verb",
false
],
[
"canBeDoQuestion",
"canBeDoQuestion",
false
],
[
"canBeQuestion",
"canBeQuestion",
false
],
[
"centimeter",
"hierarchyAble",
false
],
[
"centimeter",
"isEdee",
false
],
[
"centimeter",
"isEder",
false
],
[
"centimeter",
"metric_unit",
false
],
[
"centimeter",
"object",
false
],
[
"centimeter",
"property",
false
],
[
"centimeter",
"queryable",
false
],
[
"centimeter",
"theAble",
false
],
[
"centimeter",
"thisAble",
false
],
[
"centimeter",
"unit_length",
false
],
[
"comparable",
"theAble",
false
],
[
"compass",
"direction_modifier",
false
],
[
"compass",
"hierarchyAble",
false
],
[
"compass",
"isEdee",
false
],
[
"compass",
"isEder",
false
],
[
"compass",
"object",
false
],
[
"compass",
"property",
false
],
[
"compass",
"queryable",
false
],
[
"compass",
"theAble",
false
],
[
"compass_direction",
"adjective",
true
],
[
"compass_direction",
"concept",
false
],
[
"compass_direction",
"direction",
false
],
[
"compass_direction",
"hierarchyAble",
false
],
[
"compass_direction",
"isEdee",
false
],
[
"compass_direction",
"isEder",
false
],
[
"compass_direction",
"object",
false
],
[
"compass_direction",
"property",
false
],
[
"compass_direction",
"queryable",
false
],
[
"compass_direction",
"theAble",
false
],
[
"concept",
"queryable",
false
],
[
"concept",
"theAble",
false
],
[
"condition",
"concept",
false
],
[
"condition",
"hierarchyAble",
false
],
[
"condition",
"isEdee",
false
],
[
"condition",
"isEder",
false
],
[
"condition",
"object",
false
],
[
"condition",
"property",
false
],
[
"condition",
"queryable",
false
],
[
"condition",
"theAble",
false
],
[
"condition",
"thisAble",
false
],
[
"convertToUnits",
"expression",
false
],
[
"convertToUnits",
"queryable",
false
],
[
"convertToUnits",
"testingValue",
false
],
[
"countable",
"hierarchyAble",
false
],
[
"degree",
"hierarchyAble",
false
],
[
"degree",
"isEdee",
false
],
[
"degree",
"isEder",
false
],
[
"degree",
"object",
false
],
[
"degree",
"property",
false
],
[
"degree",
"queryable",
false
],
[
"degree",
"theAble",
false
],
[
"degree",
"thisAble",
false
],
[
"degree",
"unit_angle",
false
],
[
"delayTime",
"action",
false
],
[
"delayTime",
"preposition",
false
],
[
"deletable",
"deletable",
false
],
[
"delete",
"verb",
false
],
[
"descending",
"hierarchyAble",
false
],
[
"descending",
"isEdee",
false
],
[
"descending",
"isEder",
false
],
[
"descending",
"object",
false
],
[
"descending",
"property",
false
],
[
"descending",
"queryable",
false
],
[
"descending",
"sort_ordering",
false
],
[
"descending",
"theAble",
false
],
[
"descending",
"thisAble",
false
],
[
"dimension",
"concept",
false
],
[
"dimension",
"hierarchyAble",
false
],
[
"dimension",
"isEdee",
false
],
[
"dimension",
"isEder",
false
],
[
"dimension",
"object",
false
],
[
"dimension",
"property",
false
],
[
"dimension",
"queryable",
false
],
[
"dimension",
"theAble",
false
],
[
"dimension",
"thisAble",
false
],
[
"direction",
"concept",
false
],
[
"direction",
"hierarchyAble",
false
],
[
"direction",
"isEdee",
false
],
[
"direction",
"isEder",
false
],
[
"direction",
"object",
false
],
[
"direction",
"property",
false
],
[
"direction",
"queryable",
false
],
[
"direction",
"theAble",
false
],
[
"direction_modifier",
"adjective",
false
],
[
"distributable",
"queryable",
false
],
[
"divideByExpression",
"mathematicalExpression",
false
],
[
"divideByOperator",
"mathematical_operator",
false
],
[
"doAction",
"repeatable",
false
],
[
"doAction",
"verb",
false
],
[
"doubleQuote",
"queryable",
false
],
[
"each",
"article",
false
],
[
"east",
"compass_direction",
false
],
[
"east",
"hierarchyAble",
false
],
[
"east",
"isEdee",
false
],
[
"east",
"isEder",
false
],
[
"east",
"object",
false
],
[
"east",
"property",
false
],
[
"east",
"queryable",
false
],
[
"east",
"theAble",
false
],
[
"east",
"thisAble",
false
],
[
"event",
"event",
false
],
[
"every",
"article",
false
],
[
"expression",
"expression",
false
],
[
"foot",
"hierarchyAble",
false
],
[
"foot",
"imperial_unit",
false
],
[
"foot",
"isEdee",
false
],
[
"foot",
"isEder",
false
],
[
"foo