tpmkms 9.5.0 → 9.5.1-beta.10

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 (83) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +106 -104
  3. package/common/can.instance.json +17 -0
  4. package/common/can.js +188 -0
  5. package/common/characters.js +5 -5
  6. package/common/colors.instance.json +38 -10
  7. package/common/comparable.instance.json +2 -2
  8. package/common/concept.test.json +54 -40
  9. package/common/conjunction.js +13 -5
  10. package/common/crew.instance.json +71 -85
  11. package/common/crew.js +1 -1
  12. package/common/crew.test.json +4148 -3324
  13. package/common/currency.js +1 -1
  14. package/common/dates.instance.json +87 -3
  15. package/common/dialogues.js +12 -9
  16. package/common/dimension.instance.json +9 -9
  17. package/common/dimension.js +4 -4
  18. package/common/edible.instance.json +79 -23
  19. package/common/emotions.instance.json +29 -7
  20. package/common/emotions.js +1 -1
  21. package/common/emotions.test.json +242 -174
  22. package/common/english_helpers.js +336 -0
  23. package/common/errors.js +3 -3
  24. package/common/evaluate.js +2 -2
  25. package/common/events.js +8 -8
  26. package/common/fastfood.instance.json +205 -553
  27. package/common/fastfood.js +4 -4
  28. package/common/formulas.instance.json +1 -1
  29. package/common/formulas.js +1 -1
  30. package/common/gdefaults.js +58 -9
  31. package/common/help.js +3 -3
  32. package/common/helpers/concept.js +1 -1
  33. package/common/helpers/conjunction.js +54 -44
  34. package/common/helpers/dateTimeSelectors.js +2 -2
  35. package/common/helpers/dialogues.js +1 -1
  36. package/common/helpers/formulas.js +13 -11
  37. package/common/helpers/menus.js +12 -12
  38. package/common/helpers/meta.js +9 -9
  39. package/common/helpers/properties.js +158 -55
  40. package/common/helpers.js +135 -46
  41. package/common/hierarchy.js +3 -3
  42. package/common/kirk.instance.json +1 -1
  43. package/common/latin.instance.json +2 -2
  44. package/common/latin.js +4 -4
  45. package/common/length.instance.json +2 -2
  46. package/common/listener.js +1 -1
  47. package/common/math.instance.json +28 -28
  48. package/common/math.js +47 -46
  49. package/common/menus.instance.json +3 -3
  50. package/common/menus.js +1 -1
  51. package/common/meta.js +76 -60
  52. package/common/nameable.js +7 -7
  53. package/common/ordering.instance.json +85 -19
  54. package/common/ordering.js +1 -1
  55. package/common/ordering.test.json +786 -298
  56. package/common/people.instance.json +59 -56
  57. package/common/people.js +6 -4
  58. package/common/people.test.json +4135 -3606
  59. package/common/pipboy.instance.json +72 -16
  60. package/common/pipboy.js +2 -3
  61. package/common/pokemon.instance.json +8 -8
  62. package/common/pokemon.js +1 -1
  63. package/common/pressure.instance.json +2 -2
  64. package/common/properties.instance.json +1 -1
  65. package/common/properties.js +22 -4
  66. package/common/reminders.instance.json +4 -4
  67. package/common/reminders.js +3 -3
  68. package/common/reports.instance.json +3 -3
  69. package/common/reports.js +18 -16
  70. package/common/scorekeeper.js +6 -6
  71. package/common/sdefaults.js +22 -2
  72. package/common/spock.instance.json +1 -1
  73. package/common/stgame.js +1 -1
  74. package/common/stm.js +4 -4
  75. package/common/tell.js +1 -1
  76. package/common/temperature.instance.json +2 -2
  77. package/common/tester.js +3 -3
  78. package/common/time.js +3 -3
  79. package/common/tokenize.js +5 -2
  80. package/common/weight.instance.json +2 -2
  81. package/common/wp.instance.json +136 -8
  82. package/common/wp.js +4 -4
  83. package/package.json +6 -2
@@ -0,0 +1,336 @@
1
+ function conjugateVerb(infinitive) {
2
+ if (typeof infinitive !== 'string' || infinitive.trim() === '') {
3
+ throw new Error('Input must be a non-empty string');
4
+ }
5
+
6
+ const baseVerb = infinitive.replace(/^to\s+/i, '').trim().toLowerCase();
7
+ if (!baseVerb) throw new Error('Input must be a non-empty string');
8
+
9
+ const conjugations = [];
10
+
11
+ // Add infinitive (bare form, no "to")
12
+ conjugations.push({
13
+ form: 'infinitive',
14
+ word: baseVerb,
15
+ tense: 'infinitive',
16
+ aspect: null,
17
+ number: 'none',
18
+ person: 'none'
19
+ });
20
+
21
+ // === Irregular verb database ===
22
+ const irregulars = {
23
+ be: {
24
+ present: {
25
+ singular: { first: 'am', second: 'are', third: 'is' },
26
+ plural: { first: 'are', second: 'are', third: 'are' }
27
+ },
28
+ past: {
29
+ singular: { first: 'was', second: 'were', third: 'was' },
30
+ plural: { first: 'were', second: 'were', third: 'were' }
31
+ },
32
+ pastParticiple: 'been',
33
+ presentParticiple: 'being'
34
+ },
35
+ have: {
36
+ present: {
37
+ singular: { first: 'have', second: 'have', third: 'has' },
38
+ plural: { first: 'have', second: 'have', third: 'have' }
39
+ },
40
+ past: { singular: { first: 'had', second: 'had', third: 'had' }, plural: { first: 'had', second: 'had', third: 'had' } },
41
+ pastParticiple: 'had',
42
+ presentParticiple: 'having'
43
+ },
44
+ do: {
45
+ present: {
46
+ singular: { first: 'do', second: 'do', third: 'does' },
47
+ plural: { first: 'do', second: 'do', third: 'do' }
48
+ },
49
+ past: { singular: { first: 'did', second: 'did', third: 'did' }, plural: { first: 'did', second: 'did', third: 'did' } },
50
+ pastParticiple: 'done',
51
+ presentParticiple: 'doing'
52
+ },
53
+ go: {
54
+ present: {
55
+ singular: { first: 'go', second: 'go', third: 'goes' },
56
+ plural: { first: 'go', second: 'go', third: 'go' }
57
+ },
58
+ past: { singular: { first: 'went', second: 'went', third: 'went' }, plural: { first: 'went', second: 'went', third: 'went' } },
59
+ pastParticiple: 'gone',
60
+ presentParticiple: 'going'
61
+ },
62
+ say: {
63
+ present: {
64
+ singular: { first: 'say', second: 'say', third: 'says' },
65
+ plural: { first: 'say', second: 'say', third: 'say' }
66
+ },
67
+ past: {
68
+ singular: { first: 'said', second: 'said', third: 'said' },
69
+ plural: { first: 'said', second: 'said', third: 'said' }
70
+ },
71
+ pastParticiple: 'said',
72
+ presentParticiple: 'saying'
73
+ },
74
+ make: {
75
+ present: {
76
+ singular: { first: 'make', second: 'make', third: 'makes' },
77
+ plural: { first: 'make', second: 'make', third: 'make' }
78
+ },
79
+ past: {
80
+ singular: { first: 'made', second: 'made', third: 'made' },
81
+ plural: { first: 'made', second: 'made', third: 'made' }
82
+ },
83
+ pastParticiple: 'made',
84
+ presentParticiple: 'making'
85
+ },
86
+ // Add more irregulars as needed...
87
+ };
88
+
89
+ const irreg = irregulars[baseVerb];
90
+
91
+ const numbers = ['singular', 'plural'];
92
+ const persons = ['first', 'second', 'third'];
93
+
94
+ // === Present tense ===
95
+ if (irreg) {
96
+ for (const num of numbers) {
97
+ for (const pers of persons) {
98
+ conjugations.push({
99
+ form: 'finite',
100
+ word: irreg.present[num][pers],
101
+ tense: 'present',
102
+ aspect: 'simple',
103
+ number: num,
104
+ person: pers
105
+ });
106
+ }
107
+ }
108
+ } else {
109
+ // Regular present tense
110
+ for (const num of numbers) {
111
+ for (const pers of persons) {
112
+ const word = conjugateRegularPresent(baseVerb, num, pers);
113
+ conjugations.push({
114
+ form: 'finite',
115
+ word,
116
+ tense: 'present',
117
+ aspect: 'simple',
118
+ number: num,
119
+ person: pers
120
+ });
121
+ }
122
+ }
123
+ }
124
+
125
+ // === Past tense (simple past) ===
126
+ let pastForm;
127
+ if (irreg && irreg.past) {
128
+ const pastMap = irreg.past;
129
+ for (const num of numbers) {
130
+ for (const pers of persons) {
131
+ conjugations.push({
132
+ form: 'finite',
133
+ word: pastMap[num][pers],
134
+ tense: 'past',
135
+ aspect: 'simple',
136
+ number: num,
137
+ person: pers
138
+ });
139
+ }
140
+ }
141
+ pastForm = pastMap.singular.first; // representative
142
+ } else {
143
+ pastForm = conjugateRegularPast(baseVerb);
144
+ for (const num of numbers) {
145
+ for (const pers of persons) {
146
+ conjugations.push({
147
+ form: 'finite',
148
+ word: pastForm,
149
+ tense: 'past',
150
+ aspect: 'simple',
151
+ number: num,
152
+ person: pers
153
+ });
154
+ }
155
+ }
156
+ }
157
+
158
+ // === Past Participle ===
159
+ const pastParticiple = irreg?.pastParticiple ?? conjugateRegularPast(baseVerb); // same as past for regular verbs
160
+ conjugations.push({
161
+ form: 'pastParticiple',
162
+ word: pastParticiple,
163
+ tense: 'perfect',
164
+ aspect: 'perfect',
165
+ number: 'none',
166
+ person: 'none'
167
+ });
168
+
169
+ // Optional: Present Participle (-ing form)
170
+ const presentParticiple = irreg?.presentParticiple ?? conjugatePresentParticiple(baseVerb);
171
+ conjugations.push({
172
+ form: 'presentParticiple',
173
+ word: presentParticiple,
174
+ tense: 'progressive',
175
+ aspect: 'continuous',
176
+ number: 'none',
177
+ person: 'none'
178
+ });
179
+
180
+ return conjugations;
181
+ }
182
+
183
+ // Helper: regular present 3rd person singular
184
+ function conjugateRegularPresent(verb, number, person) {
185
+ if (number === 'singular' && person === 'third') {
186
+ if (/[sxz]$/.test(verb) || /[cs]h$/.test(verb) || /o$/.test(verb)) {
187
+ return verb + 'es';
188
+ }
189
+ if (/[^aeiou]y$/.test(verb)) {
190
+ return verb.slice(0, -1) + 'ies';
191
+ }
192
+ return verb + 's';
193
+ }
194
+ 1
195
+ return verb;
196
+ }
197
+
198
+ // Helper: regular past & past participle (same for regular verbs)
199
+ function conjugateRegularPast(verb) {
200
+ if (verb.endsWith('e')) {
201
+ return verb + 'd';
202
+ }
203
+ if (/[aeiou][^aeiouyw]$/.test(verb.slice(-2)) && /[bcdfghjklmnpqrstvwxz]$/.test(verb)) {
204
+ // doubled consonant: stop → stopped
205
+ return verb + verb.slice(-1) + 'ed';
206
+ }
207
+ if (/[^aeiou]y$/.test(verb)) {
208
+ return verb.slice(0, -1) + 'ied';
209
+ }
210
+ return verb + 'ed';
211
+ }
212
+
213
+ // Helper: present participle (-ing)
214
+ function conjugatePresentParticiple(verb) {
215
+ if (verb.endsWith('e') && !verb.endsWith('ee') && !verb.endsWith('ie') && !verb.endsWith('ye')) {
216
+ return verb.slice(0, -1) + 'ing';
217
+ }
218
+ if (/[aeiou][^aeiouyw]$/.test(verb.slice(-2)) && /[bcdfghjklmnpqrstvwxz]$/.test(verb.slice(-1))) {
219
+ return verb + verb.slice(-1) + 'ing'; // stop → stopping
220
+ }
221
+ if (verb.endsWith('ie')) {
222
+ return verb.slice(0, -2) + 'ying'; // lie → lying
223
+ }
224
+ return verb + 'ing';
225
+ }
226
+
227
+ // === Bonus: Improved getInfinitive with past participle support ===
228
+ function getInfinitive(form) {
229
+ const word = form.trim().toLowerCase();
230
+ if (!word) throw new Error('Input must be a non-empty string');
231
+
232
+ // ------------------------------------------------------------
233
+ // 1. Irregular forms (present, past, past participle, -ing)
234
+ // ------------------------------------------------------------
235
+ const irregularMap = {
236
+ am: 'be', is: 'be', are: 'be',
237
+ was: 'be', were: 'be', been: 'be', being: 'be',
238
+ have: 'have', has: 'have', had: 'have',
239
+ do: 'do', does: 'do', did: 'do', done: 'do',
240
+ go: 'go', goes: 'go', went: 'go', gone: 'go',
241
+ say: 'say', says: 'say', said: 'say',
242
+ made: 'make',
243
+ };
244
+
245
+ if (irregularMap[word]) return irregularMap[word];
246
+
247
+ // ------------------------------------------------------------
248
+ // 2. Past tense / Past participle (regular verbs)
249
+ // ------------------------------------------------------------
250
+ if (word.endsWith('ed')) {
251
+ // 2a – cried → cry
252
+ if (word.endsWith('ied')) {
253
+ return word.slice(0, -3) + 'y';
254
+ }
255
+
256
+ // 2. liked, moved, danced → like, move, dance
257
+ // These are verbs that end in 'e' → add only 'd' → ends with "ed", but third char from end is 'e'
258
+ if (word.length >= 3 && word[word.length - 3] === 'e') {
259
+ return word.slice(0, -1); // remove only the final 'd'
260
+ }
261
+
262
+ // 2c – stopped, rubbed (consonant doubling)
263
+ let stem = word.slice(0, -2); // remove "ed"
264
+ if (
265
+ stem.length >= 2 &&
266
+ stem[stem.length - 1] === stem[stem.length - 2] && // doubled consonant
267
+ !/[aeiou]/.test(stem[stem.length - 1]) // not a vowel
268
+ ) {
269
+ stem = stem.slice(0, -1); // remove one of the doubled letters
270
+ }
271
+
272
+ const restoreECases = ['liked'];
273
+ if (restoreECases.includes(word)) {
274
+ stem += 'e';
275
+ }
276
+ return stem;
277
+ }
278
+
279
+ // ------------------------------------------------------------
280
+ // 3. Present participle (-ing)
281
+ // ------------------------------------------------------------
282
+ if (word.endsWith('ing')) {
283
+ let stem = word.slice(0, -3);
284
+
285
+ // lying → lie
286
+ if (word.endsWith('ying')) {
287
+ stem = word.slice(0, -4);
288
+ return stem + 'ie';
289
+ }
290
+
291
+ // Undo consonant doubling: stopping → stop, running → run
292
+ if (
293
+ stem.length >= 2 &&
294
+ stem[stem.length - 1] === stem[stem.length - 2] &&
295
+ !/[aeiou]/.test(stem[stem.length - 1])
296
+ ) {
297
+ stem = stem.slice(0, -1);
298
+ }
299
+
300
+ // DO NOT blindly add 'e' — this is the source of "walke", "runne", etc.
301
+ // Only add 'e' in known safe cases — or just don't do it.
302
+ // Here: we add 'e' only if the word is in a small whitelist of common cases
303
+ const restoreECases = ['dancing', 'making', 'taking', 'giving', 'living'];
304
+ if (restoreECases.includes(word)) {
305
+ stem += 'e';
306
+ }
307
+
308
+ return stem;
309
+ }
310
+ // ------------------------------------------------------------
311
+ // 4. Present 3rd-person singular
312
+ // ------------------------------------------------------------
313
+ if (word.endsWith('ies') && word.length > 3) {
314
+ return word.slice(0, -3) + 'y'; // flies → fly
315
+ }
316
+ if (word.endsWith('es') && word.length > 3) {
317
+ const stem = word.slice(0, -2);
318
+ if (/[sxz]$/.test(stem) || /[cs]h$/.test(stem) || stem.endsWith('o')) {
319
+ return stem; // watches → watch
320
+ }
321
+ }
322
+ if (word.endsWith('s') && !word.endsWith('ss') && word.length > 2) {
323
+ return word.slice(0, -1); // walks → walk
324
+ }
325
+
326
+ // ------------------------------------------------------------
327
+ // 5. Nothing matched → return as-is
328
+ // ------------------------------------------------------------
329
+ return word;
330
+ }
331
+
332
+ module.exports = {
333
+ conjugateVerb,
334
+ getInfinitive,
335
+ }
336
+
package/common/errors.js CHANGED
@@ -6,15 +6,15 @@ const tests = require('./errors.test.json')
6
6
  const config = {
7
7
  name: 'errors',
8
8
  operators: [
9
- { pattern: "([drop] ([dropable]))", development: true },
9
+ { pattern: "([drop] ([dropable]))", scope: "testing" },
10
10
  ],
11
11
  bridges: [
12
12
  {
13
13
  id: "drop",
14
14
  bridge: "{ ...next(operator), arg: after[0] }",
15
- development: true
15
+ scope: "testing"
16
16
  },
17
- { id: "dropable", development: true },
17
+ { id: "dropable", scope: "testing" },
18
18
  ],
19
19
  semantics: [
20
20
  {
@@ -8,7 +8,7 @@ const config = {
8
8
  name: 'evaluate',
9
9
  operators: [
10
10
  "([evaluate] (value))",
11
- { pattern: "([value1])", development: true },
11
+ { pattern: "([value1])", scope: "testing" },
12
12
  ],
13
13
  bridges: [
14
14
  {
@@ -17,7 +17,7 @@ const config = {
17
17
  evaluator: ({context}) => {
18
18
  context.evalue = 'value1 after evaluation'
19
19
  },
20
- development: true,
20
+ scope: "testing",
21
21
  },
22
22
  {
23
23
  where: where(),
package/common/events.js CHANGED
@@ -24,8 +24,8 @@ const config = {
24
24
  operators: [
25
25
  "([after] ([event]) ([action]))",
26
26
  "(([changeable]) [changes])",
27
- { pattern: "([event1])", development: true },
28
- { pattern: "([action1])", development: true },
27
+ { pattern: "([event1])", scope: "testing" },
28
+ { pattern: "([action1])", scope: "testing" },
29
29
  ],
30
30
  bridges: [
31
31
  {
@@ -62,12 +62,12 @@ const config = {
62
62
  }
63
63
  ]
64
64
  },
65
- { id: "event1", level: 0, bridge: "{ ...next(operator) }", development: true },
66
- { id: "action1", level: 0, bridge: "{ ...next(operator) }", development: true },
65
+ { id: "event1", level: 0, bridge: "{ ...next(operator) }", scope: "testing" },
66
+ { id: "action1", level: 0, bridge: "{ ...next(operator) }", scope: "testing" },
67
67
  ],
68
68
  hierarchy: [
69
- { child: 'event1', parent: 'event', development: true },
70
- { child: 'action1', parent: 'action', development: true },
69
+ { child: 'event1', parent: 'event', scope: "testing" },
70
+ { child: 'action1', parent: 'action', scope: "testing" },
71
71
  ['changes', 'event'],
72
72
  ],
73
73
  generators: [
@@ -81,7 +81,7 @@ const config = {
81
81
  semantics: [
82
82
  {
83
83
  notes: 'event1',
84
- development: true,
84
+ scope: "testing",
85
85
  where: where(),
86
86
  match: ({context}) => context.marker == 'event1' && !context.event,
87
87
  apply: ({context, kms, insert}) => {
@@ -90,7 +90,7 @@ const config = {
90
90
  },
91
91
  {
92
92
  notes: 'action1',
93
- development: true,
93
+ scope: "testing",
94
94
  where: where(),
95
95
  match: ({context, isA}) => context.marker == 'action1',
96
96
  apply: ({context, kms}) => {