UNPKG

tpmkms

Version:

Reusable libraries for Entodicton, a natural language to json converter

473 lines 16 kB
{ "configs": [ { "apply": "({config}) => {\n config.addArgs(({config, api, isA}) => ({\n addLatinNoun: ({ id, nominative, genetive, development }) => {\n config.addOperator({ pattern: `([${id}|])`, development: development })\n config.addBridge({ id, isA: ['hierarchiable'] })\n const declensions = getDeclensions(nominative, genetive)\n for (const declension of declensions) {\n config.addWord(declension.word, { id, initial: { ...declension, development } })\n }\n }\n }))\n }" }, { "apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus', scope: \"testing\" })\n addLatinNoun({ id: 'titus_person', nominative: 'titus', scope: \"testing\" })\n addLatinNoun({ id: 'pear_food', nominative: 'pirum', scope: \"testing\" })\n addLatinNoun({ id: 'table_latin', nominative: 'mensa', scope: \"testing\" })\n }" }, { "operators": [ "((hierarchy/*) [queryMarker|ne])", "([hierarchiable])", "((hierarchiable) [hierarchy|] (hierarchiable))", "((hierarchiable) (hierarchiable) [hierarchy|])", "([hierarchy|] (hierarchiable) (hierarchiable))", "(x [list|et] y)", "((listable/*) [listMarker|que])" ], "bridges": [ { "id": "inLatin", "words": [ "in" ], "before": [ "iacere" ], "bridge": "{ ...next(operator), declension: 'inLatin', object: object, operator: operator, interpolate: [{ property: 'operator' }, { property: 'object' }] }", "selector": { "ordinals": [ 1 ], "arguments": { "object": "(context.declension == 'accusative' || context.declension == 'ablative')" } } }, { "id": "iacere", "level": 0, "words": [ { "word": "iacio", "number": "singular", "person": "first" }, { "word": "iacis", "number": "singular", "person": "second" }, { "word": "iacit", "number": "singular", "person": "third" }, { "word": "iacimus", "number": "plural", "person": "first" }, { "word": "iacitis", "number": "plural", "person": "second" }, { "word": "iaciunt", "number": "plural", "person": "third" } ], "bridge": "{ ...next(operator), thrower: nominative?, receiver: dative?, object: object?, location: location?, interpolate: [{ property: 'thrower' }, { property: 'receiver' }, { property: 'location' }, { property: 'object' }, { context: operator }] }", "selector": { "arguments": { "nominative": "(context.declension == 'nominative' && context.number == operator.number)", "dative": "(context.declension == 'dative')", "object": "(context.declension == 'accusative')", "location": "(context.declension == 'inLatin')" } } }, { "id": "dare", "level": 0, "bridge": "{ ...next(operator), giver: nominative?, receiver: dative?, object: accusative?, interpolate: [{ property: 'giver' }, { property: 'receiver' }, { property: 'object' }, { context: operator }] }", "selector": { "arguments": { "nominative": "(context.declension == 'nominative' && context.number == operator.number)", "dative": "(context.declension == 'dative')", "accusative": "(context.declension == 'accusative')" } }, "words": [ { "word": "do", "number": "singular", "person": "first" }, { "word": "das", "number": "singular", "person": "second" }, { "word": "dat", "number": "singular", "person": "third" }, { "word": "damus", "number": "plural", "person": "first" }, { "word": "datis", "number": "plural", "person": "second" }, { "word": "dant", "number": "plural", "person": "third" } ] }, { "id": "list", "level": 0, "selector": { "match": "same", "left": [ { "pattern": "($type && context.instance == variables.instance)" } ], "right": [ { "pattern": "($type && context.instance == variables.instance)" } ], "passthrough": true }, "bridge": "{ ...next(operator), listable: true, isList: true, value: append(before, after), operator: operator, interpolate: [ { separator: 'operator', values: 'value' } ] }" }, { "id": "list", "level": 1, "selector": { "match": "same", "left": [ { "pattern": "($type && context.instance == variables.instance)" } ], "passthrough": true }, "bridge": "{ ...operator, value: append(before, operator.value) }" }, { "id": "queryMarker", "bridge": "{ ...before[0], verb: before[0], interpolate: [{ context: before[0] }, '', { context: operator }], question: true }", "separators": "|", "before": [ "hierarchy" ] }, { "id": "listMarker", "localHierarchy": [ [ "unknown", "listable" ] ], "bridge": "{ ...before[0], verb: before[0], interpolate: [{ context: before[0] }, '', { context: operator }], isList: true }", "separators": "|" }, { "id": "hierarchiable" }, { "id": "hierarchy", "localHierarchy": [ [ "unknown", "hierarchiable" ] ], "bridge": "{ ...next(operator), child: arguments[0], parent: arguments[1], question: less_than(indexes.operator, indexes.arguments[0]), interpolate: map(all, { context: element }) }", "words": [ { "word": "sum", "number": "singular", "person": "first" }, { "word": "es", "number": "singular", "person": "second" }, { "word": "est", "number": "singular", "person": "third" }, { "word": "sumus", "number": "plural", "person": "first" }, { "word": "estis", "number": "plural", "person": "second" }, { "word": "sunt", "number": "plural", "person": "third" } ] } ], "semantics": [ { "match": "({context}) => context.marker == 'unknown'", "apply": "({context, config, addWord}) => {\n const id = context.word\n const word = context.word\n config.addWord(word, { id, value: id })\n config.addOperator(`([${id}|])`)\n config.addBridge({ id, isA: ['hierarchiable'] })\n }" } ] }, { "apply": "({addSuffix}) => addSuffix('que')" } ], "resultss": [ { "apply": "({config}) => {\n config.addArgs(({config, api, isA}) => ({\n addLatinNoun: ({ id, nominative, genetive, development }) => {\n config.addOperator({ pattern: `([${id}|])`, development: development })\n config.addBridge({ id, isA: ['hierarchiable'] })\n const declensions = getDeclensions(nominative, genetive)\n for (const declension of declensions) {\n config.addWord(declension.word, { id, initial: { ...declension, development } })\n }\n }\n }))\n }" }, { "apply": "({addLatinNoun}) => {\n addLatinNoun({ id: 'davus_person', nominative: 'davus', scope: \"testing\" })\n addLatinNoun({ id: 'titus_person', nominative: 'titus', scope: \"testing\" })\n addLatinNoun({ id: 'pear_food', nominative: 'pirum', scope: \"testing\" })\n addLatinNoun({ id: 'table_latin', nominative: 'mensa', scope: \"testing\" })\n }" }, { "extraConfig": true, "operators": [ "((hierarchy/*) [queryMarker|ne])", "([hierarchiable])", "((hierarchiable) [hierarchy|] (hierarchiable))", "((hierarchiable) (hierarchiable) [hierarchy|])", "([hierarchy|] (hierarchiable) (hierarchiable))", "(x [list|et] y)", "((listable/*) [listMarker|que])" ], "bridges": [ { "id": "inLatin", "words": [ "in" ], "before": [ "iacere" ], "bridge": "{ ...next(operator), declension: 'inLatin', object: object, operator: operator, interpolate: [{ property: 'operator' }, { property: 'object' }] }", "selector": { "ordinals": [ 1 ], "arguments": { "object": "(context.declension == 'accusative' || context.declension == 'ablative')" } } }, { "id": "iacere", "level": 0, "words": [ { "word": "iacio", "number": "singular", "person": "first" }, { "word": "iacis", "number": "singular", "person": "second" }, { "word": "iacit", "number": "singular", "person": "third" }, { "word": "iacimus", "number": "plural", "person": "first" }, { "word": "iacitis", "number": "plural", "person": "second" }, { "word": "iaciunt", "number": "plural", "person": "third" } ], "bridge": "{ ...next(operator), thrower: nominative?, receiver: dative?, object: object?, location: location?, interpolate: [{ property: 'thrower' }, { property: 'receiver' }, { property: 'location' }, { property: 'object' }, { context: operator }] }", "selector": { "arguments": { "nominative": "(context.declension == 'nominative' && context.number == operator.number)", "dative": "(context.declension == 'dative')", "object": "(context.declension == 'accusative')", "location": "(context.declension == 'inLatin')" } } }, { "id": "dare", "level": 0, "bridge": "{ ...next(operator), giver: nominative?, receiver: dative?, object: accusative?, interpolate: [{ property: 'giver' }, { property: 'receiver' }, { property: 'object' }, { context: operator }] }", "selector": { "arguments": { "nominative": "(context.declension == 'nominative' && context.number == operator.number)", "dative": "(context.declension == 'dative')", "accusative": "(context.declension == 'accusative')" } }, "words": [ { "word": "do", "number": "singular", "person": "first" }, { "word": "das", "number": "singular", "person": "second" }, { "word": "dat", "number": "singular", "person": "third" }, { "word": "damus", "number": "plural", "person": "first" }, { "word": "datis", "number": "plural", "person": "second" }, { "word": "dant", "number": "plural", "person": "third" } ] }, { "id": "list", "level": 0, "selector": { "match": "same", "left": [ { "pattern": "($type && context.instance == variables.instance)" } ], "right": [ { "pattern": "($type && context.instance == variables.instance)" } ], "passthrough": true }, "bridge": "{ ...next(operator), listable: true, isList: true, value: append(before, after), operator: operator, interpolate: [ { separator: 'operator', values: 'value' } ] }" }, { "id": "list", "level": 1, "selector": { "match": "same", "left": [ { "pattern": "($type && context.instance == variables.instance)" } ], "passthrough": true }, "bridge": "{ ...operator, value: append(before, operator.value) }" }, { "id": "queryMarker", "bridge": "{ ...before[0], verb: before[0], interpolate: [{ context: before[0] }, '', { context: operator }], question: true }", "separators": "|", "before": [ "hierarchy" ] }, { "id": "listMarker", "localHierarchy": [ [ "unknown", "listable" ] ], "bridge": "{ ...before[0], verb: before[0], interpolate: [{ context: before[0] }, '', { context: operator }], isList: true }", "separators": "|" }, { "id": "hierarchiable" }, { "id": "hierarchy", "localHierarchy": [ [ "unknown", "hierarchiable" ] ], "bridge": "{ ...next(operator), child: arguments[0], parent: arguments[1], question: less_than(indexes.operator, indexes.arguments[0]), interpolate: map(all, { context: element }) }", "words": [ { "word": "sum", "number": "singular", "person": "first" }, { "word": "es", "number": "singular", "person": "second" }, { "word": "est", "number": "singular", "person": "third" }, { "word": "sumus", "number": "plural", "person": "first" }, { "word": "estis", "number": "plural", "person": "second" }, { "word": "sunt", "number": "plural", "person": "third" } ] } ], "semantics": [ {} ] }, { "apply": "({addSuffix}) => addSuffix('que')" } ], "fragments": [], "semantics": [], "associations": [], "summaries": [], "learned_contextual_priorities": [] }