theprogrammablemind_4wp 9.2.0 → 9.3.0

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.
package/client.js CHANGED
@@ -265,6 +265,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
265
265
  if (credentials) {
266
266
  config.server(credentials.server, credentials.key)
267
267
  }
268
+
268
269
  const url = config._server
269
270
  const queryParams = config._queryParams || ''
270
271
  const retries = 2
@@ -280,7 +281,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
280
281
  throw error
281
282
  }
282
283
 
283
- let { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config, initializer, allowDelta: true })
284
+ let { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config, initializer, allowDelta: true, rebuildingTemplate })
284
285
  if (commandLineArgs && commandLineArgs.checkForLoop) {
285
286
  data.checkForLoop = commandLineArgs.checkForLoop
286
287
  }
@@ -371,6 +372,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
371
372
  response.version = json.version
372
373
  response.explain_priorities = json.explain_priorities
373
374
  response.contextual_priorities_ambiguities = json.contextual_priorities_ambiguities
375
+ response.rtf_associations = json.rtf_associations
374
376
 
375
377
  response.contexts = response.contexts.concat(contextsPrime)
376
378
  response.generated = response.generated.concat(generatedPrime)
@@ -1671,12 +1673,28 @@ const knowledgeModuleImpl = async ({
1671
1673
  newError = true
1672
1674
  headerShown = true
1673
1675
  if (args.vimdiff) {
1674
- vimdiff(actual, expected, `"${result.utterance}" - ${label}`)
1676
+ vimdiff(actual, expected, `"${label} - ${result.utterance}"`)
1675
1677
  }
1676
1678
  result.hasError = true
1677
1679
  }
1678
1680
  }
1679
1681
  if (!deepEqual(result.expected.summaries, result.actual.summaries)) {
1682
+ const tidy_summaries = (summaries) => {
1683
+ const summaries_prime = []
1684
+ for (const chunk of summaries) {
1685
+ chunk_prime = { length: chunk.length, summaries: [] }
1686
+ for (const summary of chunk.summaries) {
1687
+ const summary_prime = { counter: summary.counter, operators: [] }
1688
+ for (const operator of summary.operators) {
1689
+ summary_prime.operators.push(`{ marker: [${operator.marker[0]}, ${operator.marker[1]}] range: { start: ${operator.range.start}, end: ${operator.range.end} } }`)
1690
+ }
1691
+ chunk_prime.summaries.push(summary_prime)
1692
+ }
1693
+ summaries_prime.push(chunk_prime)
1694
+ }
1695
+ return summaries_prime
1696
+ }
1697
+ show('operators', tidy_summaries(result.expected.summaries), tidy_summaries(result.actual.summaries))
1680
1698
  /*
1681
1699
  const suggestion = suggestAssociationsFix(result.expected.summaries, result.actual.summaries)
1682
1700
  let suggestedFix
package/package.json CHANGED
@@ -69,6 +69,6 @@
69
69
  "sort-json": "^2.0.0",
70
70
  "uuid": "^8.3.2"
71
71
  },
72
- "version": "9.2.0",
72
+ "version": "9.3.0",
73
73
  "license": "UNLICENSED"
74
74
  }
package/src/config.js CHANGED
@@ -473,7 +473,7 @@ const handleCalculatedProps = (baseConfig, moreConfig, { addFirst, uuid } = {})
473
473
  if (moreConfig.bridges) {
474
474
  moreConfig.bridges = moreConfig.bridges.map((bridge) => {
475
475
  bridge = { ...bridge }
476
- const valid = ['after', 'associations', 'before', 'bridge', 'development', 'return_type_selector', 'evaluator', 'evaluators', 'generatorp', 'generatorr', 'generatorpr', 'generators', 'operator', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
476
+ const valid = ['after', 'conditional', 'associations', 'before', 'bridge', 'development', 'skipable', 'return_type_selector', 'evaluator', 'evaluators', 'generatorp', 'generatorr', 'generatorpr', 'generators', 'operator', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
477
477
  'level', 'optional', 'selector', 'semantic', 'semantics', 'words', /Bridge$/, 'localHierarchy', 'levelSpecificHierarchy', 'where', 'uuid']
478
478
  helpers.validProps(valid, bridge, 'bridge')
479
479
  handleBridgeProps(baseConfig, bridge, { addFirst, uuid })
@@ -642,7 +642,7 @@ function setWordsUUIDs (words, uuid) {
642
642
  pattern.defs.map((def) => Object.assign(def, { uuid }))
643
643
  }
644
644
  const hierarchy = words.hierarchy
645
- for (const pair of hierarchy) {
645
+ for (const pair of hierarchy || []) {
646
646
  pair.uuid = uuid
647
647
  }
648
648
  }
@@ -1,5 +1,6 @@
1
1
  const { InitCalls } = require('./helpers')
2
2
  const DigraphInternal = require('./digraph_internal')
3
+ const debug = require('./debug')
3
4
 
4
5
  const gs = (g) => async (contexts, separator, lastSeparator) => {
5
6
  if (!Array.isArray(contexts)) {
@@ -215,10 +216,12 @@ const processContext = async (context, { objects = {}, config, logs = [] }) => {
215
216
  return { context, generated, paraphrases, responses }
216
217
  }
217
218
 
218
- const setupProcessB = ({ config, initializer, allowDelta = false } = {}) => {
219
+ const setupProcessB = ({ config, initializer, allowDelta = false, rebuildingTemplate = false } = {}) => {
219
220
  const key = config._key
220
-
221
221
  const data = Object.assign({ key, version: '3' }, { uuid: config._uuid })
222
+ if (rebuildingTemplate) {
223
+ data.return_rtf_associations = true
224
+ }
222
225
  if (allowDelta && config.allowDelta && config.hasDelta()) {
223
226
  // console.log('config', config)
224
227
  data.delta = config.delta()
@@ -414,6 +417,15 @@ const loadInstance = async (config, instance) => {
414
417
  const transitoryMode = global.transitoryMode
415
418
  global.transitoryMode = false
416
419
 
420
+ /*
421
+ if (config.name == 'people' && instance.name == 'people') {
422
+ debugger
423
+ }
424
+ */
425
+ const rl = instance.resultss.length
426
+ if (rl > 0) {
427
+ config.addAssociations(instance.resultss[instance.resultss.length-1].rtf_associations || [])
428
+ }
417
429
  /*
418
430
  TODO needs updating if still wanted
419
431
  if (instance && (instance.associations || instance.learned_contextual_priorities)) {