tpmkms_4wp 9.5.1-beta.3 → 9.5.1-beta.31
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.
- package/common/animals.instance.json +21 -61
- package/common/asking.js +112 -102
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2174 -0
- package/common/can.js +254 -0
- package/common/can.test.json +51307 -0
- package/common/characters.js +3 -3
- package/common/colors.instance.json +10 -10
- package/common/comparable.instance.json +2 -2
- package/common/concept.js +19 -22
- package/common/concept.test.json +54 -40
- package/common/conjunction.js +13 -5
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +164 -150
- package/common/crew.js +1 -1
- package/common/currency.js +1 -1
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +3 -3
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +3 -3
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +41 -119
- package/common/dialogues.test.json +1171 -996
- package/common/dimension.instance.json +21374 -562
- package/common/dimension.js +145 -51
- package/common/dimension.test.json +8753 -3495
- package/common/drone.instance.json +23710 -0
- package/common/drone.js +429 -0
- package/common/drone.test.json +61113 -0
- package/common/edible.instance.json +23 -95
- package/common/emotions.instance.json +53 -80
- package/common/emotions.js +1 -1
- package/common/english_helpers.js +277 -67
- package/common/fastfood.instance.json +180 -372
- package/common/fastfood.js +4 -4
- package/common/fastfood.test.json +6970 -6829
- package/common/formulas.instance.json +1 -1
- package/common/gdefaults.js +94 -17
- package/common/help.js +11 -11
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +7 -2
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +8 -8
- package/common/helpers/properties.js +104 -23
- package/common/helpers.js +114 -48
- package/common/hierarchy.js +6 -4
- package/common/kirk.instance.json +1 -1
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +10 -10
- package/common/latin.js +5 -5
- package/common/length.instance.json +27612 -2890
- package/common/length.js +6 -1
- package/common/length.test.json +45315 -3925
- package/common/math.instance.json +20 -20
- package/common/math.js +45 -44
- package/common/menus.instance.json +6 -9
- package/common/menus.js +2 -9
- package/common/meta.js +50 -33
- package/common/nameable.js +13 -6
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +20 -30
- package/common/ordering.js +1 -1
- package/common/ordering.test.json +414 -426
- package/common/people.instance.json +82 -348
- package/common/people.js +1 -1
- package/common/people.test.json +952 -681
- package/common/pipboy.instance.json +16 -16
- package/common/pokemon.instance.json +8 -8
- package/common/pokemon.js +1 -1
- package/common/pressure.instance.json +3579 -1610
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +6 -17
- package/common/properties.js +19 -6
- package/common/properties.test.json +8746 -6638
- package/common/rates.instance.json +59 -0
- package/common/rates.js +97 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.js +1 -1
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +3 -3
- package/common/reports.js +18 -16
- package/common/scorekeeper.js +4 -4
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +1 -1
- package/common/spock.test.json +606 -430
- package/common/stgame.js +1 -1
- package/common/stm.js +15 -4
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +3786 -1705
- package/common/temperature.test.json +433 -477
- package/common/tester.js +3 -3
- package/common/time.instance.json +24762 -0
- package/common/time.js +137 -141
- package/common/time.test.json +31876 -3757
- package/common/tokenize.js +1 -1
- package/common/ui.instance.json +2 -5
- package/common/ui.js +1 -8
- package/common/weight.instance.json +10359 -4077
- package/common/weight.test.json +2601 -2263
- package/common/words.instance.json +9 -0
- package/common/words.js +53 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +336 -8
- package/common/wp.js +8 -4
- package/common/wp.test.json +7385 -6906
- package/main.js +4 -2
- package/package.json +18 -5
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/time.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const tell = require('./tell')
|
|
4
|
-
const
|
|
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)
|
|
11
11
|
const n = l - s.length
|
|
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,149 +51,138 @@ class API {
|
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
const 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
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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) {
|
|
192
187
|
kms.time.api.newDate = () => new Date("December 25, 1995 1:59:58 pm" )
|
|
193
188
|
}
|
|
@@ -201,8 +196,8 @@ const initializer = ({api, config, objects, kms, isModule}) => {
|
|
|
201
196
|
}
|
|
202
197
|
|
|
203
198
|
knowledgeModule({
|
|
204
|
-
config,
|
|
205
|
-
includes: [tell,
|
|
199
|
+
config: { name: 'time' },
|
|
200
|
+
includes: [tell, dimension],
|
|
206
201
|
api: () => new API(),
|
|
207
202
|
initializer,
|
|
208
203
|
|
|
@@ -212,7 +207,8 @@ 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
|
+
template: { template, instance },
|
|
218
214
|
})
|