tpmkms 7.12.8 → 8.0.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 (75) hide show
  1. package/common/animals.instance.json +89 -293
  2. package/common/animals.js +1 -1
  3. package/common/avatar.js +7 -5
  4. package/common/characters.js +12 -5
  5. package/common/crew.instance.json +289 -577
  6. package/common/crew.js +1 -1
  7. package/common/currency.js +0 -2
  8. package/common/dialogues.js +122 -17
  9. package/common/dimension.instance.json +747 -73
  10. package/common/dimension.js +15 -7
  11. package/common/edible.instance.json +243 -435
  12. package/common/edible.js +1 -1
  13. package/common/emotions.instance.json +29 -65
  14. package/common/emotions.js +1 -1
  15. package/common/fastfood.instance.json +1080 -2072
  16. package/common/fastfood.js +1 -1
  17. package/common/formulas.instance.json +992 -0
  18. package/common/formulas.js +19 -6
  19. package/common/formulas.test.json +1187 -3651
  20. package/common/gdefaults.js +2 -0
  21. package/common/help.js +7 -2
  22. package/common/help.test.json +9 -5
  23. package/common/helpers.js +5 -0
  24. package/common/javascript.js +8 -6
  25. package/common/kirk.instance.json +1 -1
  26. package/common/kirk.js +1 -1
  27. package/common/length.instance.json +316 -740
  28. package/common/length.js +1 -1
  29. package/common/math.instance.json +1959 -1
  30. package/common/math.js +17 -5
  31. package/common/meta.instance.json +1 -1
  32. package/common/meta.js +35 -10
  33. package/common/numbers.js +28 -24
  34. package/common/ordering.instance.json +37 -153
  35. package/common/ordering.js +1 -1
  36. package/common/people.instance.json +50 -78
  37. package/common/people.js +1 -1
  38. package/common/pipboy.instance.json +23431 -1082
  39. package/common/pipboy.js +31 -4
  40. package/common/pipboy.test.json +13 -9
  41. package/common/pokemon.instance.json +41 -141
  42. package/common/pokemon.js +1 -1
  43. package/common/pressure.instance.json +93 -33
  44. package/common/pressure.js +1 -1
  45. package/common/properties.instance.json +21 -49
  46. package/common/properties.js +13 -8
  47. package/common/reports.instance.json +23 -63
  48. package/common/reports.js +9 -7
  49. package/common/scorekeeper.instance.json +1 -1
  50. package/common/scorekeeper.js +9 -7
  51. package/common/spock.instance.json +1 -1
  52. package/common/spock.js +1 -1
  53. package/common/tell.js +4 -2
  54. package/common/temperature.instance.json +97 -193
  55. package/common/temperature.js +1 -1
  56. package/common/time.js +36 -20
  57. package/common/time.test.json +66 -44
  58. package/common/tokenize.js +46 -0
  59. package/common/ui.instance.json +9 -1
  60. package/common/weight.instance.json +273 -217
  61. package/common/weight.js +1 -1
  62. package/main.js +2 -8
  63. package/package.json +6 -18
  64. package/common/dimensionTemplate.instance.json +0 -582
  65. package/common/dimensionTemplate.js +0 -35
  66. package/common/formulasTemplate.instance.json +0 -483
  67. package/common/formulasTemplate.js +0 -30
  68. package/common/formulasTemplate.test.json +0 -2
  69. package/common/mathTemplate.instance.json +0 -1635
  70. package/common/mathTemplate.js +0 -32
  71. package/common/mathTemplate.test.json +0 -1422
  72. package/common/pipboyTemplate.instance.json +0 -17420
  73. package/common/pipboyTemplate.js +0 -48
  74. package/common/pipboyTemplate.test.json +0 -2
  75. /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
package/common/math.js CHANGED
@@ -3,8 +3,11 @@ const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues')
4
4
  const numbers = require('./numbers')
5
5
  const punctuation = require('./punctuation')
6
- const mathTemplate = require('./mathTemplate')
7
- const math_tests = require('./math.test.json')
6
+ const countable = require('./countable')
7
+ const comparable = require('./comparable')
8
+ const tests = require('./math.test.json')
9
+ const instance = require('./math.instance.json')
10
+
8
11
 
9
12
  // TODO 10 dollars times 20
10
13
  /*
@@ -102,9 +105,17 @@ let configStruct = {
102
105
  ],
103
106
  };
104
107
 
108
+ const template = {
109
+ configs: [
110
+ "mathematical modifies operator",
111
+ "* + / and - are mathematical operators",
112
+ configStruct,
113
+ ]
114
+ }
115
+
105
116
  const createConfig = () => {
106
- const config = new Config(configStruct, module)
107
- config.add(numbers(), dialogues(), punctuation(), mathTemplate());
117
+ const config = new Config({ name: 'math' }, module)
118
+ config.add(numbers(), dialogues(), punctuation(), countable(), comparable())
108
119
  return config
109
120
  }
110
121
 
@@ -112,9 +123,10 @@ knowledgeModule( {
112
123
  module,
113
124
  createConfig,
114
125
  description: 'talking about math',
126
+ template: { template, instance },
115
127
  test: {
116
128
  name: './math.test.json',
117
- contents: math_tests,
129
+ contents: tests,
118
130
  checks: {
119
131
  context: defaultContextCheck,
120
132
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [],
2
+ "configs": [],
3
3
  "resultss": [],
4
4
  "fragments": [],
5
5
  "semantics": [],
package/common/meta.js CHANGED
@@ -1,15 +1,16 @@
1
1
  const { Config, knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const _ = require('lodash')
4
+ const gdefaults = require('./gdefaults.js')
4
5
  ensureTestFile(module, 'meta', 'test')
5
6
  ensureTestFile(module, 'meta', 'instance')
6
7
  const meta_tests = require('./meta.test.json')
7
8
  const meta_instance = require('./meta.instance.json')
8
9
  const { hashIndexesGet, hashIndexesSet, translationMapping, translationMappings } = require('./helpers/meta.js')
9
- const { zip } = require('./helpers.js')
10
+ const { zip, words } = require('./helpers.js')
10
11
 
11
12
  const template = {
12
- queries: [
13
+ configs: [
13
14
  // "if f then g",
14
15
  //"if e or f then g",
15
16
  ]
@@ -59,6 +60,23 @@ let configStruct = {
59
60
  { child: 'orAble', parent: 'ifAble' },
60
61
  ],
61
62
  bridges: [
63
+ /*
64
+ {
65
+ id: "synonym",
66
+ // implicit words in singular/plural
67
+ words: words('synonym'),
68
+ operator: "([synonym])",
69
+ },
70
+ {
71
+ id: 'synonymOfWord',
72
+ operator: "((synonym/*) [synonymOfWord|of] (word))",
73
+ bridge: "{ ...next(operator), word: after[0] }",
74
+ evaluator: ({context}) => {
75
+ debugger
76
+ debugger
77
+ }
78
+ },
79
+ */
62
80
  {id: "orList", level: 0, selector: {left: [{ marker: 'orAble' }], right: [{ marker: 'orAble' }], passthrough: true}, bridge: "{ ...next(operator), value: append(before, after) }"},
63
81
  {id: "orList", level: 1, selector: {left: [{ marker: 'orAble' }], passthrough: true}, bridge: "{ ...operator, value: append(before, operator.value) }"},
64
82
 
@@ -81,14 +99,16 @@ let configStruct = {
81
99
  ],
82
100
  version: '3',
83
101
  words: {
84
- // 'testWord2': [{"id": "testWord2", "initial": "{ value: 'testWord2Value' }" }],
85
- // TODO make this development and select out for module
86
- // 'x': [{id: "x", initial: "{ value: 'x' }", development: true }],
87
- // 'f': [{id: "ifAble", initial: "{ word: 'f' }", development: true }],
88
- // 'g': [{id: "ifAble", initial: "{ word: 'g' }", development: true }],
89
- 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", development: true }],
90
- 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", development: true }],
91
- 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", development: true }],
102
+ "literals": {
103
+ // 'testWord2': [{"id": "testWord2", "initial": "{ value: 'testWord2Value' }" }],
104
+ // TODO make this development and select out for module
105
+ // 'x': [{id: "x", initial: "{ value: 'x' }", development: true }],
106
+ // 'f': [{id: "ifAble", initial: "{ word: 'f' }", development: true }],
107
+ // 'g': [{id: "ifAble", initial: "{ word: 'g' }", development: true }],
108
+ 'f': [{id: "f", initial: "{ value: 'f', word: 'f' }", development: true }],
109
+ 'x': [{id: "x", initial: "{ value: 'x', word: 'x' }", development: true }],
110
+ 'gq': [{id: "g", initial: "{ word: 'gq', query: true }", development: true }],
111
+ }
92
112
  },
93
113
  generators: [
94
114
  {
@@ -362,6 +382,9 @@ let configStruct = {
362
382
 
363
383
  const createConfig = () => {
364
384
  const config = new Config(configStruct, module)
385
+ config.stop_auto_rebuild()
386
+ config.add(gdefaults())
387
+
365
388
  config.initializer( ({config, addGenerator, isModule}) => {
366
389
  if (!isModule) {
367
390
  addGenerator({
@@ -371,6 +394,8 @@ const createConfig = () => {
371
394
  })
372
395
  }
373
396
  })
397
+
398
+ config.restart_auto_rebuild()
374
399
  return config
375
400
  }
376
401
 
package/common/numbers.js CHANGED
@@ -20,30 +20,34 @@ let configStruct = {
20
20
  debug: false,
21
21
  version: '3',
22
22
  words: {
23
- // start with a space for regular expressions
24
- " ([0-9]+$)": [{"id": "number", "initial": "{ value: int(group[0]), instance: true }" }],
25
- " ([0-9]+[.][0-9]+$)": [{"id": "number", "initial": "{ value: float(group[0]), instance: true }" }],
26
- " ([.][0-9]+$)": [{"id": "number", "initial": "{ value: float(group[0]), instance: true }" }],
27
- "one": [{"id": "number", "initial": "{ value: 1, instance:true }" }],
28
- "ones": [{"id": "number", "initial": "{ value: 1, number: 'many', instance:true }" }],
29
- "two": [{"id": "number", "initial": "{ value: 2 , instance:true}" }],
30
- "twos": [{"id": "number", "initial": "{ value: 2 , number: 'many', instance:true}" }],
31
- "three": [{"id": "number", "initial": "{ value: 3, instance:true }" }],
32
- "threes": [{"id": "number", "initial": "{ value: 3, number: 'many', instance:true }" }],
33
- "four": [{"id": "number", "initial": "{ value: 4, instance:true }" }],
34
- "fours": [{"id": "number", "initial": "{ value: 4, number: 'many', instance:true }" }],
35
- "five": [{"id": "number", "initial": "{ value: 5, instance:true }" }],
36
- "fives": [{"id": "number", "initial": "{ value: 5, number: 'many', instance:true }" }],
37
- "six": [{"id": "number", "initial": "{ value: 6, instance:true }" }],
38
- "sixes": [{"id": "number", "initial": "{ value: 6, number: 'many', instance:true }" }],
39
- "seven": [{"id": "number", "initial": "{ value: 7, instance:true }" }],
40
- "sevens": [{"id": "number", "initial": "{ value: 7, number: 'many', instance:true }" }],
41
- "eight": [{"id": "number", "initial": "{ value: 8, instance:true }" }],
42
- "eights": [{"id": "number", "initial": "{ value: 8, number: 'many', instance:true }" }],
43
- "nine": [{"id": "number", "initial": "{ value: 9, instance:true }" }],
44
- "nines": [{"id": "number", "initial": "{ value: 9, number: 'many', instance:true }" }],
45
- "ten": [{"id": "number", "initial": "{ value: 10, instance:true }" }],
46
- "tens": [{"id": "number", "initial": "{ value: 10, number: 'many', instance:true }" }],
23
+ "literals": {
24
+ // start with a space for regular expressions
25
+ "one": [{"id": "number", "initial": "{ value: 1, instance:true }" }],
26
+ "ones": [{"id": "number", "initial": "{ value: 1, number: 'many', instance:true }" }],
27
+ "two": [{"id": "number", "initial": "{ value: 2 , instance:true}" }],
28
+ "twos": [{"id": "number", "initial": "{ value: 2 , number: 'many', instance:true}" }],
29
+ "three": [{"id": "number", "initial": "{ value: 3, instance:true }" }],
30
+ "threes": [{"id": "number", "initial": "{ value: 3, number: 'many', instance:true }" }],
31
+ "four": [{"id": "number", "initial": "{ value: 4, instance:true }" }],
32
+ "fours": [{"id": "number", "initial": "{ value: 4, number: 'many', instance:true }" }],
33
+ "five": [{"id": "number", "initial": "{ value: 5, instance:true }" }],
34
+ "fives": [{"id": "number", "initial": "{ value: 5, number: 'many', instance:true }" }],
35
+ "six": [{"id": "number", "initial": "{ value: 6, instance:true }" }],
36
+ "sixes": [{"id": "number", "initial": "{ value: 6, number: 'many', instance:true }" }],
37
+ "seven": [{"id": "number", "initial": "{ value: 7, instance:true }" }],
38
+ "sevens": [{"id": "number", "initial": "{ value: 7, number: 'many', instance:true }" }],
39
+ "eight": [{"id": "number", "initial": "{ value: 8, instance:true }" }],
40
+ "eights": [{"id": "number", "initial": "{ value: 8, number: 'many', instance:true }" }],
41
+ "nine": [{"id": "number", "initial": "{ value: 9, instance:true }" }],
42
+ "nines": [{"id": "number", "initial": "{ value: 9, number: 'many', instance:true }" }],
43
+ "ten": [{"id": "number", "initial": "{ value: 10, instance:true }" }],
44
+ "tens": [{"id": "number", "initial": "{ value: 10, number: 'many', instance:true }" }],
45
+ },
46
+ patterns: [
47
+ { "pattern": [{ type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: int(text), instance: true }" }]},
48
+ { "pattern": [{ type: 'digit' }, { repeat: true }, '.', { type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: float(text), instance: true }" }]},
49
+ { "pattern": ['.', { type: 'digit' }, { repeat: true }], defs: [{id: "number", uuid: '1', initial: "{ value: float(text), instance: true }" }]},
50
+ ],
47
51
  },
48
52
 
49
53
  hierarchy: [
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [
2
+ "configs": [
3
3
  "wants is xfx between wanter and wantee",
4
4
  "if x likes y or x loves y then x wants y"
5
5
  ],
@@ -517,15 +517,15 @@
517
517
  },
518
518
  "one": {
519
519
  "number": "one",
520
+ "value": "wants",
521
+ "unknown": true,
522
+ "text": "wants",
520
523
  "marker": "unknown",
524
+ "word": "wants",
521
525
  "range": {
522
526
  "start": 0,
523
527
  "end": 37
524
528
  },
525
- "word": "wants",
526
- "text": "wants",
527
- "value": "wants",
528
- "unknown": true,
529
529
  "dead": true,
530
530
  "types": [
531
531
  "unknown"
@@ -563,28 +563,28 @@
563
563
  "isList": true,
564
564
  "value": [
565
565
  {
566
+ "value": "wanter",
567
+ "unknown": true,
568
+ "text": "wanter",
566
569
  "marker": "type",
570
+ "word": "wanter",
567
571
  "range": {
568
572
  "start": 21,
569
573
  "end": 26
570
574
  },
571
- "word": "wanter",
572
- "text": "wanter",
573
- "value": "wanter",
574
- "unknown": true,
575
575
  "dead": true,
576
576
  "level": 1
577
577
  },
578
578
  {
579
+ "value": "wantee",
580
+ "unknown": true,
581
+ "text": "wantee",
579
582
  "marker": "type",
583
+ "word": "wantee",
580
584
  "range": {
581
585
  "start": 32,
582
586
  "end": 37
583
587
  },
584
- "word": "wantee",
585
- "text": "wantee",
586
- "value": "wantee",
587
- "unknown": true,
588
588
  "dead": true,
589
589
  "level": 1
590
590
  }
@@ -639,32 +639,6 @@
639
639
  0
640
640
  ]
641
641
  ],
642
- [
643
- [
644
- "between",
645
- 0
646
- ],
647
- [
648
- "is",
649
- 0
650
- ],
651
- [
652
- "list",
653
- 0
654
- ],
655
- [
656
- "unknown",
657
- 0
658
- ],
659
- [
660
- "unknown",
661
- 1
662
- ],
663
- [
664
- "xfx",
665
- 0
666
- ]
667
- ],
668
642
  [
669
643
  [
670
644
  "between",
@@ -745,24 +719,6 @@
745
719
  1
746
720
  ]
747
721
  ],
748
- [
749
- [
750
- "between",
751
- 0
752
- ],
753
- [
754
- "is",
755
- 0
756
- ],
757
- [
758
- "unknown",
759
- 0
760
- ],
761
- [
762
- "xfx",
763
- 0
764
- ]
765
- ],
766
722
  [
767
723
  [
768
724
  "between",
@@ -1650,15 +1606,15 @@
1650
1606
  "text": "ikes y"
1651
1607
  },
1652
1608
  "liker": {
1609
+ "value": "x",
1610
+ "unknown": true,
1611
+ "text": "x",
1653
1612
  "marker": "unknown",
1613
+ "word": "x",
1654
1614
  "range": {
1655
1615
  "start": 3,
1656
1616
  "end": 3
1657
1617
  },
1658
- "word": "x",
1659
- "text": "x",
1660
- "value": "x",
1661
- "unknown": true,
1662
1618
  "dead": true,
1663
1619
  "types": [
1664
1620
  "unknown"
@@ -1666,15 +1622,15 @@
1666
1622
  "level": 1
1667
1623
  },
1668
1624
  "likee": {
1625
+ "value": "y",
1626
+ "unknown": true,
1627
+ "text": "y",
1669
1628
  "marker": "unknown",
1629
+ "word": "y",
1670
1630
  "range": {
1671
1631
  "start": 11,
1672
1632
  "end": 11
1673
1633
  },
1674
- "word": "y",
1675
- "text": "y",
1676
- "value": "y",
1677
- "unknown": true,
1678
1634
  "dead": true,
1679
1635
  "types": [
1680
1636
  "unknown"
@@ -1715,15 +1671,15 @@
1715
1671
  "text": ""
1716
1672
  },
1717
1673
  "lover": {
1674
+ "value": "x",
1675
+ "unknown": true,
1676
+ "text": "x",
1718
1677
  "marker": "unknown",
1678
+ "word": "x",
1719
1679
  "range": {
1720
1680
  "start": 16,
1721
1681
  "end": 16
1722
1682
  },
1723
- "word": "x",
1724
- "text": "x",
1725
- "value": "x",
1726
- "unknown": true,
1727
1683
  "dead": true,
1728
1684
  "types": [
1729
1685
  "unknown"
@@ -1731,15 +1687,15 @@
1731
1687
  "level": 1
1732
1688
  },
1733
1689
  "lovee": {
1690
+ "value": "y",
1691
+ "unknown": true,
1692
+ "text": "y",
1734
1693
  "marker": "unknown",
1694
+ "word": "y",
1735
1695
  "range": {
1736
1696
  "start": 24,
1737
1697
  "end": 24
1738
1698
  },
1739
- "word": "y",
1740
- "text": "y",
1741
- "value": "y",
1742
- "unknown": true,
1743
1699
  "dead": true,
1744
1700
  "types": [
1745
1701
  "unknown"
@@ -1786,15 +1742,15 @@
1786
1742
  "text": ""
1787
1743
  },
1788
1744
  "wanter": {
1745
+ "value": "x",
1746
+ "unknown": true,
1747
+ "text": "x",
1789
1748
  "marker": "unknown",
1749
+ "word": "x",
1790
1750
  "range": {
1791
1751
  "start": 31,
1792
1752
  "end": 31
1793
1753
  },
1794
- "word": "x",
1795
- "text": "x",
1796
- "value": "x",
1797
- "unknown": true,
1798
1754
  "dead": true,
1799
1755
  "types": [
1800
1756
  "unknown"
@@ -1802,15 +1758,15 @@
1802
1758
  "level": 1
1803
1759
  },
1804
1760
  "wantee": {
1761
+ "value": "y",
1762
+ "unknown": true,
1763
+ "text": "y",
1805
1764
  "marker": "unknown",
1765
+ "word": "y",
1806
1766
  "range": {
1807
1767
  "start": 39,
1808
1768
  "end": 39
1809
1769
  },
1810
- "word": "y",
1811
- "text": "y",
1812
- "value": "y",
1813
- "unknown": true,
1814
1770
  "dead": true,
1815
1771
  "types": [
1816
1772
  "unknown"
@@ -2078,20 +2034,6 @@
2078
2034
  "want",
2079
2035
  1
2080
2036
  ]
2081
- ],
2082
- [
2083
- [
2084
- "if",
2085
- 0
2086
- ],
2087
- [
2088
- "then",
2089
- 0
2090
- ],
2091
- [
2092
- "unknown",
2093
- 0
2094
- ]
2095
2037
  ]
2096
2038
  ],
2097
2039
  "learned_contextual_priorities": [],
@@ -2130,32 +2072,6 @@
2130
2072
  0
2131
2073
  ]
2132
2074
  ],
2133
- [
2134
- [
2135
- "between",
2136
- 0
2137
- ],
2138
- [
2139
- "is",
2140
- 0
2141
- ],
2142
- [
2143
- "list",
2144
- 0
2145
- ],
2146
- [
2147
- "unknown",
2148
- 0
2149
- ],
2150
- [
2151
- "unknown",
2152
- 1
2153
- ],
2154
- [
2155
- "xfx",
2156
- 0
2157
- ]
2158
- ],
2159
2075
  [
2160
2076
  [
2161
2077
  "between",
@@ -2236,24 +2152,6 @@
2236
2152
  1
2237
2153
  ]
2238
2154
  ],
2239
- [
2240
- [
2241
- "between",
2242
- 0
2243
- ],
2244
- [
2245
- "is",
2246
- 0
2247
- ],
2248
- [
2249
- "unknown",
2250
- 0
2251
- ],
2252
- [
2253
- "xfx",
2254
- 0
2255
- ]
2256
- ],
2257
2155
  [
2258
2156
  [
2259
2157
  "between",
@@ -2498,20 +2396,6 @@
2498
2396
  1
2499
2397
  ]
2500
2398
  ],
2501
- [
2502
- [
2503
- "if",
2504
- 0
2505
- ],
2506
- [
2507
- "then",
2508
- 0
2509
- ],
2510
- [
2511
- "unknown",
2512
- 0
2513
- ]
2514
- ],
2515
2399
  [
2516
2400
  [
2517
2401
  "is",
@@ -6,7 +6,7 @@ const ordering_instance = require('./ordering.instance.json')
6
6
  const { API } = require('./helpers/ordering')
7
7
 
8
8
  const template ={
9
- "queries": [
9
+ configs: [
10
10
  "wants is xfx between wanter and wantee",
11
11
  // "if a likes or loves b then a wants b",
12
12
  "if x likes y or x loves y then x wants y",