ekms 9.8.0-beta.2 → 9.8.0-beta.4

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.
@@ -829,7 +829,7 @@
829
829
  },
830
830
  {
831
831
  "match": "({context}) => context.isEd",
832
- "apply": "async ({context, g}) => {\n const chosen = chooseNumber(context[context.afterTag], 'is', 'are')\n if (context[context.beforeTag].evalue && context[context.beforeTag].evalue.marker == 'answerNotKnown') {\n return await g(context[context.beforeTag])\n }\n return `${await g(context[context.afterTag])} ${chosen} ${context.word} by ${await g(context[context.beforeTag])}`\n }"
832
+ "apply": "async ({context, g}) => {\n const chosen = chooseNumber(context[context.afterTag], 'is', 'are')\n if (context[context.beforeTag].evalue && context[context.beforeTag].evalue.marker === 'undefined') {\n return await g(context[context.beforeTag])\n }\n return `${await g(context[context.afterTag])} ${chosen} ${context.word} by ${await g(context[context.beforeTag])}`\n }"
833
833
  },
834
834
  {
835
835
  "match": "({context}) => context.paraphrase && context.constrained",
@@ -880,25 +880,25 @@
880
880
  "apply": "async ({context, g, gs}) => {\n const base = { ...context }\n base.object = undefined;\n if (context.object.marker == 'objectPrefix') {\n return `${await g(context.object)} ${await g(base)}`\n } else {\n if (context.objects) {\n const gObjects = []\n for (const object of context.objects) {\n gObjects.push(await g({...object, paraphrase: true}))\n }\n return await gs(gObjects, ' of ')\n } else {\n // TODO make paraphrase be a default when paraphrasing?\n return `${await g(base)} of ${await g({...context.object, paraphrase: true})}`\n }\n }\n }"
881
881
  },
882
882
  {
883
- "match": "({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.possession && !context.evaluate && !context.object.marker == 'objectPrefix'",
883
+ "match": "({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.possession && context.paraphrase && !context.object.marker == 'objectPrefix'",
884
884
  "apply": "async ({context, g}) => {\n const property = Object.assign({}, context, { object: undefined })\n return `${await g(property)} of ${await g({ ...context.object, paraphrase: true })}`\n }"
885
885
  },
886
886
  {
887
887
  "match": "({context}) => !context.modifiers && (context.object || context.objects) && !context.interpolate",
888
- "apply": "async ({context, g, gs}) => {\n if (context.evalue) {\n return await g(context.evalue)\n } else if (context.objects) {\n const objects = [ ...context.objects ]\n objects.reverse()\n let phrase = ''\n let separator = ''\n for (let i = 0; i < objects.length-1; ++i) {\n phrase = phrase + separator + await g({...objects[i], paraphrase: context.paraphrase, possessive: true})\n separator = ' '\n }\n phrase = phrase + separator + await g({...objects[objects.length-1], paraphrase: context.paraphrase})\n return phrase\n } else {\n const base = { ...context }\n base.object = undefined; // TODO make paraphrase be a default when paraphrasing?\n if (context.object.marker == 'objectPrefix') {\n return `${await g(context.object)} ${await g(base)}`\n } else {\n return `${await g({...context.object, paraphrase: context.paraphrase})}'s ${await g(base)}`\n }\n } \n }"
888
+ "apply": "async ({context, g, gs}) => {\n if (context.evalue && !context.paraphrase) {\n return await g(context.evalue)\n } else if (context.objects) {\n const objects = [ ...context.objects ]\n objects.reverse()\n let phrase = ''\n let separator = ''\n for (let i = 0; i < objects.length-1; ++i) {\n phrase = phrase + separator + await g({...objects[i], paraphrase: context.paraphrase, possessive: true})\n separator = ' '\n }\n phrase = phrase + separator + await g({...objects[objects.length-1], paraphrase: context.paraphrase})\n return phrase\n } else {\n const base = { ...context }\n base.object = undefined; // TODO make paraphrase be a default when paraphrasing?\n if (context.object.marker == 'objectPrefix') {\n return `${await g(context.object)} ${await g(base)}`\n } else {\n return `${await g({...context.object, paraphrase: context.paraphrase})}'s ${await g(base)}`\n }\n } \n }"
889
889
  }
890
890
  ],
891
891
  "semantics": [
892
892
  {
893
- "match": "({context, isA}) => \n context.evaluate && \n context.marker == 'unify' && \n context.terms?.some((term) => {\n return term.objects && isA(term.objects[0], 'property') && term.query\n })",
893
+ "match": "({context, isA}) => \n context.marker == 'unify' && \n context.terms?.some((term) => {\n return term.objects && isA(term.objects[0], 'property') && term.query\n })",
894
894
  "apply": "async (args) => {\n const {context, km, callId, api, resolveEvaluate} = args\n let value, property, object\n if (context.terms[0].query) {\n property = context.terms[0].objects[0]\n object = context.terms[0].objects[1]\n value = context.terms[1]\n } else {\n property = context.terms[1].objects[0]\n object = context.terms[1].objects[1]\n value = context.terms[0]\n }\n const pattern = {\n marker: 'propertyRelation',\n object,\n property,\n value,\n }\n const relations = await api.relation_unify(pattern, ['object', 'property', 'value'])\n resolveEvaluate(context, relations)\n }"
895
895
  },
896
896
  {
897
897
  "match": "({context}) => context.relationBacked && context.query",
898
- "apply": "({context, km, callId}) => {\n const api = km('properties').api\n context.evalue = {\n marker: 'list',\n listable: true,\n // value: unflatten(api.relation_get(context, before.concat(after).map( (arg) => arg.tag ) ))\n value: unflatten(api.relation_get(context, context.relationArgs.map( (arg) => arg.tag ) ))\n }\n context.evalue.isResponse = true\n context.isResponse = true\n if (context.evalue.value.length == 0) {\n context.evalue.marker = 'answerNotKnown';\n context.evalue.listable = true\n context.evalue.value = [];\n } else {\n // context.evalue.truthValue = true\n }\n }"
898
+ "apply": "({context, km, callId}) => {\n const api = km('properties').api\n context.evalue = {\n marker: 'list',\n listable: true,\n // value: unflatten(api.relation_get(context, before.concat(after).map( (arg) => arg.tag ) ))\n value: unflatten(api.relation_get(context, context.relationArgs.map( (arg) => arg.tag ) ))\n }\n context.evalue.isResponse = true\n context.isResponse = true\n if (context.evalue.value.length == 0) {\n context.evalue.marker = 'undefined';\n context.evalue.listable = true\n context.evalue.value = [];\n } else {\n // context.evalue.truthValue = true\n }\n }"
899
899
  },
900
900
  {
901
- "match": "({context}) => context.relationBacked && !context.toVoice && !context.evaluate",
901
+ "match": "({context}) => context.relationBacked && !context.toVoice && context.isVerb",
902
902
  "apply": "({context, km, hierarchy, config, stack}) => {\n const api = km('properties').api\n // add types for arguments\n for (const argument of context.focusable || []) {\n const value = api.toValue(context[argument])\n if (value) {\n const minimas = hierarchy.minima(context[argument].types)\n for (const type of minimas) {\n if (config.exists(value)) {\n config.addHierarchy(value, type);\n }\n }\n }\n }\n api.relation_add(context)\n }"
903
903
  },
904
904
  {
@@ -910,12 +910,12 @@
910
910
  "apply": "({context, km, stack}) => {\n const propertiesAPI = km('properties').api\n context.ordering = context.orderingArgs.name\n const fcontexts = flattens(['list'], [context])\n for (const fcontext of fcontexts) {\n fcontext.paraphrase = true\n fcontext[context.orderingArgs.object].paraphrase = true\n fcontext[context.orderingArgs.category].paraphrase = true\n }\n propertiesAPI.relation_add(fcontexts)\n }"
911
911
  },
912
912
  {
913
- "match": "({context, isA}) => context.evaluate && context.constraints",
914
- "apply": "async ({km, context, e, log, isA}) => {\n const constraint = context.constraints[0];\n const value = constraint.constraint;\n let property = constraint.property;\n const properties = constraint.properties;\n for (const p of properties) {\n if (value[p].concept) {\n property = p\n // constraint.property = p; // set what is used\n constraint.property = {...constraint.property, ...p}; // set what is used\n\n }\n }\n // value.marker = 'owns'\n // value.greg = true\n // value.ownee.query = true\n value.query = true\n value.greg99 = 23\n const instance = await e(value)\n if (instance.verbatim) {\n context.evalue = { verbatim: instance.verbatim }\n return\n }\n if (instance.evalue.marker == 'answerNotKnown') {\n context.evalue = instance.evalue\n return\n }\n const selected = instance.evalue.value.map( (r) => r[property] )\n context.constraints = undefined;\n context.evalue = { marker: 'list', listable: true, value: selected }\n }"
913
+ "match": "({context, isA}) => context.constraints",
914
+ "apply": "async ({km, context, e, log, isA}) => {\n const constraint = context.constraints[0];\n const value = constraint.constraint;\n let property = constraint.property;\n const properties = constraint.properties;\n for (const p of properties) {\n if (value[p].concept) {\n property = p\n // constraint.property = p; // set what is used\n constraint.property = {...constraint.property, ...p}; // set what is used\n\n }\n }\n // value.marker = 'owns'\n // value.greg = true\n // value.ownee.query = true\n value.query = true\n value.greg99 = 23\n const instance = await e(value)\n if (instance.verbatim) {\n context.evalue = { verbatim: instance.verbatim }\n return\n }\n if (instance.evalue.marker === 'undefined') {\n context.evalue = instance.evalue\n return\n }\n const selected = instance.evalue.value.map( (r) => r[property] )\n context.constraints = undefined;\n context.evalue = { marker: 'list', listable: true, value: selected }\n }"
915
915
  },
916
916
  {
917
917
  "match": "({context}) => context.marker == 'is' && (context.one.how || context.two.how)",
918
- "apply": "async ({ resolveResponse, g, context, toArray, toList, fragments, kms, e, toEValue }) => {\n const propertyMarkerContext = context.one\n let object = context.two\n if (context.two.how) {\n propertyMakerContext = context.two\n object = context.one\n }\n const pmcs = toArray(propertyMarkerContext)\n const properties = []\n for (const pmc of pmcs) {\n const property = pmc.markedProperty\n properties.push({ marker: property, value: property, word: property })\n }\n const propertyOfObject = await fragments(\"the property of object\", { property: toList(properties, true), object })\n const value = toEValue(await e(propertyOfObject))\n value.focusableForPhrase = true\n propertyOfObject.focusableForPhrase = false\n const response = await fragments(\"the property is value\", { property: propertyOfObject, value })\n response.isResponse = true\n resolveResponse(context, response) \n }"
918
+ "apply": "async ({ resolveEvaluate, g, context, toArray, toList, fragments, kms, e, toEValue }) => {\n const propertyMarkerContext = context.one\n let object = context.two\n if (context.two.how) {\n propertyMakerContext = context.two\n object = context.one\n }\n const pmcs = toArray(propertyMarkerContext)\n const properties = []\n for (const pmc of pmcs) {\n const property = pmc.markedProperty\n properties.push({ marker: property, value: property, word: property })\n }\n const propertyOfObject = await fragments(\"the property of object\", { property: toList(properties, true), object })\n const value = toEValue(await e(propertyOfObject))\n value.focusableForPhrase = true\n propertyOfObject.focusableForPhrase = false\n const response = await fragments(\"the property is value\", { property: propertyOfObject, value })\n response.isResponse = true\n resolveEvaluate(context, response) \n }"
919
919
  },
920
920
  {
921
921
  "match": "({context}) => context.marker == 'same' && context.one.marker == 'concept'",
@@ -930,8 +930,8 @@
930
930
  "apply": "({context, km, objects}) => {\n km('properties').api.setReadOnly([context.one.value]) \n context.sameWasProcessed = true\n }"
931
931
  },
932
932
  {
933
- "match": "({context, hierarchy, api, isA}) => \n hierarchy.isA(context.marker, 'concept') && ((!context.propertyOf && !context.isProperty) || isA(context.objects[context.objects.length-1], 'dimension')) &&\n (!context.pullFromContext || context.number == 'many') &&\n context.evaluate &&\n !(context.types || []).includes('property') &&\n // !context.value && // greghere\n !context.ordinal &&\n (!context.objects || context.objects.length !== 2 || !context.objects[1].isInstance) &&\n (api.objects && api.objects.children && api.objects.children[context.marker]) &&\n !context.evaluate.toConcept",
934
- "apply": "({context, hierarchy, objects, api, km}) => {\n const values = api.objects.children[context.marker]\n const phrases = values.map( (value) => km('concept').api.getWordForValue(value) )\n // context.focusableForPhrase = true\n context.hierarchy = true\n context.evalue = { \n marker: 'list', \n listable: true,\n // value: api.objects.children[context.marker]\n value: phrases,\n }\n }"
933
+ "match": "({context, hierarchy, api, isA}) => \n hierarchy.isA(context.marker, 'concept') && ((!context.propertyOf && !context.isProperty) || isA(context.objects[context.objects.length-1], 'dimension')) &&\n (!context.pullFromContext || context.number == 'many') &&\n (context.pullFromContext || isA(context, 'type') || context.metaDefinition) &&\n !(context.types || []).includes('property') &&\n // !context.value && // greghere\n !context.ordinal &&\n (!context.objects || context.objects.length !== 2 || !context.objects[1].isInstance) &&\n (api.objects && api.objects.children && api.objects.children[context.marker])",
934
+ "apply": "({context, stack, isA, contextHierarchy, hierarchy, objects, api, km}) => {\n const values = api.objects.children[context.marker]\n const phrases = values.map( (value) => km('concept').api.getWordForValue(value) )\n // context.focusableForPhrase = true\n context.hierarchy = true\n context.evalue = { \n marker: 'list', \n listable: true,\n // value: api.objects.children[context.marker]\n value: phrases,\n }\n }"
935
935
  },
936
936
  {
937
937
  "match": "({context}) => context.marker == 'have' && !context.query",
@@ -946,8 +946,8 @@
946
946
  "apply": "async (args) => {\n const {context, fragments, objects, km, api, log, s, uuid} = args\n const objectContext = context.one.objects[context.one.objects.length-1];\n const propertyContext = context.one.objects[0];\n // const propertyContext = context.one;\n if (objectContext.unknown) {\n objectContext.value = pluralize.singular(objectContext.value)\n }\n const objectId = objectContext.value\n\n await api.makeObject({ ...args, context: objectContext })\n await api.makeObject({ ...args, context: propertyContext })\n const propertyId = propertyContext.value\n try {\n api.setProperty(objectContext, propertyContext, context.two, true)\n context.sameWasProcessed = true\n } catch (e) {\n log(`Error processing set property of an object: ${e}`)\n const config = km('properties')\n const value = await api.getProperty(objectId, propertyId)\n if (value?.value == context.two?.value) {\n context.evalue = [\n { marker: 'yesno', value: true, paraphrase: true },\n ]\n context.isResponse = true\n context.sameWasProcessed = true\n } else {\n const mappings = {\n property1: { word: propertyContext.word, value: propertyContext.value, paraphrase: true },\n object1: { word: objectContext.word, value: objectContext.value, paraphrase: true },\n value1: value,\n }\n // run the query 'the property of object' then copy that here and template it\n context.evalue = [\n { marker: 'yesno', value: false, paraphrase: true },\n ]\n context.evalue = context.evalue.concat(await fragments(\"the property1 of object1 is value1\", mappings))\n context.evalue.forEach( (r) => r.paraphrase = true )\n context.isResponse = true\n context.sameWasProcessed = true\n }\n }\n }"
947
947
  },
948
948
  {
949
- "match": "({context, hierarchy, toArray}) => {\n return (toArray(context).every((value) => hierarchy.isA(value.marker, 'property')) || (hierarchy.isA(context.marker, 'list') && context.possession)) && context.evaluate && context.objects && !context.evaluate.toConcept\n }",
950
- "apply": "async ({debug, isA, hierarchy, getWordFromDictionary, flatten, asList, context, api, kms, objects, g, gp, s, log, recall}) => {\n async function toValue(objectContext) {\n debug.breakAt('kirk#call3')\n if (!objectContext.value) {\n return objectContext;\n }\n let objectValue = kms.stm.api.getVariable(objectContext);\n if (!objectValue) {\n objectValue = objectContext.value\n }\n if (!await api.knownObject(objectValue)) {\n objectContext.verbatim = `There is no object named \"${await g({...objectContext, paraphrase: true})}\"`\n return\n }\n return objectValue\n }\n\n async function processOne(toDo) {\n let currentContext = toDo.pop()\n let currentValue = await toValue(currentContext)\n while (toDo.length > 0) {\n const nextContext = toDo.pop()\n const nextValue = await toValue(nextContext)\n if (!nextValue) {\n // TODO maybe this I aware so it can say \"I don't know about blah...\" and below\n // if (currentContext.unknown || !currentContext.value) {\n if (!api.conceptExists(currentContext.value)) {\n // api.conceptExists(currentContext)\n const objectPhrase = await g({...currentContext, paraphrase: true})\n context.verbatim = `What \"${objectPhrase}\" means is unknown`\n return\n }\n\n const propertyPhrase = await g({...nextContext, paraphrase: true})\n const objectPhrase = await g({...currentContext, paraphrase: true})\n context.verbatim = `There is no interpretation for \"${propertyPhrase} of ${objectPhrase}\"`\n return\n }\n\n let fromMentions\n if (!await api.knownProperty(currentContext, nextContext)) {\n if (hierarchy.isA(nextValue, 'property_type')) {\n const types = hierarchy.froms(nextValue)\n for (const type of types) {\n if (isA(currentContext, type)) {\n fromMentions = getWordFromDictionary({ value: type })\n }\n }\n }\n if (!fromMentions) {\n fromMentions = await recall({ context: nextContext, all: nextContext.number == 'many', frameOfReference: currentContext })\n }\n if (!fromMentions) {\n if (!currentValue && currentContext.unknown) {\n context.verbatim = `What \"${await gp(currentContext)}\" means is unknown`\n } else {\n context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`\n }\n return\n }\n }\n if (fromMentions) {\n currentContext = fromMentions\n currentValue = fromMentions // TODO not sure what is right here so just do something and fix when actually needed SOP\n } else {\n currentContext = await api.getProperty(currentValue, nextValue)\n currentValue = currentContext.value\n }\n }\n return currentContext\n }\n\n // const toDo = [ ...context.objects ]\n const toDos = flatten(['list'], context.objects)\n const results = []\n for (const toDo of toDos) {\n const one = await processOne(toDo)\n if (one) {\n results.push(one)\n }\n }\n\n if (results.length > 0) {\n context.focusable = ['object[0]']\n // context.evalue = currentContext\n context.evalue = asList(results, true)\n context.object = undefined;\n } else {\n context.evalue = { marker: 'answerNotKnown' }\n context.object = undefined;\n }\n }"
949
+ "match": "({context, hierarchy, toArray}) => {\n return (toArray(context).every((value) => hierarchy.isA(value.marker, 'property')) || (hierarchy.isA(context.marker, 'list') && context.possession)) && context.objects\n }",
950
+ "apply": "async ({debug, isA, hierarchy, getWordFromDictionary, flatten, asList, context, api, kms, objects, g, gp, s, log, recall}) => {\n async function toValue(objectContext) {\n if (!objectContext.value) {\n return objectContext;\n }\n let objectValue = kms.stm.api.getVariable(objectContext);\n if (!objectValue) {\n objectValue = objectContext.value\n }\n if (!await api.knownObject(objectValue)) {\n objectContext.verbatim = `There is no object named \"${await g({...objectContext, paraphrase: true})}\"`\n return\n }\n return objectValue\n }\n\n async function processOne(toDo) {\n let currentContext = toDo.pop()\n let currentValue = await toValue(currentContext)\n while (toDo.length > 0) {\n const nextContext = toDo.pop()\n const nextValue = await toValue(nextContext)\n if (!nextValue) {\n // TODO maybe this I aware so it can say \"I don't know about blah...\" and below\n // if (currentContext.unknown || !currentContext.value) {\n if (!api.conceptExists(currentContext.value)) {\n // api.conceptExists(currentContext)\n const objectPhrase = await g({...currentContext, paraphrase: true})\n context.verbatim = `What \"${objectPhrase}\" means is unknown`\n return\n }\n\n const propertyPhrase = await g({...nextContext, paraphrase: true})\n const objectPhrase = await g({...currentContext, paraphrase: true})\n context.verbatim = `There is no interpretation for \"${propertyPhrase} of ${objectPhrase}\"`\n return\n }\n\n let fromMentions\n if (!await api.knownProperty(currentContext, nextContext)) {\n if (hierarchy.isA(nextValue, 'property_type')) {\n const types = hierarchy.froms(nextValue)\n for (const type of types) {\n if (isA(currentContext, type)) {\n fromMentions = getWordFromDictionary({ value: type })\n }\n }\n }\n if (!fromMentions) {\n fromMentions = await recall({ context: nextContext, all: nextContext.number == 'many', frameOfReference: currentContext })\n }\n if (!fromMentions) {\n if (!currentValue && currentContext.unknown) {\n context.verbatim = `What \"${await gp(currentContext)}\" means is unknown`\n } else {\n context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`\n }\n return\n }\n }\n if (fromMentions) {\n currentContext = fromMentions\n currentValue = fromMentions // TODO not sure what is right here so just do something and fix when actually needed SOP\n } else {\n currentContext = await api.getProperty(currentValue, nextValue)\n currentValue = currentContext.value\n }\n }\n return currentContext\n }\n\n // const toDo = [ ...context.objects ]\n const toDos = flatten(['list'], context.objects)\n const results = []\n for (const toDo of toDos) {\n const one = await processOne(toDo)\n if (one) {\n results.push(one)\n }\n }\n\n if (results.length > 0) {\n context.focusable = ['object[0]']\n // context.evalue = currentContext\n context.evalue = asList(results, true)\n context.object = undefined;\n } else {\n context.evalue = { marker: 'undefined' }\n context.object = undefined;\n }\n }"
951
951
  }
952
952
  ]
953
953
  },
@@ -2483,17 +2483,17 @@
2483
2483
  "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:543"
2484
2484
  },
2485
2485
  {
2486
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:567"
2486
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:566"
2487
2487
  },
2488
2488
  {
2489
2489
  "notes": "object's property",
2490
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:576"
2490
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:575"
2491
2491
  }
2492
2492
  ],
2493
2493
  "semantics": [
2494
2494
  {
2495
2495
  "notes": "unify for properties",
2496
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:608"
2496
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:607"
2497
2497
  },
2498
2498
  {
2499
2499
  "notes": "getter for relation based verbs"
@@ -2511,41 +2511,41 @@
2511
2511
  "notes": "semantic for setting value with constraint"
2512
2512
  },
2513
2513
  {
2514
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:779",
2514
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:777",
2515
2515
  "notes": "how deep is the pool",
2516
2516
  "priority": -1
2517
2517
  },
2518
2518
  {
2519
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:806"
2519
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:804"
2520
2520
  },
2521
2521
  {
2522
2522
  "notes": "wants is xfx between wanter and wantee",
2523
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:817",
2523
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:815",
2524
2524
  "priority": -1
2525
2525
  },
2526
2526
  {
2527
2527
  "notes": "marking something as readonly",
2528
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:832"
2528
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:830"
2529
2529
  },
2530
2530
  {
2531
2531
  "notes": "crew members. evaluate a concepts to get instances",
2532
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:856"
2532
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:854"
2533
2533
  },
2534
2534
  {
2535
2535
  "notes": "greg has eyes",
2536
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:882"
2536
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:879"
2537
2537
  },
2538
2538
  {
2539
2539
  "notes": "greg has eyes?",
2540
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:902"
2540
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:899"
2541
2541
  },
2542
2542
  {
2543
2543
  "notes": "set the property of an object",
2544
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:928"
2544
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:925"
2545
2545
  },
2546
2546
  {
2547
2547
  "notes": "get/evaluate a property",
2548
- "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:980"
2548
+ "where": "/home/dev/code/theprogrammablemind/kms/common/properties.js:977"
2549
2549
  }
2550
2550
  ]
2551
2551
  },
@@ -58,7 +58,7 @@ V2
58
58
  // [
59
59
  // ({objects, context, args, hierarchy}) =>
60
60
  // hierarchy.isA(context.marker, 'property') &&
61
- // args({ types: ['myObjectType'], properties: ['object'] }) && context.evaluate,
61
+ // args({ types: ['myObjectType'], properties: ['object'] }),
62
62
  // ({objects, context}) => {
63
63
  // context.value = "value" // set the value here somehow
64
64
  // }
@@ -425,7 +425,7 @@ const config = {
425
425
  match: ({context}) => context.isEd,
426
426
  apply: async ({context, g}) => {
427
427
  const chosen = chooseNumber(context[context.afterTag], 'is', 'are')
428
- if (context[context.beforeTag].evalue && context[context.beforeTag].evalue.marker == 'answerNotKnown') {
428
+ if (context[context.beforeTag].evalue && context[context.beforeTag].evalue.marker === 'undefined') {
429
429
  return await g(context[context.beforeTag])
430
430
  }
431
431
  return `${await g(context[context.afterTag])} ${chosen} ${context.word} by ${await g(context[context.beforeTag])}`
@@ -563,9 +563,8 @@ const config = {
563
563
  },
564
564
  },
565
565
  {
566
- // ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.value && !context.evaluate,
567
566
  where: where(),
568
- match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.possession && !context.evaluate && !context.object.marker == 'objectPrefix',
567
+ match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.possession && context.paraphrase && !context.object.marker == 'objectPrefix',
569
568
  apply: async ({context, g}) => {
570
569
  const property = Object.assign({}, context, { object: undefined })
571
570
  return `${await g(property)} of ${await g({ ...context.object, paraphrase: true })}`
@@ -577,7 +576,7 @@ const config = {
577
576
  // match: ({context}) => context.paraphrase && !context.modifiers && context.object,
578
577
  match: ({context}) => !context.modifiers && (context.object || context.objects) && !context.interpolate,
579
578
  apply: async ({context, g, gs}) => {
580
- if (context.evalue) {
579
+ if (context.evalue && !context.paraphrase) {
581
580
  return await g(context.evalue)
582
581
  } else if (context.objects) {
583
582
  const objects = [ ...context.objects ]
@@ -607,7 +606,6 @@ const config = {
607
606
  notes: 'unify for properties',
608
607
  where: where(),
609
608
  match: ({context, isA}) =>
610
- context.evaluate &&
611
609
  context.marker == 'unify' &&
612
610
  context.terms?.some((term) => {
613
611
  return term.objects && isA(term.objects[0], 'property') && term.query
@@ -648,7 +646,7 @@ const config = {
648
646
  context.evalue.isResponse = true
649
647
  context.isResponse = true
650
648
  if (context.evalue.value.length == 0) {
651
- context.evalue.marker = 'answerNotKnown';
649
+ context.evalue.marker = 'undefined';
652
650
  context.evalue.listable = true
653
651
  context.evalue.value = [];
654
652
  } else {
@@ -659,7 +657,7 @@ const config = {
659
657
 
660
658
  {
661
659
  notes: `setter for relation based verbs`,
662
- match: ({context}) => context.relationBacked && !context.toVoice && !context.evaluate,
660
+ match: ({context}) => context.relationBacked && !context.toVoice && context.isVerb,
663
661
  apply: ({context, km, hierarchy, config, stack}) => {
664
662
  const api = km('properties').api
665
663
  // add types for arguments
@@ -741,8 +739,8 @@ const config = {
741
739
  },
742
740
  {
743
741
  notes: 'semantic for setting value with constraint',
744
- //match: ({context, isA}) => isA(context.marker, after[0].tag) && context.evaluate && context.constraints,
745
- match: ({context, isA}) => context.evaluate && context.constraints,
742
+ //match: ({context, isA}) => isA(context.marker, after[0].tag) && context.constraints,
743
+ match: ({context, isA}) => context.constraints,
746
744
  apply: async ({km, context, e, log, isA}) => {
747
745
  const constraint = context.constraints[0];
748
746
  const value = constraint.constraint;
@@ -766,7 +764,7 @@ const config = {
766
764
  context.evalue = { verbatim: instance.verbatim }
767
765
  return
768
766
  }
769
- if (instance.evalue.marker == 'answerNotKnown') {
767
+ if (instance.evalue.marker === 'undefined') {
770
768
  context.evalue = instance.evalue
771
769
  return
772
770
  }
@@ -780,7 +778,7 @@ const config = {
780
778
  notes: "how deep is the pool",
781
779
  priority: -1,
782
780
  match: ({context}) => context.marker == 'is' && (context.one.how || context.two.how),
783
- apply: async ({ resolveResponse, g, context, toArray, toList, fragments, kms, e, toEValue }) => {
781
+ apply: async ({ resolveEvaluate, g, context, toArray, toList, fragments, kms, e, toEValue }) => {
784
782
  const propertyMarkerContext = context.one
785
783
  let object = context.two
786
784
  if (context.two.how) {
@@ -799,7 +797,7 @@ const config = {
799
797
  propertyOfObject.focusableForPhrase = false
800
798
  const response = await fragments("the property is value", { property: propertyOfObject, value })
801
799
  response.isResponse = true
802
- resolveResponse(context, response)
800
+ resolveEvaluate(context, response)
803
801
  }
804
802
  },
805
803
  {
@@ -857,14 +855,13 @@ const config = {
857
855
  match: ({context, hierarchy, api, isA}) =>
858
856
  hierarchy.isA(context.marker, 'concept') && ((!context.propertyOf && !context.isProperty) || isA(context.objects[context.objects.length-1], 'dimension')) &&
859
857
  (!context.pullFromContext || context.number == 'many') &&
860
- context.evaluate &&
858
+ (context.pullFromContext || isA(context, 'type') || context.metaDefinition) &&
861
859
  !(context.types || []).includes('property') &&
862
860
  // !context.value && // greghere
863
861
  !context.ordinal &&
864
862
  (!context.objects || context.objects.length !== 2 || !context.objects[1].isInstance) &&
865
- (api.objects && api.objects.children && api.objects.children[context.marker]) &&
866
- !context.evaluate.toConcept,
867
- apply: ({context, hierarchy, objects, api, km}) => {
863
+ (api.objects && api.objects.children && api.objects.children[context.marker]),
864
+ apply: ({context, stack, isA, contextHierarchy, hierarchy, objects, api, km}) => {
868
865
  const values = api.objects.children[context.marker]
869
866
  const phrases = values.map( (value) => km('concept').api.getWordForValue(value) )
870
867
  // context.focusableForPhrase = true
@@ -979,12 +976,10 @@ const config = {
979
976
  notes: 'get/evaluate a property',
980
977
  where: where(),
981
978
  match: ({context, hierarchy, toArray}) => {
982
- return (toArray(context).every((value) => hierarchy.isA(value.marker, 'property')) || (hierarchy.isA(context.marker, 'list') && context.possession)) && context.evaluate && context.objects && !context.evaluate.toConcept
979
+ return (toArray(context).every((value) => hierarchy.isA(value.marker, 'property')) || (hierarchy.isA(context.marker, 'list') && context.possession)) && context.objects
983
980
  },
984
- // match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.evaluate,
985
981
  apply: async ({debug, isA, hierarchy, getWordFromDictionary, flatten, asList, context, api, kms, objects, g, gp, s, log, recall}) => {
986
982
  async function toValue(objectContext) {
987
- debug.breakAt('kirk#call3')
988
983
  if (!objectContext.value) {
989
984
  return objectContext;
990
985
  }
@@ -1070,7 +1065,7 @@ const config = {
1070
1065
  context.evalue = asList(results, true)
1071
1066
  context.object = undefined;
1072
1067
  } else {
1073
- context.evalue = { marker: 'answerNotKnown' }
1068
+ context.evalue = { marker: 'undefined' }
1074
1069
  context.object = undefined;
1075
1070
  }
1076
1071
  }
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "semantics": [
21
21
  {
22
- "match": "({context}) => context.marker == 'convertToUnits' && context.evaluate && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit')",
22
+ "match": "({context}) => context.marker == 'convertToUnits' && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit')",
23
23
  "apply": "async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {\n\n async function convert(fromUnits, fromAmount, toUnits) {\n let evalue;\n if (toUnits.value == fromUnits.value) {\n evalue = fromAmount\n // if (!fromAmount.value) {\n // debugger\n //}\n evalue.evalue = fromAmount.evalue || fromAmount.value\n } else {\n const formula = kms.formulas.api.get(toUnits, [fromUnits])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: fromUnits, to: toUnits } }\n kms.stm.api.remember({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(fromUnits.value, fromAmount)\n evalue = await e(formula)\n }\n return evalue\n }\n\n if (!context.from.unit) {\n resolveEvaluate(context.from, await e(context.from))\n }\n\n\n const from = toEValue(context.from)\n remember(context.to)\n const evalueNumerator = await convert(from.unit.numerator, from.amount, context.to.numerator)\n const evalueDenominator = await convert(from.unit.denominator, 1, context.to.denominator)\n const evalue = { evalue: (toFinalValue(evalueNumerator) || evalueNumerator.value) / (toFinalValue(evalueDenominator) || evalueDenominator.evalue) }\n context.evalue = {\n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: context.to,\n amount: { evalue, paraphrase: undefined }\n }\n }"
24
24
  }
25
25
  ]
package/common/rates.js CHANGED
@@ -36,7 +36,7 @@ const template = {
36
36
  semantics: [
37
37
  {
38
38
  where: where(),
39
- match: ({context}) => context.marker == 'convertToUnits' && context.evaluate && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit'),
39
+ match: ({context}) => context.marker == 'convertToUnits' && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit'),
40
40
  apply: async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {
41
41
 
42
42
  async function convert(fromUnits, fromAmount, toUnits) {
@@ -64,7 +64,7 @@ function query(missing, reminder_id) {
64
64
  },
65
65
 
66
66
  matchr: async ({ isA, api, context }) => {
67
- if (context.evaluate || context.isControl || context.isResponse) {
67
+ if (context.isControl || context.isResponse) {
68
68
  return false
69
69
  }
70
70
  const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing, reminder_id))