tpmkms_4wp 9.5.1-beta.9 → 9.6.0-beta.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 (114) hide show
  1. package/common/animals.instance.json +130 -0
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +12 -4
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2182 -5
  6. package/common/can.js +102 -39
  7. package/common/can.test.json +51307 -0
  8. package/common/colors.instance.json +142 -30
  9. package/common/colors.js +3 -6
  10. package/common/comparable.instance.json +31 -1
  11. package/common/comparable.js +3 -6
  12. package/common/concept.js +25 -27
  13. package/common/concept.test.json +142 -120
  14. package/common/conjunction.test.json +32 -42
  15. package/common/crew.instance.json +400 -126
  16. package/common/crew.js +3 -6
  17. package/common/dateTimeSelectors.instance.json +2 -2
  18. package/common/dateTimeSelectors.js +6 -9
  19. package/common/dateTimeSelectors.test.json +76935 -35739
  20. package/common/dates.instance.json +50 -84
  21. package/common/dates.js +3 -6
  22. package/common/dates.test.json +284 -287
  23. package/common/dialogues.js +33 -115
  24. package/common/dialogues.test.json +1248 -1152
  25. package/common/dimension.instance.json +21498 -566
  26. package/common/dimension.js +147 -52
  27. package/common/dimension.test.json +10979 -4625
  28. package/common/drone.instance.json +24709 -0
  29. package/common/drone.js +662 -0
  30. package/common/drone.test.json +30522 -0
  31. package/common/drone_v1.instance.json +24703 -0
  32. package/common/drone_v1.js +596 -0
  33. package/common/drone_v1.test.json +115538 -0
  34. package/common/edible.instance.json +365 -65
  35. package/common/edible.js +3 -5
  36. package/common/emotions.instance.json +57 -70
  37. package/common/emotions.js +3 -6
  38. package/common/errors.js +3 -3
  39. package/common/fastfood.instance.json +1270 -244
  40. package/common/fastfood.js +10 -12
  41. package/common/fastfood.test.json +6970 -6829
  42. package/common/formulas.instance.json +10 -0
  43. package/common/formulas.js +2 -1
  44. package/common/gdefaults.js +58 -13
  45. package/common/help.js +9 -9
  46. package/common/help.test.json +65 -11
  47. package/common/helpers/dialogues.js +9 -1
  48. package/common/helpers/properties.js +37 -18
  49. package/common/helpers.js +32 -2
  50. package/common/hierarchy.js +10 -8
  51. package/common/kirk.instance.json +10 -0
  52. package/common/kirk.js +4 -6
  53. package/common/kirk.test.json +600 -424
  54. package/common/latin.instance.json +10 -10
  55. package/common/latin.js +8 -10
  56. package/common/length.instance.json +34659 -3157
  57. package/common/length.js +11 -6
  58. package/common/length.test.json +54357 -2557
  59. package/common/math.instance.json +11 -1
  60. package/common/math.js +2 -1
  61. package/common/menus.instance.json +74 -7
  62. package/common/menus.js +3 -12
  63. package/common/meta.js +4 -5
  64. package/common/nameable.js +29 -15
  65. package/common/nameable.test.json +436 -0
  66. package/common/numbers.js +1 -1
  67. package/common/ordering.instance.json +24 -2
  68. package/common/ordering.js +3 -5
  69. package/common/ordering.test.json +104 -174
  70. package/common/people.instance.json +140 -315
  71. package/common/people.js +3 -5
  72. package/common/pipboy.instance.json +171 -57
  73. package/common/pipboy.js +2 -1
  74. package/common/pokemon.instance.json +135 -5
  75. package/common/pokemon.js +3 -5
  76. package/common/pressure.instance.json +3990 -1981
  77. package/common/pressure.js +3 -5
  78. package/common/pressure.test.json +433 -477
  79. package/common/properties.instance.json +15 -16
  80. package/common/properties.js +10 -9
  81. package/common/properties.test.json +9565 -6951
  82. package/common/rates.instance.json +59 -0
  83. package/common/rates.js +95 -0
  84. package/common/rates.test.json +27702 -0
  85. package/common/reminders.js +5 -8
  86. package/common/reminders.test.json +64635 -25787
  87. package/common/reports.instance.json +22 -2
  88. package/common/reports.js +3 -5
  89. package/common/scorekeeper.js +3 -6
  90. package/common/spock.instance.json +10 -0
  91. package/common/spock.js +4 -7
  92. package/common/spock.test.json +606 -430
  93. package/common/stm.js +37 -20
  94. package/common/temperature.instance.json +3162 -1153
  95. package/common/temperature.js +3 -5
  96. package/common/temperature.test.json +433 -477
  97. package/common/time.instance.json +24852 -0
  98. package/common/time.js +136 -139
  99. package/common/time.test.json +31876 -3757
  100. package/common/ui.instance.json +12 -5
  101. package/common/ui.js +4 -13
  102. package/common/weight.instance.json +10500 -4098
  103. package/common/weight.js +3 -5
  104. package/common/weight.test.json +2601 -2263
  105. package/common/words.instance.json +9 -0
  106. package/common/words.js +50 -0
  107. package/common/words.test.json +2 -0
  108. package/common/wp.instance.json +470 -58
  109. package/common/wp.js +6 -4
  110. package/common/wp.test.json +7385 -6906
  111. package/main.js +6 -2
  112. package/package.json +21 -6
  113. package/common/listener.js +0 -50
  114. package/common/listener.test.json +0 -142
package/common/time.js CHANGED
@@ -1,10 +1,10 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const tell = require('./tell')
4
- const countable = require('./countable')
5
- const numbers = require('./numbers')
4
+ const dimension = require('./dimension')
6
5
  const helpers = require('./helpers')
7
6
  const time_tests = require('./time.test.json')
7
+ const instance = require('./time.instance.json')
8
8
 
9
9
  function pad(v, l) {
10
10
  const s = String(v)
@@ -12,6 +12,12 @@ function pad(v, l) {
12
12
  return "0".repeat(n) + s
13
13
  }
14
14
 
15
+ //"what is the time in 24 hour format"
16
+ //"what time is it in Paris"
17
+ //"what time is it in GMT"
18
+ // what is the time
19
+ // how many hours are in a day
20
+
15
21
  class API {
16
22
  // gets the contexts for doing the happening
17
23
  semantics({context, args, kms}) {
@@ -45,147 +51,136 @@ class API {
45
51
  }
46
52
  }
47
53
 
48
- const config = {
49
- name: 'time',
50
- operators: [
51
- "([time])",
52
- "([atTime|at] (time))",
53
- "([use] (([timeUnit]) [timeFormat|format]))",
54
- // "(([number|]) [ampm|])",
55
- "((time) [ampm|])",
56
- "([hourMinutes|] (integer) (colon) (integer))",
57
- //"(([anyConcept]) [equals|is] ([anyConcept]))",
58
- //"(([what0|what]) [equals] (<the> ([timeConcept])))",
59
- //"(<whatP|what> ([anyConcept]))",
60
- //"what is the time in 24 hour format"
61
- //"what time is it in Paris"
62
- //"what time is it in GMT"
63
- // what is the time
64
- // how many hours are in a day
65
- ],
66
- bridges: [
54
+
55
+ const template = {
56
+ configs: [
57
+ "years hours minutes and seconds are units of time",
58
+ "hours = minutes / 60",
59
+ "minutes = hours * 60",
60
+ "seconds = minutes * 60",
61
+ "hours = seconds / 3600",
62
+ "seconds = hours * 3600",
63
+ "minutes = seconds / 60",
64
+ "day = hours / 24",
65
+ "hours = days * 24",
67
66
  {
68
- id: 'hourMinutes',
69
- isA: ['time'],
70
- convolution: true,
71
- bridge: "{ ...next(operator), hour: after[0], colon: after[1], minute: after[2], interpolate: '${hour}${colon}${minute}' }",
72
- },
73
- {
74
- id: "atTime",
75
- words: ['@'],
76
- isA: ['preposition'],
77
- bridge: "{ ...next(operator), time: after[0], operator: operator, interpolate: '${operator} ${time}' }"
78
- },
79
- {
80
- id: "time",
81
- bridge: "{ ...next(operator) }"
82
- },
83
- {
84
- id: "ampm",
85
- isA: ['adjective'],
86
- localHierarchy: [
87
- ['integer', 'time'],
67
+ operators: [
68
+ "(([timePoint]) [ampm|])",
69
+ "([atTime|at] (timePoint))",
70
+ // "([use] (([timeUnit]) [timeFormat|format]))",
71
+ "([use] (([quantity]) [timeFormat|format]))",
72
+ "([hourMinutes|] (integer) (colon) (integer))",
88
73
  ],
89
- bridge: "{ ...next(before[0]), marker: if(isA(before[0].marker, 'integer'), operator('time'), before[0].marker), ampm: operator, time: before[0], interpolate: concat(default(before[0].interpolate, '${time}'), ' ${ampm}') }",
90
- },
91
- {
92
- id: "timeFormat",
93
- bridge: "{ ...before[0], ...next(operator) }"
94
- },
95
- {
96
- id: "timeUnit",
97
- words: [
98
- ...helpers.words('hour', { initial: "{ units: 'hour' }" }),
99
- ...helpers.words('minute', { initial: "{ units: 'minute' }" }),
100
- ...helpers.words('second', { initial: "{ units: 'second' }" }),
74
+ bridges: [
75
+ {
76
+ id: 'hourMinutes',
77
+ isA: ['timePoint'],
78
+ convolution: true,
79
+ bridge: "{ ...next(operator), hour: after[0], colon: after[1], minute: after[2], interpolate: '${hour}${colon}${minute}' }",
80
+ },
81
+ {
82
+ id: "timePoint",
83
+ words: ['time'],
84
+ isA: ['noun'],
85
+ },
86
+ {
87
+ id: "atTime",
88
+ words: ['@'],
89
+ isA: ['preposition'],
90
+ bridge: "{ ...next(operator), time: after[0], operator: operator, interpolate: '${operator} ${time}' }"
91
+ },
92
+ {
93
+ id: "ampm",
94
+ isA: ['adjective'],
95
+ localHierarchy: [
96
+ ['integer', 'timePoint'],
97
+ ],
98
+ bridge: "{ ...next(before[0]), marker: if(isA(before[0].marker, 'integer'), operator('timePoint'), before[0].marker), ampm: operator, time: before[0], interpolate: concat(default(before[0].interpolate, '${time}'), ' ${ampm}') }",
99
+ },
100
+ {
101
+ id: "timeFormat",
102
+ bridge: "{ ...before[0], ...next(operator), interpolate: [ { context: before[0] }, { context: operator } ] }"
103
+ },
104
+ {
105
+ id: "use",
106
+ bridge: "{ ...next(operator), format: after[0], interpolate: [{ context: operator }, { property: 'format' }] }",
107
+ // generatorp: ({g, context}) => `use ${context.format.quantity.value} hour time`
108
+ },
101
109
  ],
102
- bridge: "{ ...next(operator) }"
103
- },
104
- {
105
- id: "use",
106
- bridge: "{ ...next(operator), format: after[0] }",
107
- generatorp: ({g, context}) => `use ${context.format.quantity.value} hour time`
108
- },
109
- ],
110
- hierarchy: [
111
- ['time', 'queryable'],
112
- ['ampm', 'queryable'],
113
- ['time', 'theAble'],
114
- ['timeUnit', 'countable'],
115
- ],
116
-
117
- "words": {
118
- "literals": {
119
- "am": [{id: "ampm", "initial": "{ ampm: 'am', determined: true }" }],
120
- "pm": [{id: "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
121
- }
122
- },
123
-
124
- generators: [
125
- {
126
- where: where(),
127
- match: ({context}) => context.marker == 'time' && context.evalue && context.format == 12,
128
- apply: ({context}) => {
129
- let hh = context.evalue.getHours();
130
- let ampm = 'am'
131
- if (hh > 12) {
132
- hh -= 12;
133
- ampm = 'pm'
134
- }
135
- let ss = context.evalue.getMinutes()
136
- ss = pad(ss, 2)
137
- return `${hh}:${ss} ${ampm}`
138
- }
139
- },
140
- {
141
- where: where(),
142
- match: ({context}) => context.marker == 'time' && context.evalue && context.format == 24,
143
- apply: ({g, context}) => {
144
- function pad(num, size) {
145
- num = num.toString();
146
- while (num.length < size) num = "0" + num;
147
- return num;
110
+ "words": {
111
+ "literals": {
112
+ "am": [{id: "ampm", "initial": "{ ampm: 'am', determined: true }" }],
113
+ "pm": [{id: "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
148
114
  }
115
+ },
149
116
 
150
- return `${context.evalue.getHours()}:${pad(context.evalue.getMinutes(), 2)}`
151
- }
152
- },
153
- {
154
- where: where(),
155
- match: ({context}) => context.marker == 'response',
156
- apply: ({g, context}) => context.text
157
- },
158
- ],
117
+ generators: [
118
+ {
119
+ where: where(),
120
+ match: ({context}) => context.marker == 'timePoint' && context.evalue && context.format == 12,
121
+ apply: ({context}) => {
122
+ let hh = context.evalue.getHours();
123
+ let ampm = 'am'
124
+ if (hh > 12) {
125
+ hh -= 12;
126
+ ampm = 'pm'
127
+ }
128
+ let ss = context.evalue.getMinutes()
129
+ ss = pad(ss, 2)
130
+ return `${hh}:${ss} ${ampm}`
131
+ }
132
+ },
133
+ {
134
+ where: where(),
135
+ match: ({context}) => context.marker == 'timePoint' && context.evalue && context.format == 24,
136
+ apply: ({g, context}) => {
137
+ function pad(num, size) {
138
+ num = num.toString();
139
+ while (num.length < size) num = "0" + num;
140
+ return num;
141
+ }
159
142
 
160
- semantics: [
161
- {
162
- notes: 'evaluate time',
163
- where: where(),
164
- match: ({objects, context, api}) => context.marker == 'time' && context.evaluate,
165
- apply: ({objects, context, api}) => {
166
- context.evalue = api.newDate()
167
- context.format = objects.format
168
- }
169
- },
170
- {
171
- notes: 'use time format working case',
172
- where: where(),
173
- match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.quantity.value == 12 || context.format.quantity.value == 24),
174
- apply: ({objects, context}) => {
175
- objects.format = context.format.quantity.value
176
- }
177
- },
178
- {
179
- notes: 'use time format error case',
180
- where: where(),
181
- match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.quantity.value != 12 && context.format.quantity.value != 24),
182
- apply: ({objects, context}) => {
183
- context.marker = 'response'
184
- context.text = 'The hour format is 12 hour or 24 hour'
185
- }
186
- },
143
+ return `${context.evalue.getHours()}:${pad(context.evalue.getMinutes(), 2)}`
144
+ }
145
+ },
146
+ {
147
+ where: where(),
148
+ match: ({context}) => context.marker == 'response',
149
+ apply: ({g, context}) => context.text
150
+ },
151
+ ],
152
+
153
+ semantics: [
154
+ {
155
+ notes: 'evaluate time',
156
+ where: where(),
157
+ match: ({objects, context, api}) => context.marker == 'timePoint' && context.evaluate,
158
+ apply: ({objects, context, api}) => {
159
+ context.evalue = api.newDate()
160
+ context.format = objects.format
161
+ }
162
+ },
163
+ {
164
+ notes: 'use time format working case',
165
+ where: where(),
166
+ match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.amount.value == 12 || context.format.amount.value == 24),
167
+ apply: ({objects, context}) => {
168
+ objects.format = context.format.amount.value
169
+ }
170
+ },
171
+ {
172
+ notes: 'use time format error case',
173
+ where: where(),
174
+ match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.amount.value != 12 && context.format.amount.value != 24),
175
+ apply: ({objects, context}) => {
176
+ context.marker = 'response'
177
+ context.text = 'The hour format is 12 hour or 24 hour'
178
+ }
179
+ },
180
+ ],
181
+ }
187
182
  ],
188
- };
183
+ }
189
184
 
190
185
  function initializer({api, config, objects, kms, isModule}) {
191
186
  if (!isModule) {
@@ -201,8 +196,8 @@ function initializer({api, config, objects, kms, isModule}) {
201
196
  }
202
197
 
203
198
  knowledgeModule({
204
- config,
205
- includes: [tell, numbers, countable],
199
+ config: { name: 'time' },
200
+ includes: [tell, dimension],
206
201
  api: () => new API(),
207
202
  initializer,
208
203
 
@@ -212,7 +207,9 @@ knowledgeModule({
212
207
  name: './time.test.json',
213
208
  contents: time_tests,
214
209
  checks: {
215
- context: [defaultContextCheck({ extra: ['one', 'two', 'events', 'time', 'ampm'] })],
210
+ context: [defaultContextCheck({ extra: ['one', 'two', 'events', 'time', 'timePoint', 'ampm'] })],
216
211
  }
217
212
  },
213
+ instance,
214
+ template,
218
215
  })