tpmkms_4wp 9.3.0-beta.6 → 9.3.0-beta.7

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/time.js CHANGED
@@ -41,8 +41,11 @@ const config = {
41
41
  name: 'time',
42
42
  operators: [
43
43
  "([time])",
44
+ "([atTime|at] (time))",
44
45
  "([use] (([timeUnit]) [timeFormat|format]))",
45
- "(([number|]) [ampm|])"
46
+ // "(([number|]) [ampm|])",
47
+ "((time) [ampm|])",
48
+ "([hourMinutes|] (integer) (colon) (integer))",
46
49
  //"(([anyConcept]) [equals|is] ([anyConcept]))",
47
50
  //"(([what0|what]) [equals] (<the> ([timeConcept])))",
48
51
  //"(<whatP|what> ([anyConcept]))",
@@ -53,26 +56,47 @@ const config = {
53
56
  // how many hours are in a day
54
57
  ],
55
58
  bridges: [
56
- { "id": "time", "level": 0, "bridge": "{ ...next(operator) }" },
57
-
58
- // { "id": "hourUnits", "level": 0, "bridge": "{ ...next(operator) }" },
59
- { "id": "ampm", "level": 0, "bridge": "{ ...next(operator), hour: before[0] }" },
60
-
61
- { "id": "timeFormat", "level": 0, "bridge": "{ ...before[0], ...next(operator) }" },
62
- // { "id": "count", "level": 0, "bridge": "{ ...after, count: operator.value }" },
59
+ {
60
+ id: 'hourMinutes',
61
+ isA: ['time'],
62
+ convolution: true,
63
+ bridge: "{ ...next(operator), hour: after[0], colon: after[1], minute: after[2], interpolate: '${hour}${colon}${minute}' }",
64
+ },
65
+ {
66
+ id: "atTime",
67
+ words: ['@'],
68
+ isA: ['preposition'],
69
+ bridge: "{ ...next(operator), time: after[0], operator: operator, interpolate: '${operator} ${time}' }"
70
+ },
71
+ {
72
+ id: "time",
73
+ bridge: "{ ...next(operator) }"
74
+ },
75
+ {
76
+ id: "ampm",
77
+ isA: ['adjective'],
78
+ localHierarchy: [
79
+ ['integer', 'time'],
80
+ ],
81
+ 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}') }",
82
+ },
63
83
  {
64
- "id": "timeUnit",
65
- "level": 0,
84
+ id: "timeFormat",
85
+ bridge: "{ ...before[0], ...next(operator) }"
86
+ },
87
+ {
88
+ id: "timeUnit",
66
89
  words: [
67
90
  ...helpers.words('hour', { initial: "{ units: 'hour' }" }),
68
91
  ...helpers.words('minute', { initial: "{ units: 'minute' }" }),
69
92
  ...helpers.words('second', { initial: "{ units: 'second' }" }),
70
93
  ],
71
- "bridge": "{ ...next(operator) }"
94
+ bridge: "{ ...next(operator) }"
72
95
  },
73
- { "id": "use", "level": 0,
74
- bridge: "{ ...next(operator), format: after[0] }",
75
- generatorp: ({g, context}) => `use ${context.format.quantity.value} hour time`
96
+ {
97
+ id: "use",
98
+ bridge: "{ ...next(operator), format: after[0] }",
99
+ generatorp: ({g, context}) => `use ${context.format.quantity.value} hour time`
76
100
  },
77
101
  ],
78
102
  hierarchy: [
@@ -84,26 +108,21 @@ const config = {
84
108
 
85
109
  "words": {
86
110
  "literals": {
87
- // " ([0-9]+)": [{"id": "count", "initial": "{ value: int(group[0]) }" }],
88
- // " (1[0-2]|[1-9])": [{"id": "hourUnits", "initial": "{ hour: int(group[0]) }" }],
89
- "am": [{"id": "ampm", "initial": "{ ampm: 'am', determined: true }" }],
90
- "pm": [{"id": "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
91
- //" (1[0-2]|[1-9]) ?pm": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'pm' }" }],
92
- //" (1[0-2]|[1-9]) ?am": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'am' }" }],
111
+ // " ([0-9]+)": [{id: "count", "initial": "{ value: int(group[0]) }" }],
112
+ // " (1[0-2]|[1-9])": [{id: "hourUnits", "initial": "{ hour: int(group[0]) }" }],
113
+ "am": [{id: "ampm", "initial": "{ ampm: 'am', determined: true }" }],
114
+ "pm": [{id: "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
115
+ //" (1[0-2]|[1-9]) ?pm": [{id: "count", "initial": "{ hour: int(group[0]), part: 'pm' }" }],
116
+ //" (1[0-2]|[1-9]) ?am": [{id: "count", "initial": "{ hour: int(group[0]), part: 'am' }" }],
93
117
  /*
94
- " hours?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
95
- " minutes?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
96
- " seconds?": [{"id": "timeUnit", "initial": "{ units: 'seconds' }" }],
118
+ " hours?": [{id: "timeUnit", "initial": "{ units: 'hour' }" }],
119
+ " minutes?": [{id: "timeUnit", "initial": "{ units: 'hour' }" }],
120
+ " seconds?": [{id: "timeUnit", "initial": "{ units: 'seconds' }" }],
97
121
  */
98
122
  }
99
123
  },
100
124
 
101
125
  generators: [
102
- {
103
- where: where(),
104
- match: ({context}) => context.marker == 'ampm' && context.paraphrase,
105
- apply: async ({g, context, gp}) => `${await gp(context.hour)} ${context.ampm}`
106
- },
107
126
  {
108
127
  where: where(),
109
128
  match: ({context}) => context.marker == 'time' && context.evalue && context.format == 12,
@@ -182,6 +201,19 @@ const initializer = ({api, config, objects, kms, isModule}) => {
182
201
  })
183
202
  }
184
203
 
204
+ console.log('greg23 ssssssssssssss')
205
+ console.log(JSON.stringify(defaultContextCheck([
206
+ //{ 'event': { , 'target', 'one', 'two']
207
+ {
208
+ event: {
209
+ one: 'defaults',
210
+ two: 'defaults',
211
+ info: 'defaults',
212
+ target: 'defaults'
213
+ }
214
+ },
215
+ ]), null, 2))
216
+
185
217
  knowledgeModule({
186
218
  config,
187
219
  includes: [tell, numbers, countable],
@@ -194,7 +226,13 @@ knowledgeModule({
194
226
  name: './time.test.json',
195
227
  contents: time_tests,
196
228
  checks: {
197
- context: defaultContextCheck(),
198
- },
229
+ context: defaultContextCheck([{
230
+ event: {
231
+ defaults: true,
232
+ one: 'defaults',
233
+ two: 'defaults',
234
+ }
235
+ }]),
236
+ },
199
237
  },
200
238
  })