UNPKG

tpmkms

Version:

Reusable libraries for Entodicton, a natural language to json converter

1,415 lines 33.3 kB
{ "configs": [ "mathematical modifies operator", { "name": "math", "operators": [ "([mathematicalExpression])", "([mathematical_operator])", "(([number|]) [plusOperator] ([number|]))", "(([number|]) [minusOperator] ([number|]))", "(([number|]) [timesOperator] ([number|]))", "(([number|]) [divideByOperator|] ([number|]))", "([plusExpression|])", "([minusExpression|])", "([timesExpression|])", "([divideByExpression|])", { "pattern": "([x])", "development": true }, { "pattern": "([y])", "development": true } ], "bridges": [ { "id": "mathematicalExpression", "isA": [ "concept", "number" ] }, { "id": "mathematical_operator", "before": [ "verb" ], "after": [ "adjective" ] }, { "id": "x", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "development": true }, { "id": "y", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "development": true }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "plusOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "plus", "+" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "id": "plusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`", "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "minusOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "minus", "-" ], "generatorp": "({context}) => context.word" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "id": "minusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`", "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "timesOperator", "level": 0, "bridge": "{ ...next(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 }", "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:44", "id": "timesExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`", "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 }" }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "divideByOperator", "level": 0, "bridge": "{ ...next(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 }", "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:44", "id": "divideByExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ], "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`", "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 }" } ] } ], "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 ], [ "between", "preposition", false ], [ "canBeDoQuestion", "canBeDoQuestion", false ], [ "canBeQuestion", "canBeQuestion", false ], [ "comparable", "theAble", false ], [ "concept", "queryable", false ], [ "concept", "theAble", false ], [ "condition", "condition", false ], [ "countable", "hierarchyAble", 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 ], [ "distributable", "queryable", false ], [ "doubleQuote", "queryable", false ], [ "each", "article", false ], [ "evaluate", "verb", false ], [ "every", "article", false ], [ "hasCountOfPieces", "countable", false ], [ "have", "canBeDoQuestion", false ], [ "have", "canBeQuestion", false ], [ "hierarchyAble", "queryable", false ], [ "highest", "condition", 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", "condition", false ], [ "memorable", "theAble", false ], [ "modifies", "verb", false ], [ "negatable", "queryable", false ], [ "noun", "theAble", 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 ], [ "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 ], [ "that", "thisitthat", false ], [ "the", "article", false ], [ "theAble", "queryable", false ], [ "this", "pronoun", false ], [ "this", "queryable", false ], [ "this", "thisitthat", 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, "modifiers": [ { "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": [], "query": "mathematical modifies operator", "key": { "query": "mathematical modifies operator" } }, { "extraConfig": true, "name": "math", "operators": [ "([mathematicalExpression])", "([mathematical_operator])", "(([number|]) [plusOperator] ([number|]))", "(([number|]) [minusOperator] ([number|]))", "(([number|]) [timesOperator] ([number|]))", "(([number|]) [divideByOperator|] ([number|]))", "([plusExpression|])", "([minusExpression|])", "([timesExpression|])", "([divideByExpression|])", { "pattern": "([x])", "development": true }, { "pattern": "([y])", "development": true } ], "bridges": [ { "id": "mathematicalExpression", "isA": [ "concept", "number" ] }, { "id": "mathematical_operator", "before": [ "verb" ], "after": [ "adjective" ] }, { "id": "x", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "development": true }, { "id": "y", "isA": [ "number" ], "level": 0, "bridge": "{ ...next(operator) }", "development": true }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "plusOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "plus", "+" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "id": "plusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "minusOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "minus", "-" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "id": "minusExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "timesOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "times", "*" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "id": "timesExpression", "level": 0, "bridge": "{ ...next(operator) }", "isA": [ "mathematicalExpression" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32", "id": "divideByOperator", "level": 0, "bridge": "{ ...next(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 }", "isA": [ "mathematical_operator" ], "before": [ [ "plusOperator", 0 ], [ "minusOperator", 0 ] ], "localHierarchy": [ [ "unknown", "number" ] ], "words": [ "/" ] }, { "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44", "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": [] }