tpmkms_4wp 9.5.1 → 9.6.0-beta.1

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 (135) hide show
  1. package/common/animals.instance.json +151 -61
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +116 -106
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2194 -0
  6. package/common/can.js +251 -0
  7. package/common/can.test.json +51307 -0
  8. package/common/characters.js +5 -5
  9. package/common/colors.instance.json +152 -12
  10. package/common/colors.js +3 -6
  11. package/common/comparable.instance.json +33 -3
  12. package/common/comparable.js +3 -6
  13. package/common/concept.js +25 -27
  14. package/common/concept.test.json +180 -144
  15. package/common/conjunction.js +13 -5
  16. package/common/conjunction.test.json +32 -42
  17. package/common/crew.instance.json +433 -173
  18. package/common/crew.js +4 -7
  19. package/common/crew.test.json +4148 -3324
  20. package/common/currency.js +1 -1
  21. package/common/dateTimeSelectors.instance.json +2 -2
  22. package/common/dateTimeSelectors.js +6 -9
  23. package/common/dateTimeSelectors.test.json +76935 -35739
  24. package/common/dates.instance.json +53 -3
  25. package/common/dates.js +3 -6
  26. package/common/dates.test.json +284 -287
  27. package/common/dialogues.js +43 -122
  28. package/common/dialogues.test.json +1248 -1152
  29. package/common/dimension.instance.json +21493 -561
  30. package/common/dimension.js +150 -55
  31. package/common/dimension.test.json +10979 -4625
  32. package/common/drone.instance.json +24709 -0
  33. package/common/drone.js +662 -0
  34. package/common/drone.test.json +30522 -0
  35. package/common/drone_v1.instance.json +24703 -0
  36. package/common/drone_v1.js +596 -0
  37. package/common/drone_v1.test.json +115538 -0
  38. package/common/edible.instance.json +388 -32
  39. package/common/edible.js +3 -5
  40. package/common/emotions.instance.json +85 -76
  41. package/common/emotions.js +4 -7
  42. package/common/emotions.test.json +242 -174
  43. package/common/english_helpers.js +336 -0
  44. package/common/errors.js +6 -6
  45. package/common/evaluate.js +2 -2
  46. package/common/events.js +8 -8
  47. package/common/fastfood.instance.json +1071 -393
  48. package/common/fastfood.js +14 -16
  49. package/common/fastfood.test.json +6970 -6829
  50. package/common/formulas.instance.json +11 -1
  51. package/common/formulas.js +3 -2
  52. package/common/gdefaults.js +111 -17
  53. package/common/help.js +12 -12
  54. package/common/help.test.json +65 -11
  55. package/common/helpers/concept.js +1 -1
  56. package/common/helpers/conjunction.js +54 -44
  57. package/common/helpers/dateTimeSelectors.js +2 -2
  58. package/common/helpers/dialogues.js +10 -2
  59. package/common/helpers/formulas.js +13 -11
  60. package/common/helpers/menus.js +12 -12
  61. package/common/helpers/meta.js +9 -9
  62. package/common/helpers/properties.js +186 -64
  63. package/common/helpers.js +167 -48
  64. package/common/hierarchy.js +12 -10
  65. package/common/kirk.instance.json +11 -1
  66. package/common/kirk.js +4 -6
  67. package/common/kirk.test.json +600 -424
  68. package/common/latin.instance.json +12 -12
  69. package/common/latin.js +12 -14
  70. package/common/length.instance.json +34660 -3158
  71. package/common/length.js +11 -6
  72. package/common/length.test.json +54357 -2557
  73. package/common/math.instance.json +39 -29
  74. package/common/math.js +49 -47
  75. package/common/menus.instance.json +77 -10
  76. package/common/menus.js +4 -13
  77. package/common/meta.js +80 -65
  78. package/common/nameable.js +36 -22
  79. package/common/nameable.test.json +436 -0
  80. package/common/numbers.js +1 -1
  81. package/common/ordering.instance.json +107 -19
  82. package/common/ordering.js +4 -6
  83. package/common/ordering.test.json +835 -417
  84. package/common/people.instance.json +176 -348
  85. package/common/people.js +9 -9
  86. package/common/people.test.json +4135 -3606
  87. package/common/pipboy.instance.json +187 -17
  88. package/common/pipboy.js +4 -4
  89. package/common/pokemon.instance.json +143 -13
  90. package/common/pokemon.js +4 -6
  91. package/common/pressure.instance.json +3610 -1601
  92. package/common/pressure.js +3 -5
  93. package/common/pressure.test.json +433 -477
  94. package/common/properties.instance.json +16 -17
  95. package/common/properties.js +32 -13
  96. package/common/properties.test.json +9565 -6951
  97. package/common/rates.instance.json +59 -0
  98. package/common/rates.js +95 -0
  99. package/common/rates.test.json +27702 -0
  100. package/common/reminders.instance.json +4 -4
  101. package/common/reminders.js +8 -11
  102. package/common/reminders.test.json +64635 -25787
  103. package/common/reports.instance.json +23 -3
  104. package/common/reports.js +21 -21
  105. package/common/scorekeeper.js +9 -12
  106. package/common/sdefaults.js +22 -2
  107. package/common/spock.instance.json +11 -1
  108. package/common/spock.js +4 -7
  109. package/common/spock.test.json +606 -430
  110. package/common/stgame.js +1 -1
  111. package/common/stm.js +41 -24
  112. package/common/tell.js +1 -1
  113. package/common/temperature.instance.json +3163 -1154
  114. package/common/temperature.js +3 -5
  115. package/common/temperature.test.json +433 -477
  116. package/common/tester.js +3 -3
  117. package/common/time.instance.json +24852 -0
  118. package/common/time.js +138 -141
  119. package/common/time.test.json +31876 -3757
  120. package/common/tokenize.js +5 -2
  121. package/common/ui.instance.json +12 -5
  122. package/common/ui.js +4 -13
  123. package/common/weight.instance.json +10501 -4099
  124. package/common/weight.js +3 -5
  125. package/common/weight.test.json +2601 -2263
  126. package/common/words.instance.json +9 -0
  127. package/common/words.js +50 -0
  128. package/common/words.test.json +2 -0
  129. package/common/wp.instance.json +548 -8
  130. package/common/wp.js +10 -8
  131. package/common/wp.test.json +7385 -6906
  132. package/main.js +6 -2
  133. package/package.json +25 -6
  134. package/common/listener.js +0 -50
  135. package/common/listener.test.json +0 -142
package/common/can.js ADDED
@@ -0,0 +1,251 @@
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
+ const { defaultContextCheck, propertyToArray } = require('./helpers')
3
+ const hierarchy = require("./hierarchy")
4
+ const tests = require('./can.test.json')
5
+ const instance = require('./can.instance.json')
6
+
7
+ /*
8
+ you can make these coffees -> list of coffees
9
+ the coffees you can make are list of coffees
10
+ fred can fly these planes.
11
+ what can you make?
12
+ what can fred fly?
13
+ you can order a product
14
+ you can modify a document
15
+ what can you do
16
+ what can you do with a document
17
+ i order a product
18
+
19
+ fred bob and stan can make coffee
20
+ fred can make capucino bob americano and stan lattes
21
+ ask someone to make me an americano
22
+ who do I ask to make an american
23
+
24
+ have a way to convert from active to passive
25
+
26
+ DONE what can fred make
27
+ DONE can bob make coffee
28
+
29
+ DONE coffee can be made by joe
30
+ DONE who can coffee be made by
31
+ DONE who can make coffee and tea
32
+
33
+ DONE can bob make coffee
34
+ DONE what can bob make
35
+ */
36
+
37
+ const config = {
38
+ name: 'can',
39
+ operators: [
40
+ // "([can] (canableAction && context.infinitive))",
41
+ "((*) [canableAction] (*))",
42
+ "(<canStatement|can> (canableAction/0))",
43
+ "(<canQuestion|can> (canableAction/1))",
44
+ // what can joe make
45
+ "((*) [whatCanQuestion|can] (*) (canableAction))",
46
+ // who can coffee be made by
47
+ "((*) [whatCanQuestionPassive|can] (*) ([beCanPassive|be]) (canableAction) ([byCanPassive|by]))",
48
+ "((*) [canPassive|can] ([beCanPassive|be]) (canableAction) ([byCanPassive|by]) (*))",
49
+ ],
50
+ bridges: [
51
+ { id: 'beCanPassive' },
52
+ { id: 'byCanPassive' },
53
+ {
54
+ id: "canableAction",
55
+ isA: ['verb'],
56
+ },
57
+ {
58
+ id: "canStatement",
59
+ before: ['verb'],
60
+ bridge: "{ ...after[0], can: operator, verb: after[0], voice: 'active', interpolate: [{ property: 'can' }, { property: 'verb', context: { number: 'one' } }]}",
61
+ },
62
+ {
63
+ id: "canQuestion",
64
+ before: ['verb'],
65
+ bridge: "{ ...after[0], operator.form: 'infinitive', voice: 'active', truthValueOnly: true, query: true, can: operator, interpolate: append([{ property: 'can'}], after[0].interpolate)}",
66
+ },
67
+ {
68
+ // "((*) [canPassive|can] ([beCanPassive|be]) (canableAction) ([byCanPassive|by]) (*))",
69
+ id: "canPassive",
70
+ before: ['verb'],
71
+ bridge: [
72
+ // { "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1], interpolate: [{ property: 'can' }, { property: 'operator' }] }", "set": "operator" },
73
+ { "apply": true, "bridge": "{ ...after[1], can: operator, be: after[0], operator: after[1], by: after[2] }", "set": "operator" },
74
+ {
75
+ "rewire": [
76
+ { "from": 'before[0]', "to": 'after[0]' },
77
+ { "from": 'after[3]', "to": 'before[0]' },
78
+ ]
79
+ },
80
+ { "apply": true, "operator": "operator", "set": "context" },
81
+ { "apply": true, "bridge": "{ ...context, voice: 'passive', interpolate: [context.interpolate[2], { word: { marker: 'canPassive' } }, { word: { marker: 'beCanPassive' } }, context.interpolate[1], { word: { marker: 'byCanPassive' } }, context.interpolate[0]] }", "set": "context" },
82
+ // { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
83
+ ],
84
+ },
85
+ {
86
+ // "((*) [whatCanQuestionPassive|can] (*) ([beCanPassive|be]) (canableAction) ([byCanPassive|by]))",
87
+ id: "whatCanQuestionPassive",
88
+ before: ['verb'],
89
+ bridge: [
90
+ // { "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1], interpolate: [{ property: 'can' }, { property: 'operator' }] }", "set": "operator" },
91
+ { "apply": true, "bridge": "{ ...after[2], can: operator, be: after[1], operator: after[2], by: after[3] }", "set": "operator" },
92
+ { "apply": true, "operator": "operator", "set": "context" },
93
+ { "apply": true, "bridge": "{ ...context, voice: 'passive', interpolate: [context.interpolate[0], { word: { marker: 'canPassive' } }, context.interpolate[2], { word: { marker: 'beCanPassive' } }, context.interpolate[1], { word: { marker: 'byCanPassive' } }] }", "set": "context" },
94
+ // { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
95
+ ],
96
+ },
97
+ {
98
+ id: "whatCanQuestion",
99
+ before: ['verb'],
100
+ bridge: [
101
+ // { "apply": true, "bridge": "{ ...after[1], can: operator, operator: after[1], interpolate: [{ property: 'can' }, { property: 'operator' }] }", "set": "operator" },
102
+ { "apply": true, "bridge": "{ ...after[1], can: operator, voice: 'active', operator: after[1] }", "set": "operator" },
103
+ {
104
+ "rewire": [
105
+ { "from": 'before[0]', "to": 'after[0]' },
106
+ { "from": 'after[0]', "to": 'before[0]' },
107
+ ]
108
+ },
109
+ { "apply": true, "operator": "operator", "set": "context" },
110
+ { "apply": true, "bridge": "{ ...context, operator.form: 'infinitive', interpolate: [context.interpolate[2], { property: 'can' }, context.interpolate[0], context.interpolate[1]] }", "set": "context" },
111
+ // { "apply": true, "bridge": "{ ...context, interpolate: [context.interpolate[2], context.interpolate[0], context.interpolate[1]] }", set: "context" },
112
+ ],
113
+ },
114
+ ],
115
+ semantics: [
116
+ {
117
+ match: ({context}) => context.toVoice == 'passive',
118
+ apply: async ({g, context, fragmentMapper}) => {
119
+ for (const element of propertyToArray(context)) {
120
+ if (!element.voice) {
121
+ continue
122
+ }
123
+ if (element.voice === 'passive') {
124
+ continue
125
+ }
126
+ // From
127
+ // [{"property":"canSubject"},{"property":"operator","number":"canSubject"},{"property":"canObject"}]
128
+ element.interpolate = [
129
+ element.interpolate[2],
130
+ { word: { marker: "canPassive" } },
131
+ { word: { marker: "beCanPassive" } },
132
+ // { tense: "perfect", property: "verb" },
133
+ { semantic: [{ property: "verb" }, { overrides: { tense: "perfect", evaluateWord: true } }] },
134
+ { word: { marker: "byCanPassive" } },
135
+ element.interpolate[0],
136
+ ]
137
+ element.voice = 'passive'
138
+ }
139
+ }
140
+ },
141
+ {
142
+ match: ({context}) => context.toVoice == 'active',
143
+ apply: async ({g, context, fragmentMapper}) => {
144
+ // From
145
+ // [{"property":"canSubject"},{"property":"operator","number":"canSubject"},{"property":"canObject"}]
146
+ for (const element of propertyToArray(context)) {
147
+ if (!element.voice) {
148
+ continue
149
+ }
150
+ if (element.voice === 'active') {
151
+ continue
152
+ }
153
+ element.interpolate = [
154
+ element.interpolate[5],
155
+ { "word": { "marker": "canPassive" } },
156
+ // { "number": element.interpolate[5].property, "property": "operator" },
157
+ { semantic: [{ property: "operator" }, { overrides: { form: "infinitive", evaluateWord: true } }] },
158
+ element.interpolate[0],
159
+ ]
160
+ element.voice = 'active'
161
+ }
162
+ }
163
+ },
164
+ ],
165
+ };
166
+
167
+ const template = {
168
+ fragments: [
169
+ "canobject can be canverb by cansubject",
170
+ "cansubject can canverb canobject",
171
+ ],
172
+
173
+ configs: [
174
+ ({isProcess, isTesting, testModuleName, apis, config, addHierarchy}) => {
175
+ if (isProcess || isTesting) {
176
+ const api = apis('properties')
177
+ api.createActionPrefix({
178
+ before: [{tag: 'maker', id: 'maker'}],
179
+ operator: 'make',
180
+ after: [{tag: 'makeable', id: 'makeable'}],
181
+ relation: true,
182
+ flatten: true,
183
+ can: true,
184
+ create: [
185
+ {
186
+ id: 'make',
187
+ infinitive: 'make',
188
+ },
189
+ 'makeable',
190
+ 'maker'
191
+ ],
192
+ localHierarchy: [
193
+ ['unknown', 'maker'],
194
+ ['unknown', 'makeable'],
195
+ ],
196
+ config,
197
+ })
198
+ }
199
+ const api = apis('properties')
200
+ api.createActionPrefix({
201
+ before: [{tag: 'canSubject', id: 'canSubject'}],
202
+ operator: 'canVerb',
203
+ after: [{tag: 'canObject', id: 'canObject'}],
204
+ relation: true,
205
+ flatten: true,
206
+ can: true,
207
+ create: [
208
+ {
209
+ id: 'canVerb',
210
+ },
211
+ 'canObject',
212
+ 'canSubject'
213
+ ],
214
+ localHierarchy: [
215
+ ['unknown', 'canObject'],
216
+ ['unknown', 'canSubject'],
217
+ ],
218
+ config,
219
+ })
220
+ },
221
+ async ({fragments, addWordToDictionary}) => {
222
+ const fragment = await fragments("canobject can be canverb by cansubject")
223
+ // only run after rebuild template
224
+ if (fragment) {
225
+ const context = fragment.contexts()[0]
226
+ addWordToDictionary(context.be)
227
+ addWordToDictionary(context.by)
228
+ addWordToDictionary(context.can)
229
+ }
230
+ },
231
+ ]
232
+ }
233
+
234
+ knowledgeModule( {
235
+ config,
236
+ includes: [hierarchy],
237
+
238
+ module,
239
+ description: 'talk about what can be done',
240
+ test: {
241
+ name: './can.test.json',
242
+ contents: tests,
243
+ checks: {
244
+ context: [
245
+ defaultContextCheck({ extra: ['can', 'evalue', 'makeable', 'maker', 'operator', 'interpolate', 'number', 'property', 'word'] }),
246
+ ],
247
+ },
248
+ },
249
+ instance,
250
+ template,
251
+ })