tpmkms_4wp 8.0.0-beta.7 → 8.0.0-beta.70

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 (103) hide show
  1. package/common/animals.instance.json +2871 -1379
  2. package/common/animals.js +17 -20
  3. package/common/articles.js +103 -0
  4. package/common/articles.test.json +310 -0
  5. package/common/avatar.js +5 -9
  6. package/common/characters.js +22 -28
  7. package/common/colors.instance.json +7170 -3657
  8. package/common/colors.js +4 -8
  9. package/common/colors.test.json +345 -780
  10. package/common/comparable.instance.json +1750 -0
  11. package/common/comparable.js +36 -28
  12. package/common/comparable.test.json +438 -2
  13. package/common/concept.js +120 -118
  14. package/common/countable.js +19 -13
  15. package/common/countable.test.json +1050 -0
  16. package/common/crew.instance.json +13066 -6469
  17. package/common/crew.js +36 -41
  18. package/common/crew.test.json +714 -452
  19. package/common/currency.js +27 -45
  20. package/common/dialogues.js +161 -285
  21. package/common/dimension.instance.json +474 -253
  22. package/common/dimension.js +16 -22
  23. package/common/dimension.test.json +446 -1640
  24. package/common/edible.instance.json +20053 -10093
  25. package/common/edible.js +3 -8
  26. package/common/emotions.instance.json +147 -69
  27. package/common/emotions.js +35 -38
  28. package/common/evaluate.instance.json +2 -0
  29. package/common/evaluate.js +49 -0
  30. package/common/evaluate.test.json +574 -0
  31. package/common/events.js +10 -14
  32. package/common/fastfood.instance.json +221166 -111223
  33. package/common/fastfood.js +75 -85
  34. package/common/fastfood.test.json +268 -90
  35. package/common/formulas.instance.json +455 -249
  36. package/common/formulas.js +19 -26
  37. package/common/gdefaults.js +24 -26
  38. package/common/help.js +7 -12
  39. package/common/help.test.json +63 -8
  40. package/common/helpers/concept.js +10 -7
  41. package/common/helpers/dialogues.js +2 -3
  42. package/common/helpers/properties.js +54 -62
  43. package/common/helpers.js +6 -5
  44. package/common/hierarchy.js +16 -24
  45. package/common/javascript.js +11 -18
  46. package/common/kirk.instance.json +584 -290
  47. package/common/kirk.js +5 -8
  48. package/common/length.instance.json +8834 -4757
  49. package/common/length.js +4 -8
  50. package/common/listener.js +48 -0
  51. package/common/listener.test.json +104 -0
  52. package/common/math.instance.json +425 -1187
  53. package/common/math.js +16 -20
  54. package/common/meta.js +23 -47
  55. package/common/nameable.instance.json +2 -0
  56. package/common/nameable.js +144 -0
  57. package/common/nameable.test.json +3191 -0
  58. package/common/negation.instance.json +2 -0
  59. package/common/negation.js +38 -0
  60. package/common/negation.test.json +308 -0
  61. package/common/numbers.js +27 -31
  62. package/common/ordering.instance.json +366 -246
  63. package/common/ordering.js +80 -86
  64. package/common/people.instance.json +2074 -1022
  65. package/common/people.js +8 -13
  66. package/common/percentages.instance.json +2 -0
  67. package/common/percentages.js +53 -0
  68. package/common/percentages.test.json +751 -0
  69. package/common/pipboy.instance.json +11745 -6329
  70. package/common/pipboy.js +48 -59
  71. package/common/pokemon.instance.json +4226 -2081
  72. package/common/pokemon.js +7 -20
  73. package/common/pos.js +15 -13
  74. package/common/pressure.instance.json +2208 -1175
  75. package/common/pressure.js +4 -8
  76. package/common/properties.instance.json +131 -61
  77. package/common/properties.js +57 -134
  78. package/common/punctuation.js +15 -7
  79. package/common/reports.instance.json +1018 -530
  80. package/common/reports.js +77 -100
  81. package/common/reports.test.json +15623 -10458
  82. package/common/scorekeeper.js +18 -30
  83. package/common/sdefaults.js +16 -7
  84. package/common/sizeable.js +6 -10
  85. package/common/spock.instance.json +584 -290
  86. package/common/spock.js +5 -8
  87. package/common/stgame.js +19 -19
  88. package/common/stm.js +164 -27
  89. package/common/stm.test.json +1734 -1
  90. package/common/tell.js +14 -18
  91. package/common/temperature.instance.json +2271 -1222
  92. package/common/temperature.js +4 -8
  93. package/common/tester.js +15 -4
  94. package/common/testing.js +8 -12
  95. package/common/time.js +20 -25
  96. package/common/tokenize.js +5 -6
  97. package/common/ui.instance.json +459 -240
  98. package/common/ui.js +16 -22
  99. package/common/weight.instance.json +7646 -4026
  100. package/common/weight.js +4 -8
  101. package/common/yesno.js +5 -5
  102. package/main.js +14 -2
  103. package/package.json +28 -5
package/common/concept.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, flatten, where, Digraph } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, flatten, where, Digraph } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const { API }= require('./helpers/concept')
4
4
  const dialogues = require('./dialogues.js')
@@ -14,135 +14,137 @@ const concept_instance = require('./concept.instance.json')
14
14
  plain and regular fries mean the same thing
15
15
  */
16
16
 
17
- const createConfig = () => {
18
- const config = new Config({
19
- name: 'concept',
20
- operators: [
21
- "((context.punctuation != true)* [modifies|] (concept))",
22
- "([concept])",
23
- "([literally] (modifies/0))",
24
- ],
25
- bridges: [
26
- {
27
- id: "modifies",
28
- isA: ['verby'],
29
- words: [{ word: 'modifies', number: 'one', flatten: false }, { word: 'modify', number: 'many', flatten: true }],
30
- // bridge: "{ ...next(operator), modifiers: before, concept: after[0], flatten: true }"
31
- bridge: "{ ...next(operator), modifiers: before, concept: after[0] }"
32
- },
33
- { id: "literally", bridge: "{ ...after[0], flatten: false, literally: true }" },
34
- { id: "concept", bridge: "{ ...next(operator) }" },
35
- ],
36
- priorities: [
37
- { "context": [['literally', 0], ['modifies', 0], ], "choose": [0] },
38
- ],
39
- hierarchy: [
40
- ['concept', 'theAble'],
41
- ['concept', 'queryable'],
42
- ],
43
- generators: [
44
- {
45
- notes: '"fire type, water type and earth type" to "fire water and earth type"',
46
- /*
47
- {
48
- "water": {
49
- "marker": "water",
50
- "value": "water",
51
- "word": "water"
52
- },
53
- "marker": "water_type",
54
- "modifiers": [
55
- "water"
56
- ],
57
- "types": [
58
- "water_type"
59
- ],
60
- "value": "water_type",
61
- "word": "type",
62
- "paraphrase": true
17
+ config = {
18
+ name: 'concept',
19
+ operators: [
20
+ "((context.punctuation != true)* [modifies|] (concept))",
21
+ "([concept])",
22
+ "([literally] (modifies/0))",
23
+ ],
24
+ bridges: [
25
+ {
26
+ id: "modifies",
27
+ isA: ['verb'],
28
+ words: [{ word: 'modifies', number: 'one', flatten: false }, { word: 'modify', number: 'many', flatten: true }],
29
+ // bridge: "{ ...next(operator), modifiers: before, concept: after[0], flatten: true }"
30
+ bridge: "{ ...next(operator), modifiers: before, concept: after[0] }"
31
+ },
32
+ { id: "literally", bridge: "{ ...after[0], flatten: false, literally: true }" },
33
+ { id: "concept", bridge: "{ ...next(operator) }" },
34
+ ],
35
+ priorities: [
36
+ { "context": [['literally', 0], ['modifies', 0], ], "choose": [0] },
37
+ ],
38
+ hierarchy: [
39
+ ['concept', 'theAble'],
40
+ ['concept', 'queryable'],
41
+ ],
42
+ generators: [
43
+ {
44
+ notes: '"fire type, water type and earth type" to "fire water and earth type"',
45
+ /*
46
+ {
47
+ "water": {
48
+ "marker": "water",
49
+ "value": "water",
50
+ "word": "water"
63
51
  },
64
- */
65
- where: where(),
66
- match: ({context}) => {
67
- if (!context.paraphrase) {
68
- return
69
- }
70
- if (context.marker !== 'list') {
71
- return
72
- }
73
- if ((context.value || []).length < 2) {
74
- return
75
- }
76
- if (!context.value[0].word) {
77
- return
78
- }
79
- const word = context.value[0].word
80
-
81
- for (let value of context.value) {
82
- if (!(value.modifiers && value.modifiers.length == 1 && value.word == word)) {
83
- return
84
- }
85
- }
86
- return true
52
+ "marker": "water_type",
53
+ "modifiers": [
54
+ "water"
55
+ ],
56
+ "types": [
57
+ "water_type"
58
+ ],
59
+ "value": "water_type",
60
+ "word": "type",
61
+ "paraphrase": true
87
62
  },
88
- apply: ({g, context}) => {
89
- const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
90
- context.word = context.value[0].word
91
- context.value = null
92
- context.modifiers = ['modifier']
93
- context.modifier = {
94
- marker: 'list',
95
- paraphrase: true,
96
- value: modifiers
97
- }
98
- context.paraphrase = true
99
- return g(context)
63
+ */
64
+ where: where(),
65
+ match: ({context}) => {
66
+ if (!context.paraphrase) {
67
+ return
100
68
  }
101
- },
102
- {
103
- where: where(),
104
- match: ({context}) => context.marker == 'modifies' && context.paraphrase,
105
- apply: ({context, gp, gw}) => {
106
- if (context.literally) {
107
- return `${context.modifiers.map(gp).join(" ")} literally ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
108
- } else {
109
- return `${context.modifiers.map(gp).join(" ")} ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
110
- }
69
+ if (context.marker !== 'list') {
70
+ return
111
71
  }
112
- // const chosen = chooseNumber(context, word.singular, word.plural)
113
- },
114
- ],
115
- semantics: [
116
- {
117
- notes: 'define a modifier',
118
- where: where(),
119
- match: ({context}) => context.marker == 'modifies',
120
- apply: ({config, query, km, context}) => {
121
- let modifiers
122
- if (context.literally) {
123
- literalModifiers = context.modifiers[0]
124
- modifiers = literalModifiers.value.map(modifier => modifier.value)
125
- modifiers = modifiers.slice(0, -1).concat([literalModifiers.marker]).concat(modifiers.slice(-1))
126
- } else {
127
- modifiers = context.modifiers.map(modifier => modifier.value)
72
+ if ((context.value || []).length < 2) {
73
+ return
74
+ }
75
+ if (!context.value[0].word) {
76
+ return
77
+ }
78
+ const word = context.value[0].word
79
+
80
+ for (let value of context.value) {
81
+ if (!(value.modifiers && value.modifiers.length == 1 && value.word == word)) {
82
+ return
128
83
  }
129
- // km('concept').api.kindOfConcept({ config, modifiers, object: context.concept.value || context.concept.marker })
130
- km('concept').api.kindOfConcept({ config, modifiers, object: context.concept })
131
84
  }
85
+ return true
132
86
  },
133
- ],
134
- }, module)
135
- config.stop_auto_rebuild()
136
- config.api = new API()
137
- config.add(dialogues())
138
- config.restart_auto_rebuild()
139
- return config
87
+ apply: async ({g, context}) => {
88
+ const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
89
+ context.word = context.value[0].word
90
+ context.value = null
91
+ context.modifiers = ['modifier']
92
+ context.modifier = {
93
+ marker: 'list',
94
+ paraphrase: true,
95
+ value: modifiers
96
+ }
97
+ context.paraphrase = true
98
+ return await g(context)
99
+ }
100
+ },
101
+ {
102
+ where: where(),
103
+ match: ({context}) => context.marker == 'modifies' && context.paraphrase,
104
+ apply: async ({context, gp, gw}) => {
105
+ const modifiers = []
106
+ for (modifier of context.modifiers) {
107
+ modifiers.push(await gp(modifier))
108
+ }
109
+ if (context.literally) {
110
+ return `${modifiers.join(" ")} literally ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
111
+ } else {
112
+ return `${modifiers.join(" ")} ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
113
+ }
114
+ }
115
+ // const chosen = chooseNumber(context, word.singular, word.plural)
116
+ },
117
+ ],
118
+ semantics: [
119
+ {
120
+ notes: 'define a modifier',
121
+ where: where(),
122
+ match: ({context}) => context.marker == 'modifies',
123
+ apply: ({config, query, km, context}) => {
124
+ let modifiers
125
+ if (context.literally) {
126
+ literalModifiers = context.modifiers[0]
127
+ // modifiers = literalModifiers.value.map(modifier => modifier.value)
128
+ modifiers = literalModifiers.value
129
+ modifiers = modifiers.slice(0, -1).concat([literalModifiers.marker]).concat(modifiers.slice(-1))
130
+ } else {
131
+ modifiers = context.modifiers
132
+ // modifiers = context.modifiers.map(modifier => modifier.value)
133
+ }
134
+ // km('concept').api.kindOfConcept({ config, modifiers, object: context.concept.value || context.concept.marker })
135
+ km('concept').api.kindOfConcept({ config, modifiers, object: context.concept })
136
+ }
137
+ },
138
+ ],
140
139
  }
141
140
 
142
141
  knowledgeModule({
142
+ config,
143
+ includes: [dialogues],
144
+ api: () => new API(),
145
+
143
146
  module,
144
147
  description: 'The idea of a concept whatever that might end up being',
145
- createConfig,
146
148
  test: {
147
149
  name: './concept.test.json',
148
150
  contents: concept_tests,
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require("./hierarchy")
4
4
  const numbers = require("./numbers")
@@ -11,12 +11,14 @@ const countable_tests = require('./countable.test.json')
11
11
  2 6 and 3 10 piece nuggets
12
12
  */
13
13
 
14
- let configStruct = {
14
+ let config = {
15
15
  name: 'countable',
16
16
  operators: [
17
17
  "(([quantifier|]) [counting] ([countable]))",
18
18
  "(([number|]) [countOfPieces|] ([piece]))",
19
19
  "((countOfPieces/*) [countingPieces] ([hasCountOfPieces]))",
20
+ "([more] (countable/*))",
21
+ "([less] (countable/*))",
20
22
  "([all])",
21
23
  // everything
22
24
  ],
@@ -24,7 +26,7 @@ let configStruct = {
24
26
  {
25
27
  id: "counting",
26
28
  convolution: true,
27
- before: ['verby'],
29
+ before: ['verb'],
28
30
  bridge: "{ ...after, modifiers: append(['quantity'], after[0].modifiers), quantity: before[0], number: default(before[0].number, before[0].value), instance: true }"
29
31
  },
30
32
  {
@@ -44,6 +46,14 @@ let configStruct = {
44
46
  {
45
47
  id: "piece",
46
48
  },
49
+ {
50
+ id: "more",
51
+ bridge: "{ ...next(after[0]), more: operator, modifiers: append(['more'], after[0].modifiers) }",
52
+ },
53
+ {
54
+ id: "less",
55
+ bridge: "{ ...next(after[0]), less: operator, modifiers: append(['less'], after[0].modifiers) }",
56
+ },
47
57
  {
48
58
  id: "quantifier",
49
59
  children: ['number', 'all'],
@@ -63,28 +73,24 @@ let configStruct = {
63
73
  {
64
74
  where: where(),
65
75
  match: ({context}) => false && context.quantity,
66
- apply: ({context, g}) => {
76
+ apply: async ({context, g}) => {
67
77
  let number = context.quantity.number || 'one'
68
78
  if (context.quantity.value > 1) {
69
79
  number = 'many'
70
80
  }
71
- const countable = g({ ...context, quantity: undefined, number})
72
- return `${g(context.quantity)} ${countable}`
81
+ const countable = await g({ ...context, quantity: undefined, number})
82
+ return `${await g(context.quantity)} ${countable}`
73
83
  }
74
84
  },
75
85
  ]
76
86
  };
77
87
 
78
- const createConfig = () => {
79
- const config = new Config(configStruct, module)
80
- config.add(dialogues(), numbers())
81
- return config
82
- }
83
-
84
88
  knowledgeModule({
89
+ config,
90
+ includes: [dialogues, numbers],
91
+
85
92
  module,
86
93
  description: 'Countable things',
87
- createConfig,
88
94
  test: {
89
95
  name: './countable.test.json',
90
96
  contents: countable_tests,