theprogrammablemind 9.4.3 → 9.4.4-beta.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.
Files changed (3) hide show
  1. package/client.js +34 -19
  2. package/package.json +1 -1
  3. package/src/config.js +1 -0
package/client.js CHANGED
@@ -1316,7 +1316,7 @@ const knowledgeModuleImpl = async ({
1316
1316
  parser.add_argument('--parenthesized', { action: 'store_true', help: 'Show the generated phrases with parenthesis.' })
1317
1317
  parser.add_argument('-c', '--clean', { help: 'Remove data from the test files. a === association' })
1318
1318
  parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
1319
- 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' })
1319
+ 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, ha === hierarchy ancestors g === generators, s === semantics, l === load t=tests ordering p === priorities a === associations j === JSON sent to server. for example --print wb' })
1320
1320
  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.' })
1321
1321
  parser.add_argument('-fr', '--failRebuild', { action: 'store_true', help: 'If a rebuild is required fail out.' })
1322
1322
  parser.add_argument('-sd', '--saveDeveloper', { action: 'store_true', help: 'Same as -s but the query will not show up in the info command.' })
@@ -1466,7 +1466,13 @@ const knowledgeModuleImpl = async ({
1466
1466
  }
1467
1467
  configPrinted = true
1468
1468
  if (args.print) {
1469
- if (args.print.includes('t')) {
1469
+ let print = args.print
1470
+ const hasArg = (arg) => {
1471
+ const result = print.includes(arg)
1472
+ print = print.replaceAll(arg, '')
1473
+ return result
1474
+ }
1475
+ if (hasArg('t')) {
1470
1476
  console.log('Test queries')
1471
1477
  let counter = 0
1472
1478
  for (const test of config.tests) {
@@ -1474,19 +1480,18 @@ const knowledgeModuleImpl = async ({
1474
1480
  counter += 1
1475
1481
  }
1476
1482
  }
1477
- if (args.print.includes('c')) {
1483
+ if (hasArg('c')) {
1478
1484
  const { data } = setupProcessB({ config })
1479
1485
  console.log('Config as sent to server')
1480
1486
  console.log(JSON.stringify(data, null, 2))
1481
1487
  }
1482
-
1483
- if (args.print.includes('l')) {
1488
+ if (hasArg('l')) {
1484
1489
  console.log('Module load ordering')
1485
1490
  for (const km of config.configs) {
1486
1491
  console.log(` ${km.name}`)
1487
1492
  }
1488
1493
  }
1489
- if (args.print.includes('w')) {
1494
+ if (hasArg('w')) {
1490
1495
  // { literals: Object, patterns: Array(2), hierarchy: Array(97) }
1491
1496
  console.log('literals')
1492
1497
  for (const word in config.config.words.literals) {
@@ -1497,21 +1502,36 @@ const knowledgeModuleImpl = async ({
1497
1502
  console.log(' ' + JSON.stringify(pattern))
1498
1503
  }
1499
1504
  }
1500
- if (args.print.includes('b')) {
1505
+ if (hasArg('b')) {
1501
1506
  for (const bridge of config.config.bridges) {
1502
1507
  console.log(JSON.stringify(bridge))
1503
1508
  }
1504
1509
  }
1505
- if (args.print.includes('o')) {
1510
+ if (hasArg('o')) {
1506
1511
  for (const operator of config.config.operators) {
1507
1512
  console.log(JSON.stringify(operator))
1508
1513
  }
1509
1514
  }
1510
- if (args.print.includes('j')) {
1515
+ if (hasArg('j')) {
1511
1516
  const { data } = setupProcessB({ config })
1512
1517
  console.log(JSON.stringify(data, null, 2))
1513
1518
  }
1514
- if (args.print.includes('a')) {
1519
+ if (hasArg('ha')) {
1520
+ const nodes = new Set()
1521
+ for (const edge of config.config.hierarchy) {
1522
+ nodes.add(edge[0])
1523
+ nodes.add(edge[1])
1524
+ }
1525
+ for (const node of nodes) {
1526
+ console.log(`${node}: ${[...config.hierarchy.ancestors(node)]}`)
1527
+ }
1528
+ }
1529
+ if (hasArg('h')) {
1530
+ for (const edge of config.config.hierarchy) {
1531
+ console.log(JSON.stringify(edge))
1532
+ }
1533
+ }
1534
+ if (hasArg('a')) {
1515
1535
  console.log('associations ================')
1516
1536
  const properties = ['negative', 'positive']
1517
1537
  for (const property of properties) {
@@ -1521,20 +1541,15 @@ const knowledgeModuleImpl = async ({
1521
1541
  }
1522
1542
  }
1523
1543
  }
1524
- if (args.print.includes('d')) {
1544
+ if (hasArg('d')) {
1525
1545
  console.log(JSON.stringify(config.config.objects, null, 2))
1526
1546
  }
1527
- if (args.print.includes('p')) {
1547
+ if (hasArg('p')) {
1528
1548
  for (const priority of config.config.priorities) {
1529
1549
  console.log(JSON.stringify(priority))
1530
1550
  }
1531
1551
  }
1532
- if (args.print.includes('h')) {
1533
- for (const edge of config.config.hierarchy) {
1534
- console.log(JSON.stringify(edge))
1535
- }
1536
- }
1537
- if (args.print.includes('g')) {
1552
+ if (hasArg('g')) {
1538
1553
  const easyToRead = _.cloneDeep(config.config.generators)
1539
1554
  for (const semantic of easyToRead) {
1540
1555
  semantic.match = semantic.match.toString()
@@ -1545,7 +1560,7 @@ const knowledgeModuleImpl = async ({
1545
1560
  }
1546
1561
  console.dir(easyToRead)
1547
1562
  }
1548
- if (args.print.includes('s')) {
1563
+ if (hasArg('s')) {
1549
1564
  const easyToRead = _.cloneDeep(config.config.semantics)
1550
1565
  for (const semantic of easyToRead) {
1551
1566
  semantic.match = semantic.match.toString()
package/package.json CHANGED
@@ -70,6 +70,6 @@
70
70
  "sort-json": "^2.0.0",
71
71
  "uuid": "^8.3.2"
72
72
  },
73
- "version": "9.4.3",
73
+ "version": "9.4.4-beta.0",
74
74
  "license": "UNLICENSED"
75
75
  }
package/src/config.js CHANGED
@@ -2633,6 +2633,7 @@ class Config {
2633
2633
 
2634
2634
  // rebuild ({ isModule: mainIsModule = false } = {}) {
2635
2635
  async rebuild ({ isModule: mainIsModule } = {}) {
2636
+ this._enable = []
2636
2637
  if (this._stop_auto_rebuild) {
2637
2638
  return
2638
2639
  }