ekms 7.12.8-beta.0 → 7.12.8-beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/common/animals.instance.json +89 -249
  2. package/common/animals.js +1 -1
  3. package/common/avatar.js +7 -5
  4. package/common/characters.js +12 -5
  5. package/common/crew.instance.json +289 -577
  6. package/common/crew.js +1 -1
  7. package/common/currency.js +0 -2
  8. package/common/dialogues.js +16 -14
  9. package/common/dimension.instance.json +747 -73
  10. package/common/dimension.js +15 -7
  11. package/common/edible.instance.json +293 -297
  12. package/common/edible.js +1 -1
  13. package/common/emotions.instance.json +29 -65
  14. package/common/emotions.js +1 -1
  15. package/common/fastfood.instance.json +517 -1473
  16. package/common/fastfood.js +1 -1
  17. package/common/formulas.instance.json +992 -0
  18. package/common/formulas.js +19 -6
  19. package/common/gdefaults.js +2 -0
  20. package/common/help.js +7 -2
  21. package/common/help.test.json +9 -5
  22. package/common/helpers.js +5 -0
  23. package/common/javascript.js +8 -6
  24. package/common/kirk.instance.json +1 -1
  25. package/common/kirk.js +1 -1
  26. package/common/length.instance.json +199 -683
  27. package/common/length.js +1 -1
  28. package/common/math.instance.json +21 -41
  29. package/common/math.js +1 -1
  30. package/common/meta.instance.json +1 -1
  31. package/common/meta.js +35 -10
  32. package/common/numbers.js +28 -24
  33. package/common/ordering.instance.json +37 -101
  34. package/common/ordering.js +1 -1
  35. package/common/people.instance.json +50 -78
  36. package/common/people.js +1 -1
  37. package/common/pipboy.instance.json +23431 -1082
  38. package/common/pipboy.js +31 -4
  39. package/common/pokemon.instance.json +41 -97
  40. package/common/pokemon.js +1 -1
  41. package/common/pressure.instance.json +61 -33
  42. package/common/pressure.js +1 -1
  43. package/common/properties.instance.json +21 -49
  44. package/common/properties.js +13 -8
  45. package/common/reports.instance.json +7 -63
  46. package/common/reports.js +9 -7
  47. package/common/scorekeeper.instance.json +1 -1
  48. package/common/scorekeeper.js +9 -7
  49. package/common/spock.instance.json +1 -1
  50. package/common/spock.js +1 -1
  51. package/common/tell.js +4 -2
  52. package/common/temperature.instance.json +65 -133
  53. package/common/temperature.js +1 -1
  54. package/common/time.js +36 -20
  55. package/common/time.test.json +66 -44
  56. package/common/tokenize.js +46 -0
  57. package/common/ui.instance.json +1 -1
  58. package/common/weight.instance.json +177 -201
  59. package/common/weight.js +1 -1
  60. package/main.js +2 -6
  61. package/package.json +6 -14
  62. package/common/dimensionTemplate.instance.json +0 -582
  63. package/common/dimensionTemplate.js +0 -35
  64. package/common/formulasTemplate.instance.json +0 -483
  65. package/common/formulasTemplate.js +0 -30
  66. package/common/formulasTemplate.test.json +0 -2
  67. package/common/pipboyTemplate.instance.json +0 -17420
  68. package/common/pipboyTemplate.js +0 -48
  69. package/common/pipboyTemplate.test.json +0 -2
  70. /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
@@ -17,7 +17,7 @@ const game = {
17
17
  */
18
18
 
19
19
  const template = {
20
- queries: [
20
+ configs: [
21
21
  // "start a new game\ngreg and jeff",
22
22
  // { query: "start a new game", development: true },
23
23
  // { query: "the winning score is 20", development: true },
@@ -91,12 +91,14 @@ let configStruct = {
91
91
  { id: "point", level: 0, bridge: "{ ...next(operator), amount: before[0], modifiers: append(['amount']) }" },
92
92
  ],
93
93
  words: {
94
- "winning": [{"id": "winning", "initial": "{ modifiers: [] }" }],
95
- /*
96
- " ([0-9]+)": [{"id": "number", "initial": "{ value: int(group[0]) }" }],
97
- "one": [{"id": "number", "initial": "{ value: 1 }" }],
98
- "ten": [{"id": "number", "initial": "{ value: 10 }" }],
99
- */
94
+ "literals": {
95
+ "winning": [{"id": "winning", "initial": "{ modifiers: [] }" }],
96
+ /*
97
+ " ([0-9]+)": [{"id": "number", "initial": "{ value: int(group[0]) }" }],
98
+ "one": [{"id": "number", "initial": "{ value: 1 }" }],
99
+ "ten": [{"id": "number", "initial": "{ value: 10 }" }],
100
+ */
101
+ }
100
102
  },
101
103
  priorities: [
102
104
  { "context": [['winning', 0], ['is', 0], ['the', 0], ], "choose": [0] },
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [
2
+ "configs": [
3
3
  "you are spock"
4
4
  ],
5
5
  "resultss": [
package/common/spock.js CHANGED
@@ -5,7 +5,7 @@ const spock_tests = require('./spock.test.json')
5
5
  const spock_instance = require('./spock.instance.json')
6
6
 
7
7
  const template = {
8
- "queries": [
8
+ configs: [
9
9
  "you are spock",
10
10
  ]
11
11
  };
package/common/tell.js CHANGED
@@ -54,8 +54,10 @@ let configStruct = {
54
54
  { id: 'tell', level: 0, bridge: '{ ...next(operator), target: after[0], info: after[1], event: after[2] }' },
55
55
  ],
56
56
  words: {
57
- "when": [{ id: 'info', level: 0, initial: "{ info: 'when' }" }],
58
- "me": [{ id: 'person', level: 0, initial: "{ target: 'me' }" }],
57
+ "literals": {
58
+ "when": [{ id: 'info', level: 0, initial: "{ info: 'when' }" }],
59
+ "me": [{ id: 'person', level: 0, initial: "{ target: 'me' }" }],
60
+ }
59
61
  },
60
62
  hierarchy: [
61
63
  ['is', 'event'],
@@ -1,5 +1,5 @@
1
1
  {
2
- "queries": [
2
+ "configs": [
3
3
  "temperature is a dimension",
4
4
  "celcius fahrenheit and kelvin are units of temperature",
5
5
  "fahrenheit = celcius*9/5 + 32",
@@ -192,6 +192,10 @@
192
192
  "convertToUnits",
193
193
  "queryable"
194
194
  ],
195
+ [
196
+ "convertToUnits",
197
+ "testingValue"
198
+ ],
195
199
  [
196
200
  "countable",
197
201
  "hierarchyAble"
@@ -344,6 +348,10 @@
344
348
  "it",
345
349
  "toAble"
346
350
  ],
351
+ [
352
+ "length",
353
+ "dimension"
354
+ ],
347
355
  [
348
356
  "lowest",
349
357
  "condition"
@@ -572,6 +580,10 @@
572
580
  "reason",
573
581
  "theAble"
574
582
  ],
583
+ [
584
+ "testingValue",
585
+ "testingValue"
586
+ ],
575
587
  [
576
588
  "that",
577
589
  "thisitthat"
@@ -815,15 +827,15 @@
815
827
  },
816
828
  "one": {
817
829
  "number": "one",
830
+ "value": "temperature",
831
+ "unknown": true,
832
+ "text": "temperature",
818
833
  "marker": "unknown",
834
+ "word": "temperature",
819
835
  "range": {
820
836
  "start": 0,
821
837
  "end": 25
822
838
  },
823
- "word": "temperature",
824
- "text": "temperature",
825
- "value": "temperature",
826
- "unknown": true,
827
839
  "dead": true,
828
840
  "types": [
829
841
  "unknown"
@@ -1136,6 +1148,10 @@
1136
1148
  "convertToUnits",
1137
1149
  "queryable"
1138
1150
  ],
1151
+ [
1152
+ "convertToUnits",
1153
+ "testingValue"
1154
+ ],
1139
1155
  [
1140
1156
  "countable",
1141
1157
  "hierarchyAble"
@@ -1288,6 +1304,10 @@
1288
1304
  "it",
1289
1305
  "toAble"
1290
1306
  ],
1307
+ [
1308
+ "length",
1309
+ "dimension"
1310
+ ],
1291
1311
  [
1292
1312
  "lowest",
1293
1313
  "condition"
@@ -1548,6 +1568,10 @@
1548
1568
  "temperature",
1549
1569
  "theAble"
1550
1570
  ],
1571
+ [
1572
+ "testingValue",
1573
+ "testingValue"
1574
+ ],
1551
1575
  [
1552
1576
  "that",
1553
1577
  "thisitthat"
@@ -2014,41 +2038,41 @@
2014
2038
  "listable": true,
2015
2039
  "value": [
2016
2040
  {
2041
+ "value": "celcius",
2042
+ "unknown": true,
2043
+ "text": "celcius",
2017
2044
  "marker": "unknown",
2045
+ "word": "celcius",
2018
2046
  "range": {
2019
2047
  "start": 0,
2020
2048
  "end": 6
2021
2049
  },
2022
- "word": "celcius",
2023
- "text": "celcius",
2024
- "value": "celcius",
2025
- "unknown": true,
2026
2050
  "dead": true,
2027
2051
  "level": 1
2028
2052
  },
2029
2053
  {
2054
+ "value": "fahrenheit",
2055
+ "unknown": true,
2056
+ "text": "fahrenheit",
2030
2057
  "marker": "unknown",
2058
+ "word": "fahrenheit",
2031
2059
  "range": {
2032
2060
  "start": 8,
2033
2061
  "end": 17
2034
2062
  },
2035
- "word": "fahrenheit",
2036
- "text": "fahrenheit",
2037
- "value": "fahrenheit",
2038
- "unknown": true,
2039
2063
  "dead": true,
2040
2064
  "level": 2
2041
2065
  },
2042
2066
  {
2067
+ "value": "kelvin",
2068
+ "unknown": true,
2069
+ "text": "kelvin",
2043
2070
  "marker": "unknown",
2071
+ "word": "kelvin",
2044
2072
  "range": {
2045
2073
  "start": 23,
2046
2074
  "end": 28
2047
2075
  },
2048
- "word": "kelvin",
2049
- "text": "kelvin",
2050
- "value": "kelvin",
2051
- "unknown": true,
2052
2076
  "dead": true,
2053
2077
  "level": 2
2054
2078
  }
@@ -2336,16 +2360,6 @@
2336
2360
  "propertyOf",
2337
2361
  1
2338
2362
  ]
2339
- ],
2340
- [
2341
- [
2342
- "temperature",
2343
- 0
2344
- ],
2345
- [
2346
- "unknown",
2347
- 0
2348
- ]
2349
2363
  ]
2350
2364
  ],
2351
2365
  "learned_contextual_priorities": [],
@@ -2572,6 +2586,10 @@
2572
2586
  "convertToUnits",
2573
2587
  "queryable"
2574
2588
  ],
2589
+ [
2590
+ "convertToUnits",
2591
+ "testingValue"
2592
+ ],
2575
2593
  [
2576
2594
  "countable",
2577
2595
  "hierarchyAble"
@@ -2788,6 +2806,10 @@
2788
2806
  "kelvin",
2789
2807
  "unit"
2790
2808
  ],
2809
+ [
2810
+ "length",
2811
+ "dimension"
2812
+ ],
2791
2813
  [
2792
2814
  "lowest",
2793
2815
  "condition"
@@ -3048,6 +3070,10 @@
3048
3070
  "temperature",
3049
3071
  "theAble"
3050
3072
  ],
3073
+ [
3074
+ "testingValue",
3075
+ "testingValue"
3076
+ ],
3051
3077
  [
3052
3078
  "that",
3053
3079
  "thisitthat"
@@ -3620,28 +3646,6 @@
3620
3646
  ""
3621
3647
  ],
3622
3648
  "associations": [
3623
- [
3624
- [
3625
- "*",
3626
- 0
3627
- ],
3628
- [
3629
- "+",
3630
- 0
3631
- ],
3632
- [
3633
- "/",
3634
- 0
3635
- ],
3636
- [
3637
- "celcius",
3638
- 0
3639
- ],
3640
- [
3641
- "fahrenheit",
3642
- 0
3643
- ]
3644
- ],
3645
3649
  [
3646
3650
  [
3647
3651
  "celcius",
@@ -3987,6 +3991,10 @@
3987
3991
  "convertToUnits",
3988
3992
  "queryable"
3989
3993
  ],
3994
+ [
3995
+ "convertToUnits",
3996
+ "testingValue"
3997
+ ],
3990
3998
  [
3991
3999
  "countable",
3992
4000
  "hierarchyAble"
@@ -4203,6 +4211,10 @@
4203
4211
  "kelvin",
4204
4212
  "unit"
4205
4213
  ],
4214
+ [
4215
+ "length",
4216
+ "dimension"
4217
+ ],
4206
4218
  [
4207
4219
  "lowest",
4208
4220
  "condition"
@@ -4463,6 +4475,10 @@
4463
4475
  "temperature",
4464
4476
  "theAble"
4465
4477
  ],
4478
+ [
4479
+ "testingValue",
4480
+ "testingValue"
4481
+ ],
4466
4482
  [
4467
4483
  "that",
4468
4484
  "thisitthat"
@@ -5107,32 +5123,6 @@
5107
5123
  ""
5108
5124
  ],
5109
5125
  "associations": [
5110
- [
5111
- [
5112
- "*",
5113
- 0
5114
- ],
5115
- [
5116
- "+",
5117
- 0
5118
- ],
5119
- [
5120
- "-",
5121
- 0
5122
- ],
5123
- [
5124
- "/",
5125
- 0
5126
- ],
5127
- [
5128
- "celcius",
5129
- 0
5130
- ],
5131
- [
5132
- "fahrenheit",
5133
- 0
5134
- ]
5135
- ],
5136
5126
  [
5137
5127
  [
5138
5128
  "celcius",
@@ -5378,54 +5368,6 @@
5378
5368
  "fragments": [],
5379
5369
  "semantics": [],
5380
5370
  "associations": [
5381
- [
5382
- [
5383
- "*",
5384
- 0
5385
- ],
5386
- [
5387
- "+",
5388
- 0
5389
- ],
5390
- [
5391
- "-",
5392
- 0
5393
- ],
5394
- [
5395
- "/",
5396
- 0
5397
- ],
5398
- [
5399
- "celcius",
5400
- 0
5401
- ],
5402
- [
5403
- "fahrenheit",
5404
- 0
5405
- ]
5406
- ],
5407
- [
5408
- [
5409
- "*",
5410
- 0
5411
- ],
5412
- [
5413
- "+",
5414
- 0
5415
- ],
5416
- [
5417
- "/",
5418
- 0
5419
- ],
5420
- [
5421
- "celcius",
5422
- 0
5423
- ],
5424
- [
5425
- "fahrenheit",
5426
- 0
5427
- ]
5428
- ],
5429
5371
  [
5430
5372
  [
5431
5373
  "a",
@@ -6025,16 +5967,6 @@
6025
5967
  "unknown",
6026
5968
  1
6027
5969
  ]
6028
- ],
6029
- [
6030
- [
6031
- "temperature",
6032
- 0
6033
- ],
6034
- [
6035
- "unknown",
6036
- 0
6037
- ]
6038
5970
  ]
6039
5971
  ],
6040
5972
  "learned_contextual_priorities": []
@@ -5,7 +5,7 @@ const temperature_tests = require('./temperature.test.json')
5
5
  const temperature_instance = require('./temperature.instance.json')
6
6
 
7
7
  const template = {
8
- "queries": [
8
+ configs: [
9
9
  "temperature is a dimension",
10
10
  "celcius fahrenheit and kelvin are units of temperature",
11
11
 
package/common/time.js CHANGED
@@ -1,6 +1,8 @@
1
1
  const { Config, 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
6
  const helpers = require('./helpers')
5
7
  const time_tests = require('./time.test.json')
6
8
 
@@ -40,8 +42,8 @@ const configStruct = {
40
42
  name: 'time',
41
43
  operators: [
42
44
  "([time])",
43
- "([use] ((<count> ([timeUnit])) [timeFormat|format]))",
44
- "(([hourUnits|]) [ampm|])"
45
+ "([use] (([timeUnit]) [timeFormat|format]))",
46
+ "(([number|]) [ampm|])"
45
47
  //"(([anyConcept]) [equals|is] ([anyConcept]))",
46
48
  //"(([what0|what]) [equals] (<the> ([timeConcept])))",
47
49
  //"(<whatP|what> ([anyConcept]))",
@@ -54,40 +56,54 @@ const configStruct = {
54
56
  bridges: [
55
57
  { "id": "time", "level": 0, "bridge": "{ ...next(operator) }" },
56
58
 
57
- { "id": "hourUnits", "level": 0, "bridge": "{ ...next(operator) }" },
59
+ // { "id": "hourUnits", "level": 0, "bridge": "{ ...next(operator) }" },
58
60
  { "id": "ampm", "level": 0, "bridge": "{ ...next(operator), hour: before[0] }" },
59
61
 
60
62
  { "id": "timeFormat", "level": 0, "bridge": "{ ...before[0], ...next(operator) }" },
61
- { "id": "count", "level": 0, "bridge": "{ ...after, count: operator.value }" },
62
- { "id": "timeUnit", "level": 0, "bridge": "{ ...next(operator) }" },
63
+ // { "id": "count", "level": 0, "bridge": "{ ...after, count: operator.value }" },
64
+ {
65
+ "id": "timeUnit",
66
+ "level": 0,
67
+ words: [
68
+ ...helpers.words('hour', { initial: "{ units: 'hour' }" }),
69
+ ...helpers.words('minute', { initial: "{ units: 'minute' }" }),
70
+ ...helpers.words('second', { initial: "{ units: 'second' }" }),
71
+ ],
72
+ "bridge": "{ ...next(operator) }"
73
+ },
63
74
  { "id": "use", "level": 0,
64
75
  bridge: "{ ...next(operator), format: after[0] }",
65
- generatorp: ({g, context}) => `use ${context.format.count} hour time`
76
+ generatorp: ({g, context}) => `use ${context.format.quantity.value} hour time`
66
77
  },
67
78
  ],
68
79
  hierarchy: [
69
80
  ['time', 'queryable'],
70
81
  ['ampm', 'queryable'],
71
82
  ['time', 'theAble'],
83
+ ['timeUnit', 'countable'],
72
84
  ],
73
85
 
74
86
  "words": {
75
- " ([0-9]+)": [{"id": "count", "initial": "{ value: int(group[0]) }" }],
76
- " (1[0-2]|[1-9])": [{"id": "hourUnits", "initial": "{ hour: int(group[0]) }" }],
77
- "am": [{"id": "ampm", "initial": "{ ampm: 'am', determined: true }" }],
78
- "pm": [{"id": "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
79
- //" (1[0-2]|[1-9]) ?pm": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'pm' }" }],
80
- //" (1[0-2]|[1-9]) ?am": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'am' }" }],
81
- " hours?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
82
- " minutes?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
83
- " seconds?": [{"id": "timeUnit", "initial": "{ units: 'seconds' }" }],
87
+ "literals": {
88
+ // " ([0-9]+)": [{"id": "count", "initial": "{ value: int(group[0]) }" }],
89
+ // " (1[0-2]|[1-9])": [{"id": "hourUnits", "initial": "{ hour: int(group[0]) }" }],
90
+ "am": [{"id": "ampm", "initial": "{ ampm: 'am', determined: true }" }],
91
+ "pm": [{"id": "ampm", "initial": "{ ampm: 'pm', determined: true }" }],
92
+ //" (1[0-2]|[1-9]) ?pm": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'pm' }" }],
93
+ //" (1[0-2]|[1-9]) ?am": [{"id": "count", "initial": "{ hour: int(group[0]), part: 'am' }" }],
94
+ /*
95
+ " hours?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
96
+ " minutes?": [{"id": "timeUnit", "initial": "{ units: 'hour' }" }],
97
+ " seconds?": [{"id": "timeUnit", "initial": "{ units: 'seconds' }" }],
98
+ */
99
+ }
84
100
  },
85
101
 
86
102
  generators: [
87
103
  {
88
104
  where: where(),
89
105
  match: ({context}) => context.marker == 'ampm' && context.paraphrase,
90
- apply: ({g, context}) => `${context.hour.hour} ${context.ampm}`
106
+ apply: ({g, context, gp}) => `${gp(context.hour)} ${context.ampm}`
91
107
  },
92
108
  {
93
109
  where: where(),
@@ -137,15 +153,15 @@ const configStruct = {
137
153
  {
138
154
  notes: 'use time format working case',
139
155
  where: where(),
140
- match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.count == 12 || context.format.count == 24),
156
+ match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.quantity.value == 12 || context.format.quantity.value == 24),
141
157
  apply: ({objects, context}) => {
142
- objects.format = context.format.count
158
+ objects.format = context.format.quantity.value
143
159
  }
144
160
  },
145
161
  {
146
162
  notes: 'use time format error case',
147
163
  where: where(),
148
- match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.count != 12 && context.format.count != 24),
164
+ match: ({objects, context}) => context.marker == 'use' && context.format && (context.format.quantity.value != 12 && context.format.quantity.value != 24),
149
165
  apply: ({objects, context}) => {
150
166
  context.marker = 'response'
151
167
  context.text = 'The hour format is 12 hour or 24 hour'
@@ -157,7 +173,7 @@ const configStruct = {
157
173
  const createConfig = () => {
158
174
  const config = new Config(configStruct, module)
159
175
  config.stop_auto_rebuild()
160
- config.add(tell())
176
+ config.add(tell()).add(numbers()).add(countable())
161
177
  config.api = api
162
178
  config.initializer( ({config, objects, kms, isModule}) => {
163
179
  if (!isModule) {