ekms 7.12.8 → 8.0.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/common/animals.instance.json +89 -293
  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 +122 -17
  9. package/common/dimension.instance.json +747 -73
  10. package/common/dimension.js +15 -7
  11. package/common/edible.instance.json +243 -435
  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 +1080 -2072
  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/formulas.test.json +1187 -3651
  20. package/common/gdefaults.js +2 -0
  21. package/common/help.js +7 -2
  22. package/common/help.test.json +9 -5
  23. package/common/helpers.js +5 -0
  24. package/common/javascript.js +8 -6
  25. package/common/kirk.instance.json +1 -1
  26. package/common/kirk.js +1 -1
  27. package/common/length.instance.json +316 -740
  28. package/common/length.js +1 -1
  29. package/common/math.instance.json +1959 -1
  30. package/common/math.js +17 -5
  31. package/common/meta.instance.json +1 -1
  32. package/common/meta.js +35 -10
  33. package/common/numbers.js +28 -24
  34. package/common/ordering.instance.json +37 -153
  35. package/common/ordering.js +1 -1
  36. package/common/people.instance.json +50 -78
  37. package/common/people.js +1 -1
  38. package/common/pipboy.instance.json +23431 -1082
  39. package/common/pipboy.js +31 -4
  40. package/common/pipboy.test.json +13 -9
  41. package/common/pokemon.instance.json +41 -141
  42. package/common/pokemon.js +1 -1
  43. package/common/pressure.instance.json +93 -33
  44. package/common/pressure.js +1 -1
  45. package/common/properties.instance.json +21 -49
  46. package/common/properties.js +13 -8
  47. package/common/reports.instance.json +23 -63
  48. package/common/reports.js +9 -7
  49. package/common/scorekeeper.instance.json +1 -1
  50. package/common/scorekeeper.js +9 -7
  51. package/common/spock.instance.json +1 -1
  52. package/common/spock.js +1 -1
  53. package/common/tell.js +4 -2
  54. package/common/temperature.instance.json +97 -193
  55. package/common/temperature.js +1 -1
  56. package/common/time.js +36 -20
  57. package/common/time.test.json +66 -44
  58. package/common/tokenize.js +46 -0
  59. package/common/ui.instance.json +9 -1
  60. package/common/weight.instance.json +273 -217
  61. package/common/weight.js +1 -1
  62. package/main.js +4 -8
  63. package/package.json +6 -18
  64. package/common/dimensionTemplate.instance.json +0 -582
  65. package/common/dimensionTemplate.js +0 -35
  66. package/common/formulasTemplate.instance.json +0 -483
  67. package/common/formulasTemplate.js +0 -30
  68. package/common/formulasTemplate.test.json +0 -2
  69. package/common/mathTemplate.instance.json +0 -1635
  70. package/common/mathTemplate.js +0 -32
  71. package/common/mathTemplate.test.json +0 -1422
  72. package/common/pipboyTemplate.instance.json +0 -17420
  73. package/common/pipboyTemplate.js +0 -48
  74. package/common/pipboyTemplate.test.json +0 -2
  75. /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
@@ -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"
@@ -696,9 +708,17 @@
696
708
  "whose",
697
709
  "object"
698
710
  ],
711
+ [
712
+ "x",
713
+ "number"
714
+ ],
699
715
  [
700
716
  "xfx",
701
717
  "queryable"
718
+ ],
719
+ [
720
+ "y",
721
+ "number"
702
722
  ]
703
723
  ],
704
724
  "metadata": {
@@ -807,15 +827,15 @@
807
827
  },
808
828
  "one": {
809
829
  "number": "one",
830
+ "value": "temperature",
831
+ "unknown": true,
832
+ "text": "temperature",
810
833
  "marker": "unknown",
834
+ "word": "temperature",
811
835
  "range": {
812
836
  "start": 0,
813
837
  "end": 25
814
838
  },
815
- "word": "temperature",
816
- "text": "temperature",
817
- "value": "temperature",
818
- "unknown": true,
819
839
  "dead": true,
820
840
  "types": [
821
841
  "unknown"
@@ -1128,6 +1148,10 @@
1128
1148
  "convertToUnits",
1129
1149
  "queryable"
1130
1150
  ],
1151
+ [
1152
+ "convertToUnits",
1153
+ "testingValue"
1154
+ ],
1131
1155
  [
1132
1156
  "countable",
1133
1157
  "hierarchyAble"
@@ -1280,6 +1304,10 @@
1280
1304
  "it",
1281
1305
  "toAble"
1282
1306
  ],
1307
+ [
1308
+ "length",
1309
+ "dimension"
1310
+ ],
1283
1311
  [
1284
1312
  "lowest",
1285
1313
  "condition"
@@ -1540,6 +1568,10 @@
1540
1568
  "temperature",
1541
1569
  "theAble"
1542
1570
  ],
1571
+ [
1572
+ "testingValue",
1573
+ "testingValue"
1574
+ ],
1543
1575
  [
1544
1576
  "that",
1545
1577
  "thisitthat"
@@ -1664,9 +1696,17 @@
1664
1696
  "whose",
1665
1697
  "object"
1666
1698
  ],
1699
+ [
1700
+ "x",
1701
+ "number"
1702
+ ],
1667
1703
  [
1668
1704
  "xfx",
1669
1705
  "queryable"
1706
+ ],
1707
+ [
1708
+ "y",
1709
+ "number"
1670
1710
  ]
1671
1711
  ],
1672
1712
  "metadata": {
@@ -1998,41 +2038,41 @@
1998
2038
  "listable": true,
1999
2039
  "value": [
2000
2040
  {
2041
+ "value": "celcius",
2042
+ "unknown": true,
2043
+ "text": "celcius",
2001
2044
  "marker": "unknown",
2045
+ "word": "celcius",
2002
2046
  "range": {
2003
2047
  "start": 0,
2004
2048
  "end": 6
2005
2049
  },
2006
- "word": "celcius",
2007
- "text": "celcius",
2008
- "value": "celcius",
2009
- "unknown": true,
2010
2050
  "dead": true,
2011
2051
  "level": 1
2012
2052
  },
2013
2053
  {
2054
+ "value": "fahrenheit",
2055
+ "unknown": true,
2056
+ "text": "fahrenheit",
2014
2057
  "marker": "unknown",
2058
+ "word": "fahrenheit",
2015
2059
  "range": {
2016
2060
  "start": 8,
2017
2061
  "end": 17
2018
2062
  },
2019
- "word": "fahrenheit",
2020
- "text": "fahrenheit",
2021
- "value": "fahrenheit",
2022
- "unknown": true,
2023
2063
  "dead": true,
2024
2064
  "level": 2
2025
2065
  },
2026
2066
  {
2067
+ "value": "kelvin",
2068
+ "unknown": true,
2069
+ "text": "kelvin",
2027
2070
  "marker": "unknown",
2071
+ "word": "kelvin",
2028
2072
  "range": {
2029
2073
  "start": 23,
2030
2074
  "end": 28
2031
2075
  },
2032
- "word": "kelvin",
2033
- "text": "kelvin",
2034
- "value": "kelvin",
2035
- "unknown": true,
2036
2076
  "dead": true,
2037
2077
  "level": 2
2038
2078
  }
@@ -2191,36 +2231,6 @@
2191
2231
  1
2192
2232
  ]
2193
2233
  ],
2194
- [
2195
- [
2196
- "is",
2197
- 0
2198
- ],
2199
- [
2200
- "list",
2201
- 0
2202
- ],
2203
- [
2204
- "propertyOf",
2205
- 0
2206
- ],
2207
- [
2208
- "temperature",
2209
- 0
2210
- ],
2211
- [
2212
- "unit",
2213
- 0
2214
- ],
2215
- [
2216
- "unknown",
2217
- 0
2218
- ],
2219
- [
2220
- "unknown",
2221
- 1
2222
- ]
2223
- ],
2224
2234
  [
2225
2235
  [
2226
2236
  "is",
@@ -2350,16 +2360,6 @@
2350
2360
  "propertyOf",
2351
2361
  1
2352
2362
  ]
2353
- ],
2354
- [
2355
- [
2356
- "temperature",
2357
- 0
2358
- ],
2359
- [
2360
- "unknown",
2361
- 0
2362
- ]
2363
2363
  ]
2364
2364
  ],
2365
2365
  "learned_contextual_priorities": [],
@@ -2586,6 +2586,10 @@
2586
2586
  "convertToUnits",
2587
2587
  "queryable"
2588
2588
  ],
2589
+ [
2590
+ "convertToUnits",
2591
+ "testingValue"
2592
+ ],
2589
2593
  [
2590
2594
  "countable",
2591
2595
  "hierarchyAble"
@@ -2802,6 +2806,10 @@
2802
2806
  "kelvin",
2803
2807
  "unit"
2804
2808
  ],
2809
+ [
2810
+ "length",
2811
+ "dimension"
2812
+ ],
2805
2813
  [
2806
2814
  "lowest",
2807
2815
  "condition"
@@ -3062,6 +3070,10 @@
3062
3070
  "temperature",
3063
3071
  "theAble"
3064
3072
  ],
3073
+ [
3074
+ "testingValue",
3075
+ "testingValue"
3076
+ ],
3065
3077
  [
3066
3078
  "that",
3067
3079
  "thisitthat"
@@ -3186,9 +3198,17 @@
3186
3198
  "whose",
3187
3199
  "object"
3188
3200
  ],
3201
+ [
3202
+ "x",
3203
+ "number"
3204
+ ],
3189
3205
  [
3190
3206
  "xfx",
3191
3207
  "queryable"
3208
+ ],
3209
+ [
3210
+ "y",
3211
+ "number"
3192
3212
  ]
3193
3213
  ],
3194
3214
  "metadata": {
@@ -3626,28 +3646,6 @@
3626
3646
  ""
3627
3647
  ],
3628
3648
  "associations": [
3629
- [
3630
- [
3631
- "*",
3632
- 0
3633
- ],
3634
- [
3635
- "+",
3636
- 0
3637
- ],
3638
- [
3639
- "/",
3640
- 0
3641
- ],
3642
- [
3643
- "celcius",
3644
- 0
3645
- ],
3646
- [
3647
- "fahrenheit",
3648
- 0
3649
- ]
3650
- ],
3651
3649
  [
3652
3650
  [
3653
3651
  "celcius",
@@ -3993,6 +3991,10 @@
3993
3991
  "convertToUnits",
3994
3992
  "queryable"
3995
3993
  ],
3994
+ [
3995
+ "convertToUnits",
3996
+ "testingValue"
3997
+ ],
3996
3998
  [
3997
3999
  "countable",
3998
4000
  "hierarchyAble"
@@ -4209,6 +4211,10 @@
4209
4211
  "kelvin",
4210
4212
  "unit"
4211
4213
  ],
4214
+ [
4215
+ "length",
4216
+ "dimension"
4217
+ ],
4212
4218
  [
4213
4219
  "lowest",
4214
4220
  "condition"
@@ -4469,6 +4475,10 @@
4469
4475
  "temperature",
4470
4476
  "theAble"
4471
4477
  ],
4478
+ [
4479
+ "testingValue",
4480
+ "testingValue"
4481
+ ],
4472
4482
  [
4473
4483
  "that",
4474
4484
  "thisitthat"
@@ -4593,9 +4603,17 @@
4593
4603
  "whose",
4594
4604
  "object"
4595
4605
  ],
4606
+ [
4607
+ "x",
4608
+ "number"
4609
+ ],
4596
4610
  [
4597
4611
  "xfx",
4598
4612
  "queryable"
4613
+ ],
4614
+ [
4615
+ "y",
4616
+ "number"
4599
4617
  ]
4600
4618
  ],
4601
4619
  "metadata": {
@@ -5105,32 +5123,6 @@
5105
5123
  ""
5106
5124
  ],
5107
5125
  "associations": [
5108
- [
5109
- [
5110
- "*",
5111
- 0
5112
- ],
5113
- [
5114
- "+",
5115
- 0
5116
- ],
5117
- [
5118
- "-",
5119
- 0
5120
- ],
5121
- [
5122
- "/",
5123
- 0
5124
- ],
5125
- [
5126
- "celcius",
5127
- 0
5128
- ],
5129
- [
5130
- "fahrenheit",
5131
- 0
5132
- ]
5133
- ],
5134
5126
  [
5135
5127
  [
5136
5128
  "celcius",
@@ -5376,54 +5368,6 @@
5376
5368
  "fragments": [],
5377
5369
  "semantics": [],
5378
5370
  "associations": [
5379
- [
5380
- [
5381
- "*",
5382
- 0
5383
- ],
5384
- [
5385
- "+",
5386
- 0
5387
- ],
5388
- [
5389
- "-",
5390
- 0
5391
- ],
5392
- [
5393
- "/",
5394
- 0
5395
- ],
5396
- [
5397
- "celcius",
5398
- 0
5399
- ],
5400
- [
5401
- "fahrenheit",
5402
- 0
5403
- ]
5404
- ],
5405
- [
5406
- [
5407
- "*",
5408
- 0
5409
- ],
5410
- [
5411
- "+",
5412
- 0
5413
- ],
5414
- [
5415
- "/",
5416
- 0
5417
- ],
5418
- [
5419
- "celcius",
5420
- 0
5421
- ],
5422
- [
5423
- "fahrenheit",
5424
- 0
5425
- ]
5426
- ],
5427
5371
  [
5428
5372
  [
5429
5373
  "a",
@@ -5884,36 +5828,6 @@
5884
5828
  1
5885
5829
  ]
5886
5830
  ],
5887
- [
5888
- [
5889
- "is",
5890
- 0
5891
- ],
5892
- [
5893
- "list",
5894
- 0
5895
- ],
5896
- [
5897
- "propertyOf",
5898
- 0
5899
- ],
5900
- [
5901
- "temperature",
5902
- 0
5903
- ],
5904
- [
5905
- "unit",
5906
- 0
5907
- ],
5908
- [
5909
- "unknown",
5910
- 0
5911
- ],
5912
- [
5913
- "unknown",
5914
- 1
5915
- ]
5916
- ],
5917
5831
  [
5918
5832
  [
5919
5833
  "is",
@@ -6053,16 +5967,6 @@
6053
5967
  "unknown",
6054
5968
  1
6055
5969
  ]
6056
- ],
6057
- [
6058
- [
6059
- "temperature",
6060
- 0
6061
- ],
6062
- [
6063
- "unknown",
6064
- 0
6065
- ]
6066
5970
  ]
6067
5971
  ],
6068
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) {