tpmkms_4wp 9.3.0 → 9.4.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 (113) hide show
  1. package/common/animals.instance.json +0 -65
  2. package/common/animals.js +2 -3
  3. package/common/animals.test.json +1607 -1
  4. package/common/articles.js +2 -4
  5. package/common/asking.js +21 -5
  6. package/common/avatar.js +4 -12
  7. package/common/characters.js +2 -2
  8. package/common/colors.instance.json +0 -70
  9. package/common/colors.js +2 -2
  10. package/common/comparable.instance.json +0 -15
  11. package/common/comparable.js +2 -2
  12. package/common/concept.js +1 -2
  13. package/common/concept.test.json +279 -193
  14. package/common/conjunction.js +3 -5
  15. package/common/countable.js +2 -14
  16. package/common/crew.instance.json +0 -130
  17. package/common/crew.js +2 -2
  18. package/common/currency.js +2 -3
  19. package/common/dateTimeSelectors.instance.json +175 -0
  20. package/common/dateTimeSelectors.js +168 -0
  21. package/common/dateTimeSelectors.test.json +85622 -0
  22. package/common/dates.instance.json +504 -486
  23. package/common/dates.js +128 -16
  24. package/common/dates.test.json +16867 -373
  25. package/common/dialogues.js +13 -49
  26. package/common/dimension.instance.json +0 -5
  27. package/common/dimension.js +4 -4
  28. package/common/edible.instance.json +0 -216
  29. package/common/edible.js +2 -2
  30. package/common/emotions.instance.json +0 -5
  31. package/common/emotions.js +2 -2
  32. package/common/errors.js +3 -0
  33. package/common/evaluate.js +2 -2
  34. package/common/events.js +1 -2
  35. package/common/fastfood.instance.json +28 -975
  36. package/common/fastfood.js +2 -4
  37. package/common/fastfood.test.json +16291 -6597
  38. package/common/formulas.instance.json +0 -5
  39. package/common/formulas.js +3 -1
  40. package/common/gdefaults.js +7 -4
  41. package/common/help.js +2 -2
  42. package/common/helpers/dateTimeSelectors.js +198 -0
  43. package/common/helpers/dialogues.js +11 -8
  44. package/common/helpers/properties.js +2 -2
  45. package/common/helpers.js +23 -47
  46. package/common/hierarchy.js +12 -13
  47. package/common/javascript.js +2 -3
  48. package/common/kirk.instance.json +30 -119
  49. package/common/kirk.js +2 -3
  50. package/common/length.instance.json +0 -75
  51. package/common/length.js +2 -3
  52. package/common/listener.js +3 -1
  53. package/common/math.instance.json +0 -5
  54. package/common/math.js +2 -3
  55. package/common/menus.instance.json +0 -35
  56. package/common/menus.js +3 -1
  57. package/common/meta.js +4 -5
  58. package/common/nameable.js +3 -1
  59. package/common/negation.js +2 -2
  60. package/common/numbers.js +7 -4
  61. package/common/numbers.test.json +89 -23
  62. package/common/ordering.instance.json +0 -10
  63. package/common/ordering.js +2 -3
  64. package/common/ordinals.js +2 -3
  65. package/common/people.instance.json +0 -40
  66. package/common/people.js +2 -3
  67. package/common/percentages.js +3 -4
  68. package/common/percentages.test.json +57 -11
  69. package/common/pipboy.instance.json +0 -85
  70. package/common/pipboy.js +1 -1
  71. package/common/pipboy.test.json +4377 -3386
  72. package/common/pokemon.instance.json +0 -65
  73. package/common/pokemon.js +1 -2
  74. package/common/pos.js +2 -2
  75. package/common/pressure.instance.json +0 -20
  76. package/common/pressure.js +2 -2
  77. package/common/properties.instance.json +0 -5
  78. package/common/properties.js +11 -13
  79. package/common/punctuation.js +2 -2
  80. package/common/reminders.instance.json +237 -0
  81. package/common/reminders.js +394 -0
  82. package/common/reminders.test.json +81932 -0
  83. package/common/reports.instance.json +2 -12
  84. package/common/reports.js +1 -1
  85. package/common/scorekeeper.js +2 -2
  86. package/common/scorekeeper.test.json +3565 -7550
  87. package/common/sdefaults.js +1 -1
  88. package/common/self.instance.json +2 -0
  89. package/common/self.js +49 -0
  90. package/common/self.test.json +2 -0
  91. package/common/sizeable.js +2 -2
  92. package/common/spock.instance.json +30 -119
  93. package/common/spock.js +1 -1
  94. package/common/stgame.js +1 -1
  95. package/common/stm.js +1 -1
  96. package/common/tell.js +2 -2
  97. package/common/temperature.instance.json +84 -20
  98. package/common/temperature.js +2 -2
  99. package/common/tester.js +0 -1
  100. package/common/testing.js +0 -1
  101. package/common/time.js +57 -30
  102. package/common/time.test.json +4159 -205
  103. package/common/tokenize.js +1 -1
  104. package/common/ui.instance.json +0 -5
  105. package/common/ui.js +4 -2
  106. package/common/weight.instance.json +0 -60
  107. package/common/weight.js +2 -2
  108. package/common/wp.instance.json +386 -72
  109. package/common/wp.js +1 -5
  110. package/common/wp.test.json +8057 -3867
  111. package/common/yesno.js +2 -2
  112. package/main.js +6 -0
  113. package/package.json +16 -4
package/common/dates.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck } = require('./helpers')
2
+ const { defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
3
3
  const dates_tests = require('./dates.test.json')
4
4
  const dates_instance = require('./dates.instance.json')
5
5
  const hierarchy = require('./hierarchy')
@@ -14,7 +14,35 @@ const helpers = require('./helpers')
14
14
  const template = {
15
15
  configs: [
16
16
  "setidsuffix _dates",
17
+ ({config}) => {
18
+ const months = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]
19
+ config.addSemantic({
20
+ match: ({context}) => {
21
+ if (!context.makeObject) {
22
+ return
23
+ }
24
+ return months.includes(context.value)
25
+ },
26
+ apply: ({context}) => {
27
+ context.initial.month_ordinal = months.findIndex((month) => month == context.value) + 1
28
+ },
29
+ })
30
+ },
17
31
  "january, february, march, april, may, june, july, august, september, october, november and december are months",
32
+ ({config}) => {
33
+ const days = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]
34
+ config.addSemantic({
35
+ match: ({context}) => {
36
+ if (!context.makeObject) {
37
+ return
38
+ }
39
+ return days.includes(context.value)
40
+ },
41
+ apply: ({context}) => {
42
+ context.initial.day_ordinal = days.findIndex((day) => day == context.value) + 1
43
+ },
44
+ })
45
+ },
18
46
  "monday, tuesday, wednesday, thursday, friday, saturday and sunday are days",
19
47
  "ac, bc, bce and ad are eras",
20
48
  // "ac, bc,, bce,, and ad are eras",
@@ -37,10 +65,48 @@ const template = {
37
65
  "([era_dates|])",
38
66
  "([date_dates|])",
39
67
  "([dateEra_dates] (date_dates/*) (era_dates/*))",
68
+ "([monthDay_dates] (month_dates/*) (dayNumber_dates/*))",
69
+ "([monthYear_dates] (month_dates/*) (yearNumber_dates/*))",
40
70
  "([monthDayYear_dates] (month_dates/*) (dayNumber_dates/*) (yearNumber_dates/*))",
41
71
  "([monthDayYearWithSlashes_dates] (monthNumber_dates/*) (dateSeparator_dates/*) (dayNumber_dates/*) (dateSeparator_dates/*) (yearNumber_dates/*))",
72
+ "([onDate_dates|on] ([onDateValue_dates|]))",
73
+ "([afterDate_dates|after] ([afterDateValue_dates|]))",
74
+ ],
75
+ associations: {
76
+ positive: [
77
+ { context: [['every', 0], ['monday_dates', 0]], choose: 1 },
78
+ ]
79
+ },
80
+ hierarchy: [
81
+ ['monday_dates', 'distributable'],
42
82
  ],
43
83
  bridges: [
84
+ {
85
+ id: 'onDateValue_dates',
86
+ children: [
87
+ 'day_dates',
88
+ 'month_dates',
89
+ ],
90
+ },
91
+ {
92
+ id: 'onDate_dates',
93
+ isA: ['preposition'],
94
+ bridge: "{ ...next(operator), date: after[0], onDate: operator, interpolate: '${onDate} ${date}' }",
95
+ check: defaultContextCheckProperties(['onDate', 'date']),
96
+ },
97
+ {
98
+ id: 'afterDateValue_dates',
99
+ children: [
100
+ 'day_dates',
101
+ 'month_dates',
102
+ ],
103
+ },
104
+ {
105
+ id: 'afterDate_dates',
106
+ isA: ['preposition'],
107
+ bridge: "{ ...next(operator), date: after[0], afterDate: operator, interpolate: '${afterDate} ${date}' }",
108
+ check: defaultContextCheckProperties(['afterDate', 'date']),
109
+ },
44
110
  {
45
111
  id: 'era_dates',
46
112
  words: ['era'],
@@ -48,14 +114,16 @@ const template = {
48
114
  },
49
115
  {
50
116
  id: 'date_dates',
51
- words: ['date'],
117
+ words: ['date', 'distributable'],
118
+ isA: ['onDateValue_dates', 'afterDateValue_dates'],
52
119
  bridge: "{ ...next(operator) }"
53
120
  },
54
121
  {
55
122
  id: 'dateEra_dates',
56
123
  isA: ['date_dates'],
57
124
  convolution: true,
58
- bridge: "{ ...next(after[0]), era: after[1], interpolate: concat(after[0].interpolate, ' ${era}') }"
125
+ bridge: "{ ...next(after[0]), era: after[1], interpolate: concat(after[0].interpolate, ' ${era}') }",
126
+ check: defaultContextCheckProperties(['era']),
59
127
  },
60
128
  {
61
129
  id: 'dateSeparator_dates',
@@ -65,13 +133,15 @@ const template = {
65
133
  {
66
134
  id: 'monthDayYearWithSlashes_dates',
67
135
  isA: ['date_dates'],
136
+ before: ['preposition'],
68
137
  convolution: true,
69
138
  bridge: "{ ...next(operator), day: after[2], month: after[0], year: after[4], interpolate: '${month}/${day}/${year}' }",
139
+ check: defaultContextCheckProperties(['day', 'month', 'year']),
70
140
  },
71
141
  {
72
142
  id: 'dayNumber_dates',
73
143
  isA: ['integer'],
74
- associations: ['dates'],
144
+ //associations: ['dates'],
75
145
  bridge: "{ ...next(operator) }"
76
146
  },
77
147
  {
@@ -84,14 +154,39 @@ const template = {
84
154
  isA: ['integer'],
85
155
  bridge: "{ ...next(operator) }"
86
156
  },
157
+ {
158
+ id: 'monthDay_dates',
159
+ convolution: true,
160
+ localHierarchy: [['ordinal', 'dayNumber_dates']],
161
+ before: ['preposition'],
162
+ isA: ['date_dates'],
163
+ bridge: "{ ...next(operator), month: after[0], day: after[1], interpolate: '${month} ${day}' }",
164
+ check: defaultContextCheckProperties(['day', 'month']),
165
+ },
166
+ {
167
+ id: 'monthYear_dates',
168
+ convolution: true,
169
+ before: ['preposition'],
170
+ isA: ['date_dates'],
171
+ bridge: "{ ...next(operator), month: after[0], year: after[1], interpolate: '${month} ${year}' }",
172
+ check: defaultContextCheckProperties(['month', 'year']),
173
+ },
87
174
  {
88
175
  id: 'monthDayYear_dates',
89
176
  convolution: true,
177
+ before: ['preposition', 'monthDay_dates'],
90
178
  isA: ['date_dates'],
179
+ evaluator: ({context}) => {
180
+ const year = context.year.value
181
+ const day = context.day.value
182
+ const month_ordinal = context.month.month_ordinal
183
+ context.evalue = new Date(year, month_ordinal-1, day).toISOString()
184
+ },
91
185
  localHierarchy: [
92
186
  ['ordinal', 'dayNumber_dates'],
93
187
  ],
94
- bridge: "{ ...next(operator), month: after[0], day: after[1], year: after[2], interpolate: '${month} ${day} ${year}' }"
188
+ bridge: "{ ...next(operator), month: after[0], day: after[1], year: after[2], interpolate: '${month} ${day} ${year}' }",
189
+ check: defaultContextCheckProperties(['month', 'day', 'year']),
95
190
  },
96
191
  ],
97
192
  words: {
@@ -115,17 +210,31 @@ const template = {
115
210
  }
116
211
  },
117
212
  (args) => {
118
- const as = ['jan', 'feb', 'mar', 'apr', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec']
119
- const ms = ['january', 'february', 'march', 'april', 'june', 'july', 'august', 'september', 'october', 'november', 'december']
120
- for (let i = 0; i < as.length; ++i) {
121
- args.makeObject({...args, context: { word: as[i], value: `${as[i]}_dates`}, types: [`${ms[i]}_dates`]})
213
+ {
214
+ const as = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sept', 'oct', 'nov', 'dec']
215
+ const ms = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']
216
+ // args.makeObject({...args, context: { word: as[i], value: `${ms[i]}_dates`}, types: [`${ms[i]}_dates`]})
217
+ for (let i = 0; i < as.length; ++i) {
218
+ const word = as[i]
219
+ if (word == 'may') {
220
+ continue
221
+ }
222
+ const id = `${ms[i]}_dates`
223
+ args.addWords(id, word, { value: id, abbreviation: word, month_ordinal: i+1 })
224
+ }
225
+ }
226
+
227
+ {
228
+ const as = ['sun', 'mon', 'tues', 'weds', 'thurs', 'fri', 'sat']
229
+ const ms = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
230
+ // args.makeObject({...args, context: { word: as[i], value: `${ms[i]}_dates`}, types: [`${ms[i]}_dates`]})
231
+ for (let i = 0; i < as.length; ++i) {
232
+ const word = as[i]
233
+ const id = `${ms[i]}_dates`
234
+ args.addWords(id, word, { value: id, abbreviation: word, day_ordinal: i+1 })
235
+ }
122
236
  }
123
237
 
124
- /*
125
- const word = 'bc'
126
- const synonym = 'bce'
127
- args.makeObject({...args, context: { word: synonym, value: `${synonym}_dates`}, types: [`${word}_dates`]})
128
- */
129
238
  },
130
239
  "resetIdSuffix",
131
240
  ],
@@ -141,8 +250,11 @@ knowledgeModule( {
141
250
  name: './dates.test.json',
142
251
  contents: dates_tests,
143
252
  checks: {
144
- context: defaultContextCheck(['day', 'month', 'year', 'era']),
145
- },
253
+ context: [
254
+ // defaultContextCheck({ marker: 'monthDayYear_dates', exported: true, extra: ['month', 'day', 'year'] }),
255
+ defaultContextCheck({ extra: ['month', 'day', 'year', 'era', 'month_ordinal', 'day_ordinal', 'month', 'date'] }),
256
+ ],
257
+ }
146
258
  },
147
259
  template: {
148
260
  template,