theprogrammablemind_4wp 7.5.8-beta.78 → 7.5.8-beta.79

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.
Files changed (3) hide show
  1. package/client.js +10 -7
  2. package/package.json +1 -1
  3. package/src/config.js +19 -7
package/client.js CHANGED
@@ -591,7 +591,7 @@ const loadInstance = (config, instance) => {
591
591
  config.addAssociations(instance.associations)
592
592
  }
593
593
  if (instance.learned_contextual_priorities && instance.learned_contextual_priorities.length > 0) {
594
- config.addContextualPriorities(instance.learned_contextual_priorities)
594
+ config.addPriorities(instance.learned_contextual_priorities)
595
595
  }
596
596
  }
597
597
  }
@@ -1122,6 +1122,13 @@ const defaultInnerProcess = (config, errorHandler, responses) => {
1122
1122
  }
1123
1123
  console.log("KM's loaded", config.configs.map((c) => c.name))
1124
1124
  console.log('This is the global objects from running semantics:\n', config.objects)
1125
+ if (!_.isEmpty(responses.learned_contextual_priorities)) {
1126
+ console.log('\nThe learned contextual priorties are :\n')
1127
+ for (const lcp of responses.learned_contextual_priorities) {
1128
+ console.log(` ${JSON.stringify(lcp)},\n`)
1129
+ }
1130
+ console.log("\n")
1131
+ }
1125
1132
  if (responses.logs) {
1126
1133
  console.log('Logs')
1127
1134
  responses.logs.forEach((log) => console.log(` ${log}`))
@@ -1433,6 +1440,7 @@ const knowledgeModule = async ({
1433
1440
  parser.add_argument('-tmn', '--testModuleName', { help: 'When running tests instead of using the current modules tests use the specified modules tests' })
1434
1441
  parser.add_argument('-t', '--test', { action: 'store_true', help: 'Run the tests. Create tests by running with the --query + --save flag' })
1435
1442
  parser.add_argument('-tv', '--testVerbose', { action: 'store_true', help: 'Run the tests in verbose mode. Create tests by running with the --query or --loop with the --save flag' })
1443
+ // parser.add_argument('-ttr', '--testToRun', { help: 'Only the specified test will be run' })
1436
1444
  parser.add_argument('-tva', '--testAllVerbose', { action: 'store_true', help: 'Run the tests in verbose mode. All the tests will be run instead of stopping at first failure. Create tests by running with the --query or --loop with the --save flag' })
1437
1445
  parser.add_argument('-tnp', '--testNoParenthesized', { action: 'store_true', help: 'Don\' check parenthesized differences for the tests' })
1438
1446
  parser.add_argument('-n', '--count', { help: 'Number of times to run the tests. Default is one. Use this to check for flakey test. If possible the system will print out a message with the word "hint" suggesting how to fix the problem' })
@@ -1452,7 +1460,7 @@ const knowledgeModule = async ({
1452
1460
  parser.add_argument('-c', '--clean', { help: 'Remove data from the test files. a === association' })
1453
1461
  parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
1454
1462
  parser.add_argument('-daa', '--dontAddAssociations', { action: 'store_true', help: 'Do not add associations from the tests.' })
1455
- parser.add_argument('-p', '--print', { help: 'Print the specified elements c === config, w === words, b === bridges, o === operators d === objects (d for data), h === hierarchy, g === generators, s === semantics, l === load t=tests ordering p === priorities a == associations j == JSON sent to server x == contextual priorities. for example --print wb' })
1463
+ parser.add_argument('-p', '--print', { help: 'Print the specified elements c === config, w === words, b === bridges, o === operators d === objects (d for data), h === hierarchy, g === generators, s === semantics, l === load t=tests ordering p === priorities a == associations j == JSON sent to server. for example --print wb' })
1456
1464
  parser.add_argument('-s', '--save', { action: 'store_true', help: 'When running with the --query flag this will save the current run to the test file. When running without the --query flag all tests will be run and resaved.' })
1457
1465
  parser.add_argument('-sd', '--saveDeveloper', { action: 'store_true', help: 'Same as -s but the query will not show up in the info command.' })
1458
1466
  parser.add_argument('-dl', '--debugLoops', { action: 'store_true', help: 'When running with the --debugLoops flag the logs calls to semantics and generators will be immediately written to the console '})
@@ -1629,11 +1637,6 @@ const knowledgeModule = async ({
1629
1637
  console.log(JSON.stringify(priority))
1630
1638
  }
1631
1639
  }
1632
- if (args.print.includes('x')) {
1633
- for (let contextual_priority of config.config.contextual_priorities) {
1634
- console.log(JSON.stringify(contextual_priority))
1635
- }
1636
- }
1637
1640
  if (args.print.includes('h')) {
1638
1641
  for (let edge of config.config.hierarchy) {
1639
1642
  console.log(JSON.stringify(edge))
package/package.json CHANGED
@@ -64,6 +64,6 @@
64
64
  "json-stable-stringify": "^1.0.1",
65
65
  "node-fetch": "^2.6.1"
66
66
  },
67
- "version": "7.5.8-beta.78",
67
+ "version": "7.5.8-beta.79",
68
68
  "license": "ISC"
69
69
  }
package/src/config.js CHANGED
@@ -228,7 +228,7 @@ const handleBridgeProps = (config, bridge, addFirst) => {
228
228
  if (typeof after == 'string') {
229
229
  after = [after, 0]
230
230
  }
231
- config.addPriorities({ context: [[bridge.id, bridge.level], after], choose: [0] })
231
+ config.addPriority({ context: [[bridge.id, bridge.level], after], choose: [0] })
232
232
  }
233
233
  }
234
234
  if (bridge.after) {
@@ -236,7 +236,7 @@ const handleBridgeProps = (config, bridge, addFirst) => {
236
236
  if (typeof before == 'string') {
237
237
  before = [before, 0]
238
238
  }
239
- config.addPriorities({ context: [before, [bridge.id, bridge.level]], choose: [0] })
239
+ config.addPriority({ context: [before, [bridge.id, bridge.level]], choose: [0] })
240
240
  }
241
241
  }
242
242
  if (bridge.words) {
@@ -364,6 +364,11 @@ if (runtime.process.env.DEBUG_HIERARCHY) {
364
364
  global.entodictonDebugHierarchy = JSON.parse(runtime.process.env.DEBUG_HIERARCHY)
365
365
  }
366
366
 
367
+
368
+ // i keep randomly doing one of the other so I will just make both work the same way
369
+ if (runtime.process.env.DEBUG_PRIORITIES) {
370
+ global.entodictonDebugPriority = JSON.parse(runtime.process.env.DEBUG_PRIORITIES)
371
+ }
367
372
  if (runtime.process.env.DEBUG_PRIORITY) {
368
373
  global.entodictonDebugPriority = JSON.parse(runtime.process.env.DEBUG_PRIORITY)
369
374
  }
@@ -725,6 +730,7 @@ class Config {
725
730
  addGenerator: (...args) => this.addGenerator(...args, uuid, config.name),
726
731
  addHierarchy: (...args) => this.addHierarchy(...args),
727
732
  addOperator: (...args) => this.addOperator(...args, uuid),
733
+ addPriority: (...args) => this.addPriority(...args),
728
734
  addPriorities: (...args) => this.addPriorities(...args),
729
735
  addSemantic: (...args) => this.addSemantic(...args, uuid, config.name),
730
736
  removeSemantic: (...args) => this.removeSemantic(...args, uuid, config.name),
@@ -1099,14 +1105,20 @@ class Config {
1099
1105
  // TODO add more error checking to these like addHierarchy has
1100
1106
  // TODO change name from priorities to priority
1101
1107
  // [ context: <list of [id, level]>, choose: [<indexes of prioritized operator>], [ordered: [true|false]] ]
1102
- addPriorities (priorities) {
1108
+ addPriority (priority) {
1103
1109
  if (!this.config.priorities) {
1104
1110
  this.config.priorities = []
1105
1111
  }
1106
- debugPriority(priorities)
1107
- priority_valid(priorities)
1108
- this.config.priorities.push(priorities)
1109
- this._delta.json.priorities.push({ action: 'add', priorities })
1112
+ debugPriority(priority)
1113
+ priority_valid(priority)
1114
+ this.config.priorities.push(priority)
1115
+ this._delta.json.priorities.push({ action: 'add', priority })
1116
+ }
1117
+
1118
+ addPriorities (priorities) {
1119
+ for (let priority of priorities) {
1120
+ this.addPriority(priority)
1121
+ }
1110
1122
  }
1111
1123
 
1112
1124
  addHierarchy (child, parent) {