UNPKG

tpmkms

Version:

Reusable libraries for Entodicton, a natural language to json converter

1,710 lines 39.4 kB
{ "configs": [ "mathematical modifies operator", { "name": "math", "operators": [ "([mathematicalExpression])", "([mathematical_operator])", "((number/* || mathematicalExpression/*) [plusOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [minusOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [timesOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [divideByOperator|] (number/* || mathematicalExpression/*))", "([plusExpression|])", "([minusExpression|])", "([timesExpression|])", "([divideByExpression|])", { "pattern": "([x])", "scope": "testing" }, { "pattern": "([y])", "scope": "testing" } ], "bridges": [ { "id": "mathematicalExpression", "isA": [ "concept" ] }, { "id": "mathematical_operator", "before": [ "verb" ], "after": [ "adjective" ] }, { "id": "x", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "scope": "testing" }, { "id": "y", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "scope": "testing" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "plusOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('plusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "plus", "+" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "plusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "minusOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('minusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "minus", "-" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "minusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "timesOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('timesExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "times", "*" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "timesExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "divideByOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('divideByExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "/" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "divideByExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "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 }" } ] } ], "resultss": [ { "hierarchy": [ [ "a", "article", false ], [ "adjective", "adjective", false ], [ "all", "quantifier", 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 ], [ "between", "preposition", false ], [ "canBeDoQuestion", "canBeDoQuestion", false ], [ "canBeQuestion", "canBeQuestion", false ], [ "comparable", "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 ], [ "countable", "hierarchyAble", 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 ], [ "distributable", "queryable", false ], [ "doubleQuote", "queryable", false ], [ "each", "article", false ], [ "every", "article", false ], [ "hasCountOfPieces", "countable", false ], [ "have", "canBeDoQuestion", false ], [ "have", "canBeQuestion", false ], [ "hierarchyAble", "queryable", false ], [ "highest", "hierarchyAble", false ], [ "highest", "isEdee", false ], [ "highest", "isEder", false ], [ "highest", "object", false ], [ "highest", "property", false ], [ "highest", "queryable", false ], [ "highest", "superlative", false ], [ "highest", "theAble", false ], [ "highest", "thisAble", false ], [ "ifAble", "ifAble", false ], [ "integer", "number", false ], [ "is", "canBeQuestion", false ], [ "is", "verb", false ], [ "isEdee", "isEdee", false ], [ "isEder", "isEder", false ], [ "isQuery", "verb", false ], [ "it", "pronoun", false ], [ "it", "queryable", false ], [ "it", "thisitthat", false ], [ "it", "toAble", false ], [ "listable", "theAble", false ], [ "lowest", "hierarchyAble", false ], [ "lowest", "isEdee", false ], [ "lowest", "isEder", false ], [ "lowest", "object", false ], [ "lowest", "property", false ], [ "lowest", "queryable", false ], [ "lowest", "superlative", false ], [ "lowest", "theAble", false ], [ "lowest", "thisAble", false ], [ "maximum", "hierarchyAble", false ], [ "maximum", "isEdee", false ], [ "maximum", "isEder", false ], [ "maximum", "object", false ], [ "maximum", "property", false ], [ "maximum", "queryable", false ], [ "maximum", "superlative", false ], [ "maximum", "theAble", false ], [ "maximum", "thisAble", false ], [ "memorable", "deletable", false ], [ "memorable", "theAble", false ], [ "minimum", "hierarchyAble", false ], [ "minimum", "isEdee", false ], [ "minimum", "isEder", false ], [ "minimum", "object", false ], [ "minimum", "property", false ], [ "minimum", "queryable", false ], [ "minimum", "superlative", false ], [ "minimum", "theAble", false ], [ "minimum", "thisAble", false ], [ "modifies", "verb", false ], [ "negatable", "queryable", false ], [ "noun", "theAble", false ], [ "noun", "thisAble", false ], [ "number", "quantifier", false ], [ "number", "queryable", false ], [ "object", "listable", false ], [ "object", "queryable", false ], [ "object", "theAble", false ], [ "orAble", "ifAble", false ], [ "ordering", "concept", false ], [ "ordering", "hierarchyAble", false ], [ "ordering", "isEdee", false ], [ "ordering", "isEder", false ], [ "ordering", "object", false ], [ "ordering", "property", false ], [ "ordering", "queryable", false ], [ "ordering", "theAble", false ], [ "ordering_modifier", "adjective", false ], [ "preposition", "preposition", false ], [ "pronoun", "pronoun", false ], [ "property", "queryable", false ], [ "property", "theAble", false ], [ "propertyOf", "preposition", false ], [ "punctuation", "punctuation", false ], [ "quantifier", "quantifier", false ], [ "queryable", "listable", false ], [ "questionMark", "punctuation", false ], [ "readonly", "queryable", false ], [ "reason", "queryable", false ], [ "reason", "theAble", false ], [ "recall", "verb", false ], [ "remember", "verb", false ], [ "sort", "hierarchyAble", false ], [ "sort", "isEdee", false ], [ "sort", "isEder", false ], [ "sort", "object", false ], [ "sort", "ordering_modifier", false ], [ "sort", "property", false ], [ "sort", "queryable", false ], [ "sort", "theAble", false ], [ "sortOrdering", "adjective", false ], [ "sort_ordering", "adjective", true ], [ "sort_ordering", "concept", false ], [ "sort_ordering", "hierarchyAble", false ], [ "sort_ordering", "isEdee", false ], [ "sort_ordering", "isEder", false ], [ "sort_ordering", "object", false ], [ "sort_ordering", "ordering", false ], [ "sort_ordering", "property", false ], [ "sort_ordering", "queryable", false ], [ "sort_ordering", "theAble", false ], [ "stm_before", "adjective", false ], [ "stm_current", "adjective", false ], [ "stm_previous", "adjective", false ], [ "superlative", "condition", false ], [ "superlative", "hierarchyAble", false ], [ "superlative", "isEdee", false ], [ "superlative", "isEder", false ], [ "superlative", "object", false ], [ "superlative", "property", false ], [ "superlative", "queryable", false ], [ "superlative", "theAble", false ], [ "superlative", "thisAble", false ], [ "that", "thisitthat", false ], [ "the", "article", false ], [ "theAble", "queryable", false ], [ "this", "pronoun", false ], [ "this", "queryable", false ], [ "this", "thisitthat", false ], [ "thisAble", "thisAble", false ], [ "thisitthat", "queryable", false ], [ "to", "preposition", false ], [ "toAble", "toAble", false ], [ "type", "property", false ], [ "type", "whatAble", false ], [ "unknown", "hierarchyAble", false ], [ "verb", "verb", false ], [ "what", "object", false ], [ "what", "queryable", false ], [ "whatAble", "queryable", false ], [ "whose", "object", false ], [ "xfx", "queryable", false ] ], "metadata": { "opChoices": [ { "op": [ "unknown", 0 ], "ops": [ [ "modifies", 0 ], [ "unknown", 0 ], [ "unknown", 0 ] ], "counter": 1 }, { "op": [ "unknown", 0 ], "ops": [ [ "modifies", 0 ], [ "unknown", 0 ] ], "counter": 2 }, { "op": [ "modifies", 0 ], "ops": [ [ "modifies", 0 ] ], "counter": 3 } ] }, "trace": "undefined", "contexts": [ { "word": "modifies", "number": "one", "flatten": false, "text": "mathematical modifies operator", "marker": "modifies", "range": { "start": 0, "end": 29 }, "dead": true, "conceptModifiers": [ { "value": "mathematical", "unknown": true, "text": "mathematical", "marker": "unknown", "word": "mathematical", "range": { "start": 0, "end": 11 }, "dead": true, "level": 0 } ], "concept": { "value": "operator", "unknown": true, "text": "operator", "marker": "unknown", "word": "operator", "range": { "start": 22, "end": 29 }, "dead": true, "level": 0 }, "level": 1, "context_index": 1, "topLevel": true, "context_id": 2, "touchedBy": [ "math#call2" ] } ], "generated": [ "" ], "paraphrases": [ "mathematical modifies operator" ], "paraphrasesParenthesized": [], "generatedParenthesized": [], "responses": [ "" ], "associations": [ [ [ "modifies", 0 ], [ "unknown", 0 ] ] ], "summaries": [ { "summaries": [ { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 1 }, { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 2 }, { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 3 }, { "operators": [ { "marker": [ "modifies", 1 ], "range": { "start": 0, "end": 29 } } ], "counter": 4 } ], "length": 1 } ], "learned_contextual_priorities": [], "rtf_associations": [], "query": "mathematical modifies operator", "key": { "query": "mathematical modifies operator" } }, { "extraConfig": true, "name": "math", "operators": [ "([mathematicalExpression])", "([mathematical_operator])", "((number/* || mathematicalExpression/*) [plusOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [minusOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [timesOperator] (number/* || mathematicalExpression/*))", "((number/* || mathematicalExpression/*) [divideByOperator|] (number/* || mathematicalExpression/*))", "([plusExpression|])", "([minusExpression|])", "([timesExpression|])", "([divideByExpression|])", { "pattern": "([x])", "scope": "testing" }, { "pattern": "([y])", "scope": "testing" } ], "bridges": [ { "id": "mathematicalExpression", "isA": [ "concept" ] }, { "id": "mathematical_operator", "before": [ "verb" ], "after": [ "adjective" ] }, { "id": "x", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "scope": "testing" }, { "id": "y", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "scope": "testing" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "plusOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('plusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "plus", "+" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "plusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "minusOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('minusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "minus", "-" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "minusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "timesOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('timesExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "times", "*" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "timesExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:33", "id": "divideByOperator", "level": 0, "bridge": "{ ...next(operator), operator: operator, marker: next(operator('divideByExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true, interpolate: [{ property: 'x' }, { property: 'operator' }, { property: 'y' }] }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "/" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:45", "id": "divideByExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] } ] } ], "fragments": [], "semantics": [], "associations": [ [ [ "modifies", 0 ], [ "unknown", 0 ] ] ], "summaries": [ { "summaries": [ { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 1 }, { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 2 }, { "operators": [ { "marker": [ "unknown", 0 ], "range": { "start": 0, "end": 11 } }, { "marker": [ "modifies", 0 ], "range": { "start": 13, "end": 20 } }, { "marker": [ "unknown", 0 ], "range": { "start": 22, "end": 29 } } ], "counter": 3 }, { "operators": [ { "marker": [ "modifies", 1 ], "range": { "start": 0, "end": 29 } } ], "counter": 4 } ], "length": 1 } ], "learned_contextual_priorities": [] }