tpmkms_4wp 9.8.0 → 9.9.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.
- package/common/actions.instance.json +12 -10
- package/common/actions.js +14 -12
- package/common/angle.instance.json +37 -17
- package/common/animals.instance.json +54 -28
- package/common/askfor.instance.json +89 -192
- package/common/askfor.js +49 -12
- package/common/asking.js +13 -5
- package/common/avatar.js +3 -3
- package/common/can.instance.json +32 -20
- package/common/can.js +2 -2
- package/common/colors.instance.json +44 -16
- package/common/colors.js +1 -1
- package/common/comparable.instance.json +25 -22
- package/common/compass.instance.json +9 -3
- package/common/compass.js +1 -1
- package/common/concept.instance.json +14 -6
- package/common/concept.js +2 -0
- package/common/conjunction.js +20 -12
- package/common/control.js +10 -18
- package/common/countable.js +4 -3
- package/common/crew.instance.json +95 -27
- package/common/dateTimeSelectors.instance.json +4 -4
- package/common/dateTimeSelectors.js +4 -7
- package/common/dates.instance.json +52 -28
- package/common/dates.js +16 -11
- package/common/debug.instance.json +52 -0
- package/common/debug.js +52 -0
- package/common/debug.test.json +1 -0
- package/common/dialogues.js +126 -70
- package/common/dimension.instance.json +259 -492
- package/common/dimension.js +72 -12
- package/common/drone.instance.json +441 -84
- package/common/drone.js +57 -56
- package/common/drone_v1.instance.json +36 -12
- package/common/drone_v1.js +20 -15
- package/common/edible.instance.json +96 -32
- package/common/emotions.instance.json +15 -1
- package/common/evaluate.js +10 -13
- package/common/fastfood.instance.json +282 -100
- package/common/fastfood.js +30 -15
- package/common/formulas.instance.json +162 -24
- package/common/formulas.js +18 -9
- package/common/gdefaults.js +20 -96
- package/common/helpers/concept.js +2 -9
- package/common/helpers/conjunction.js +11 -1
- package/common/helpers/dialogues.js +48 -24
- package/common/helpers/gdefaults.js +15 -5
- package/common/helpers/properties.js +132 -326
- package/common/helpers.js +28 -58
- package/common/hierarchy.js +71 -41
- package/common/kirk.instance.json +3 -1
- package/common/latin.instance.json +14 -14
- package/common/latin.js +7 -7
- package/common/length.instance.json +331 -61
- package/common/linear_orderings.instance.json +1 -0
- package/common/linear_orderings.js +90 -0
- package/common/linear_orderings.test.json +1 -0
- package/common/math.instance.json +144 -5
- package/common/math.js +18 -7
- package/common/menus.instance.json +29 -11
- package/common/menus.js +8 -5
- package/common/meta.js +14 -13
- package/common/nameable.js +9 -5
- package/common/numbers.instance.json +8 -3
- package/common/numbers.js +59 -35
- package/common/ordering.instance.json +53 -4
- package/common/ordinals.js +25 -25
- package/common/people.instance.json +66 -12
- package/common/percentages.js +4 -2
- package/common/pipboy.instance.json +89 -44
- package/common/pipboy.js +21 -14
- package/common/pokemon.instance.json +39 -13
- package/common/pressure.instance.json +20 -6
- package/common/properties.instance.json +2648 -501
- package/common/properties.js +561 -82
- package/common/punctuation.js +1 -0
- package/common/rates.instance.json +2 -2
- package/common/rates.js +3 -3
- package/common/reminders.instance.json +16 -0
- package/common/reminders.js +24 -20
- package/common/reports.instance.json +11 -12
- package/common/reports.js +12 -12
- package/common/scorekeeper.js +20 -10
- package/common/sdefaults.js +30 -9
- package/common/spock.instance.json +3 -1
- package/common/stm.js +16 -21
- package/common/temperature.instance.json +40 -11
- package/common/testing.js +2 -2
- package/common/time.instance.json +149 -47
- package/common/time.js +9 -8
- package/common/ui.instance.json +4 -2
- package/common/ui.js +5 -5
- package/common/weight.instance.json +113 -21
- package/common/weight.js +5 -1
- package/common/words.js +113 -2
- package/common/wp.instance.json +125 -18
- package/common/wp.js +6 -2
- package/main.js +2 -0
- package/package.json +10 -3
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"configs": [
|
|
3
3
|
"troy modifies ounces",
|
|
4
|
+
{
|
|
5
|
+
"priorities": [
|
|
6
|
+
{
|
|
7
|
+
"context": [
|
|
8
|
+
[
|
|
9
|
+
"troy_ounce",
|
|
10
|
+
0
|
|
11
|
+
],
|
|
12
|
+
[
|
|
13
|
+
"mathematical_operator",
|
|
14
|
+
0
|
|
15
|
+
]
|
|
16
|
+
],
|
|
17
|
+
"generalize": true,
|
|
18
|
+
"choose": [
|
|
19
|
+
0
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
4
24
|
"weight is a dimension",
|
|
5
25
|
"kilograms grams pounds (troy ounces) ounces and tons are units of weight",
|
|
6
26
|
"ounces = 1.097 * troy ounces",
|
|
@@ -114,7 +134,6 @@
|
|
|
114
134
|
"level": 1,
|
|
115
135
|
"context_index": 1,
|
|
116
136
|
"topLevel": true,
|
|
117
|
-
"context_id": 2,
|
|
118
137
|
"touchedBy": [
|
|
119
138
|
"weight#call2"
|
|
120
139
|
]
|
|
@@ -260,11 +279,35 @@
|
|
|
260
279
|
}
|
|
261
280
|
],
|
|
262
281
|
"learned_contextual_priorities": [],
|
|
282
|
+
"explain_associations_details": [
|
|
283
|
+
null
|
|
284
|
+
],
|
|
263
285
|
"query": "troy modifies ounces",
|
|
264
286
|
"key": {
|
|
265
287
|
"query": "troy modifies ounces"
|
|
266
288
|
}
|
|
267
289
|
},
|
|
290
|
+
{
|
|
291
|
+
"extraConfig": true,
|
|
292
|
+
"priorities": [
|
|
293
|
+
{
|
|
294
|
+
"context": [
|
|
295
|
+
[
|
|
296
|
+
"troy_ounce",
|
|
297
|
+
0
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
"mathematical_operator",
|
|
301
|
+
0
|
|
302
|
+
]
|
|
303
|
+
],
|
|
304
|
+
"generalize": true,
|
|
305
|
+
"choose": [
|
|
306
|
+
0
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
},
|
|
268
311
|
{
|
|
269
312
|
"metadata": {
|
|
270
313
|
"opChoices": [
|
|
@@ -399,7 +442,6 @@
|
|
|
399
442
|
"level": 2,
|
|
400
443
|
"context_index": 1,
|
|
401
444
|
"topLevel": true,
|
|
402
|
-
"context_id": 2,
|
|
403
445
|
"touchedBy": [
|
|
404
446
|
"weight#call2"
|
|
405
447
|
]
|
|
@@ -580,6 +622,9 @@
|
|
|
580
622
|
}
|
|
581
623
|
],
|
|
582
624
|
"learned_contextual_priorities": [],
|
|
625
|
+
"explain_associations_details": [
|
|
626
|
+
null
|
|
627
|
+
],
|
|
583
628
|
"query": "weight is a dimension",
|
|
584
629
|
"key": {
|
|
585
630
|
"query": "weight is a dimension"
|
|
@@ -1264,7 +1309,6 @@
|
|
|
1264
1309
|
"level": 2,
|
|
1265
1310
|
"context_index": 1,
|
|
1266
1311
|
"topLevel": true,
|
|
1267
|
-
"context_id": 2,
|
|
1268
1312
|
"touchedBy": [
|
|
1269
1313
|
"weight#call2"
|
|
1270
1314
|
]
|
|
@@ -2935,6 +2979,9 @@
|
|
|
2935
2979
|
}
|
|
2936
2980
|
],
|
|
2937
2981
|
"learned_contextual_priorities": [],
|
|
2982
|
+
"explain_associations_details": [
|
|
2983
|
+
null
|
|
2984
|
+
],
|
|
2938
2985
|
"query": "kilograms grams pounds (troy ounces) ounces and tons are units of weight",
|
|
2939
2986
|
"key": {
|
|
2940
2987
|
"query": "kilograms grams pounds (troy ounces) ounces and tons are units of weight"
|
|
@@ -3096,7 +3143,10 @@
|
|
|
3096
3143
|
],
|
|
3097
3144
|
"x": {
|
|
3098
3145
|
"value": 1.097,
|
|
3099
|
-
"
|
|
3146
|
+
"isInstance": true,
|
|
3147
|
+
"rangeableWith": [
|
|
3148
|
+
"number"
|
|
3149
|
+
],
|
|
3100
3150
|
"text": "1.097",
|
|
3101
3151
|
"marker": "number",
|
|
3102
3152
|
"word": "1.097",
|
|
@@ -3168,7 +3218,6 @@
|
|
|
3168
3218
|
"level": 1,
|
|
3169
3219
|
"context_index": 1,
|
|
3170
3220
|
"topLevel": true,
|
|
3171
|
-
"context_id": 2,
|
|
3172
3221
|
"touchedBy": [
|
|
3173
3222
|
"weight#call2"
|
|
3174
3223
|
]
|
|
@@ -3419,6 +3468,9 @@
|
|
|
3419
3468
|
}
|
|
3420
3469
|
],
|
|
3421
3470
|
"learned_contextual_priorities": [],
|
|
3471
|
+
"explain_associations_details": [
|
|
3472
|
+
null
|
|
3473
|
+
],
|
|
3422
3474
|
"query": "ounces = 1.097 * troy ounces",
|
|
3423
3475
|
"key": {
|
|
3424
3476
|
"query": "ounces = 1.097 * troy ounces"
|
|
@@ -3620,7 +3672,10 @@
|
|
|
3620
3672
|
},
|
|
3621
3673
|
"y": {
|
|
3622
3674
|
"value": 1.097,
|
|
3623
|
-
"
|
|
3675
|
+
"isInstance": true,
|
|
3676
|
+
"rangeableWith": [
|
|
3677
|
+
"number"
|
|
3678
|
+
],
|
|
3624
3679
|
"text": "1.097",
|
|
3625
3680
|
"marker": "number",
|
|
3626
3681
|
"word": "1.097",
|
|
@@ -3652,7 +3707,6 @@
|
|
|
3652
3707
|
"level": 1,
|
|
3653
3708
|
"context_index": 1,
|
|
3654
3709
|
"topLevel": true,
|
|
3655
|
-
"context_id": 2,
|
|
3656
3710
|
"touchedBy": [
|
|
3657
3711
|
"weight#call2"
|
|
3658
3712
|
]
|
|
@@ -3903,6 +3957,9 @@
|
|
|
3903
3957
|
}
|
|
3904
3958
|
],
|
|
3905
3959
|
"learned_contextual_priorities": [],
|
|
3960
|
+
"explain_associations_details": [
|
|
3961
|
+
null
|
|
3962
|
+
],
|
|
3906
3963
|
"query": "troy ounces = ounces / 1.097",
|
|
3907
3964
|
"key": {
|
|
3908
3965
|
"query": "troy ounces = ounces / 1.097"
|
|
@@ -4077,7 +4134,10 @@
|
|
|
4077
4134
|
},
|
|
4078
4135
|
"y": {
|
|
4079
4136
|
"value": 0.453592,
|
|
4080
|
-
"
|
|
4137
|
+
"isInstance": true,
|
|
4138
|
+
"rangeableWith": [
|
|
4139
|
+
"number"
|
|
4140
|
+
],
|
|
4081
4141
|
"text": "0.453592",
|
|
4082
4142
|
"marker": "number",
|
|
4083
4143
|
"word": "0.453592",
|
|
@@ -4109,7 +4169,6 @@
|
|
|
4109
4169
|
"level": 1,
|
|
4110
4170
|
"context_index": 1,
|
|
4111
4171
|
"topLevel": true,
|
|
4112
|
-
"context_id": 2,
|
|
4113
4172
|
"touchedBy": [
|
|
4114
4173
|
"weight#call2"
|
|
4115
4174
|
]
|
|
@@ -4350,6 +4409,9 @@
|
|
|
4350
4409
|
}
|
|
4351
4410
|
],
|
|
4352
4411
|
"learned_contextual_priorities": [],
|
|
4412
|
+
"explain_associations_details": [
|
|
4413
|
+
null
|
|
4414
|
+
],
|
|
4353
4415
|
"query": "kilograms = pounds * 0.453592",
|
|
4354
4416
|
"key": {
|
|
4355
4417
|
"query": "kilograms = pounds * 0.453592"
|
|
@@ -4524,7 +4586,10 @@
|
|
|
4524
4586
|
},
|
|
4525
4587
|
"y": {
|
|
4526
4588
|
"value": 1000,
|
|
4527
|
-
"
|
|
4589
|
+
"isInstance": true,
|
|
4590
|
+
"rangeableWith": [
|
|
4591
|
+
"number"
|
|
4592
|
+
],
|
|
4528
4593
|
"text": "1000",
|
|
4529
4594
|
"marker": "integer",
|
|
4530
4595
|
"word": "1000",
|
|
@@ -4556,7 +4621,6 @@
|
|
|
4556
4621
|
"level": 1,
|
|
4557
4622
|
"context_index": 1,
|
|
4558
4623
|
"topLevel": true,
|
|
4559
|
-
"context_id": 2,
|
|
4560
4624
|
"touchedBy": [
|
|
4561
4625
|
"weight#call2"
|
|
4562
4626
|
]
|
|
@@ -4797,6 +4861,9 @@
|
|
|
4797
4861
|
}
|
|
4798
4862
|
],
|
|
4799
4863
|
"learned_contextual_priorities": [],
|
|
4864
|
+
"explain_associations_details": [
|
|
4865
|
+
null
|
|
4866
|
+
],
|
|
4800
4867
|
"query": "grams = kilograms * 1000",
|
|
4801
4868
|
"key": {
|
|
4802
4869
|
"query": "grams = kilograms * 1000"
|
|
@@ -4971,7 +5038,10 @@
|
|
|
4971
5038
|
},
|
|
4972
5039
|
"y": {
|
|
4973
5040
|
"value": 1000,
|
|
4974
|
-
"
|
|
5041
|
+
"isInstance": true,
|
|
5042
|
+
"rangeableWith": [
|
|
5043
|
+
"number"
|
|
5044
|
+
],
|
|
4975
5045
|
"text": "1000",
|
|
4976
5046
|
"marker": "integer",
|
|
4977
5047
|
"word": "1000",
|
|
@@ -5003,7 +5073,6 @@
|
|
|
5003
5073
|
"level": 1,
|
|
5004
5074
|
"context_index": 1,
|
|
5005
5075
|
"topLevel": true,
|
|
5006
|
-
"context_id": 2,
|
|
5007
5076
|
"touchedBy": [
|
|
5008
5077
|
"weight#call2"
|
|
5009
5078
|
]
|
|
@@ -5244,6 +5313,9 @@
|
|
|
5244
5313
|
}
|
|
5245
5314
|
],
|
|
5246
5315
|
"learned_contextual_priorities": [],
|
|
5316
|
+
"explain_associations_details": [
|
|
5317
|
+
null
|
|
5318
|
+
],
|
|
5247
5319
|
"query": "kilograms = grams / 1000",
|
|
5248
5320
|
"key": {
|
|
5249
5321
|
"query": "kilograms = grams / 1000"
|
|
@@ -5418,7 +5490,10 @@
|
|
|
5418
5490
|
},
|
|
5419
5491
|
"y": {
|
|
5420
5492
|
"value": 2.20462,
|
|
5421
|
-
"
|
|
5493
|
+
"isInstance": true,
|
|
5494
|
+
"rangeableWith": [
|
|
5495
|
+
"number"
|
|
5496
|
+
],
|
|
5422
5497
|
"text": "2.20462",
|
|
5423
5498
|
"marker": "number",
|
|
5424
5499
|
"word": "2.20462",
|
|
@@ -5450,7 +5525,6 @@
|
|
|
5450
5525
|
"level": 1,
|
|
5451
5526
|
"context_index": 1,
|
|
5452
5527
|
"topLevel": true,
|
|
5453
|
-
"context_id": 2,
|
|
5454
5528
|
"touchedBy": [
|
|
5455
5529
|
"weight#call2"
|
|
5456
5530
|
]
|
|
@@ -5691,6 +5765,9 @@
|
|
|
5691
5765
|
}
|
|
5692
5766
|
],
|
|
5693
5767
|
"learned_contextual_priorities": [],
|
|
5768
|
+
"explain_associations_details": [
|
|
5769
|
+
null
|
|
5770
|
+
],
|
|
5694
5771
|
"query": "pounds = kilograms * 2.20462",
|
|
5695
5772
|
"key": {
|
|
5696
5773
|
"query": "pounds = kilograms * 2.20462"
|
|
@@ -5865,7 +5942,10 @@
|
|
|
5865
5942
|
},
|
|
5866
5943
|
"y": {
|
|
5867
5944
|
"value": 16,
|
|
5868
|
-
"
|
|
5945
|
+
"isInstance": true,
|
|
5946
|
+
"rangeableWith": [
|
|
5947
|
+
"number"
|
|
5948
|
+
],
|
|
5869
5949
|
"text": "16",
|
|
5870
5950
|
"marker": "integer",
|
|
5871
5951
|
"word": "16",
|
|
@@ -5897,7 +5977,6 @@
|
|
|
5897
5977
|
"level": 1,
|
|
5898
5978
|
"context_index": 1,
|
|
5899
5979
|
"topLevel": true,
|
|
5900
|
-
"context_id": 2,
|
|
5901
5980
|
"touchedBy": [
|
|
5902
5981
|
"weight#call2"
|
|
5903
5982
|
]
|
|
@@ -6138,6 +6217,9 @@
|
|
|
6138
6217
|
}
|
|
6139
6218
|
],
|
|
6140
6219
|
"learned_contextual_priorities": [],
|
|
6220
|
+
"explain_associations_details": [
|
|
6221
|
+
null
|
|
6222
|
+
],
|
|
6141
6223
|
"query": "ounces = pounds * 16",
|
|
6142
6224
|
"key": {
|
|
6143
6225
|
"query": "ounces = pounds * 16"
|
|
@@ -6312,7 +6394,10 @@
|
|
|
6312
6394
|
},
|
|
6313
6395
|
"y": {
|
|
6314
6396
|
"value": 0.907185,
|
|
6315
|
-
"
|
|
6397
|
+
"isInstance": true,
|
|
6398
|
+
"rangeableWith": [
|
|
6399
|
+
"number"
|
|
6400
|
+
],
|
|
6316
6401
|
"text": "0.907185",
|
|
6317
6402
|
"marker": "number",
|
|
6318
6403
|
"word": "0.907185",
|
|
@@ -6344,7 +6429,6 @@
|
|
|
6344
6429
|
"level": 1,
|
|
6345
6430
|
"context_index": 1,
|
|
6346
6431
|
"topLevel": true,
|
|
6347
|
-
"context_id": 2,
|
|
6348
6432
|
"touchedBy": [
|
|
6349
6433
|
"weight#call2"
|
|
6350
6434
|
]
|
|
@@ -6585,6 +6669,9 @@
|
|
|
6585
6669
|
}
|
|
6586
6670
|
],
|
|
6587
6671
|
"learned_contextual_priorities": [],
|
|
6672
|
+
"explain_associations_details": [
|
|
6673
|
+
null
|
|
6674
|
+
],
|
|
6588
6675
|
"query": "ton = tonne * 0.907185",
|
|
6589
6676
|
"key": {
|
|
6590
6677
|
"query": "ton = tonne * 0.907185"
|
|
@@ -6759,7 +6846,10 @@
|
|
|
6759
6846
|
},
|
|
6760
6847
|
"y": {
|
|
6761
6848
|
"value": 2000,
|
|
6762
|
-
"
|
|
6849
|
+
"isInstance": true,
|
|
6850
|
+
"rangeableWith": [
|
|
6851
|
+
"number"
|
|
6852
|
+
],
|
|
6763
6853
|
"text": "2000",
|
|
6764
6854
|
"marker": "integer",
|
|
6765
6855
|
"word": "2000",
|
|
@@ -6791,7 +6881,6 @@
|
|
|
6791
6881
|
"level": 1,
|
|
6792
6882
|
"context_index": 1,
|
|
6793
6883
|
"topLevel": true,
|
|
6794
|
-
"context_id": 2,
|
|
6795
6884
|
"touchedBy": [
|
|
6796
6885
|
"weight#call2"
|
|
6797
6886
|
]
|
|
@@ -7032,6 +7121,9 @@
|
|
|
7032
7121
|
}
|
|
7033
7122
|
],
|
|
7034
7123
|
"learned_contextual_priorities": [],
|
|
7124
|
+
"explain_associations_details": [
|
|
7125
|
+
null
|
|
7126
|
+
],
|
|
7035
7127
|
"query": "pounds = ton * 2000",
|
|
7036
7128
|
"key": {
|
|
7037
7129
|
"query": "pounds = ton * 2000"
|
package/common/weight.js
CHANGED
|
@@ -18,10 +18,14 @@ const instance = require('./weight.instance.json')
|
|
|
18
18
|
const template = {
|
|
19
19
|
configs: [
|
|
20
20
|
"troy modifies ounces",
|
|
21
|
+
{
|
|
22
|
+
priorities: [
|
|
23
|
+
{ context: [["troy_ounce",0],["mathematical_operator",0]], generalize: true, choose: [0] },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
21
26
|
"weight is a dimension",
|
|
22
27
|
// "kilograms grams pounds ounces and tons are units of weight",
|
|
23
28
|
"kilograms grams pounds (troy ounces) ounces and tons are units of weight",
|
|
24
|
-
// { stop: true },
|
|
25
29
|
"ounces = 1.097 * troy ounces",
|
|
26
30
|
"troy ounces = ounces / 1.097",
|
|
27
31
|
"kilograms = pounds * 0.453592",
|
package/common/words.js
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
|
+
const pluralize = require('pluralize')
|
|
1
2
|
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
3
|
const { defaultContextCheck } = require('./helpers')
|
|
3
4
|
const words_tests = require('./words.test.json')
|
|
4
5
|
const instance = require('./words.instance.json')
|
|
5
6
|
const tokenize = require('./tokenize')
|
|
7
|
+
const englishHelpers = require('./english_helpers.js')
|
|
8
|
+
|
|
9
|
+
class API {
|
|
10
|
+
initialize({ objects }) {
|
|
11
|
+
this._objects = objects
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
toPlural(context) {
|
|
15
|
+
return this._objects.plural[context.word] || pluralize.plural(context.word)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
|
|
7
19
|
function initializer({objects, config, isModule}) {
|
|
8
20
|
objects.words = []
|
|
21
|
+
objects.singular = {}
|
|
22
|
+
objects.plural = {
|
|
23
|
+
'who': 'who',
|
|
24
|
+
'fahrenheit': 'fahrenheit',
|
|
25
|
+
'celcius': 'celcius',
|
|
26
|
+
}
|
|
9
27
|
config.addArgs((args) => ({
|
|
10
28
|
getWordFromDictionary: (partial) => {
|
|
11
29
|
for (const word of objects.words) {
|
|
12
30
|
let matches = true
|
|
13
31
|
for (const key in partial) {
|
|
32
|
+
if (key == 'context_id') {
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
14
35
|
if (partial[key] !== word[key]) {
|
|
15
36
|
matches = false
|
|
16
37
|
}
|
|
@@ -20,23 +41,113 @@ function initializer({objects, config, isModule}) {
|
|
|
20
41
|
}
|
|
21
42
|
}
|
|
22
43
|
},
|
|
44
|
+
|
|
45
|
+
// number/gender/person etc
|
|
46
|
+
|
|
47
|
+
gw: (context, { number: numberContext } = {}) => {
|
|
48
|
+
const number = numberContext ? args.number(numberContext) : context.number;
|
|
49
|
+
return args.gp( { ...context, evaluateWord: true, number } )
|
|
50
|
+
},
|
|
51
|
+
|
|
23
52
|
addWordToDictionary: (context) => {
|
|
24
53
|
if (context.word) {
|
|
25
|
-
|
|
54
|
+
const word = { ...context }
|
|
55
|
+
delete word.range
|
|
56
|
+
objects.words = objects.words.filter((c) => JSON.stringify(c) !== JSON.stringify(word))
|
|
57
|
+
objects.words.push(word)
|
|
26
58
|
}
|
|
27
59
|
}
|
|
28
60
|
}))
|
|
29
61
|
}
|
|
30
62
|
|
|
63
|
+
const config = {
|
|
64
|
+
name: 'words',
|
|
65
|
+
operators: [
|
|
66
|
+
"([plural])",
|
|
67
|
+
"([singular])",
|
|
68
|
+
],
|
|
69
|
+
bridges: [
|
|
70
|
+
{ id: 'plural' },
|
|
71
|
+
{ id: 'singular' },
|
|
72
|
+
],
|
|
73
|
+
generators: [
|
|
74
|
+
{
|
|
75
|
+
where: where(),
|
|
76
|
+
priority: -1,
|
|
77
|
+
match: ({context}) => context.marker == 'modifies' && context.evaluateWord && context.paraphrase && context.number == 'one',
|
|
78
|
+
apply: ({context}) => 'modifies'
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
where: where(),
|
|
83
|
+
priority: -1,
|
|
84
|
+
match: ({context}) => context.marker == 'modifies' && context.evaluateWord && context.paraphrase && (context.number == 'many' || context.number > 1),
|
|
85
|
+
apply: ({context}) => 'modify'
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
where: where(),
|
|
90
|
+
priority: -1,
|
|
91
|
+
match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && !context.imperative && !context.interpolate,
|
|
92
|
+
apply: ({context}) => {
|
|
93
|
+
const infinitive = englishHelpers.getInfinitive(context.word)
|
|
94
|
+
if (context.form == 'infinitive') {
|
|
95
|
+
const cases = englishHelpers.conjugateVerb(infinitive)
|
|
96
|
+
const def = cases.find((def) => def.form == context.form)
|
|
97
|
+
return def.word
|
|
98
|
+
} else if (context.tense) {
|
|
99
|
+
const cases = englishHelpers.conjugateVerb(infinitive)
|
|
100
|
+
const def = cases.find((def) => def.tense == context.tense)
|
|
101
|
+
return def.word
|
|
102
|
+
} else {
|
|
103
|
+
return pluralize.plural(context.word)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
{
|
|
109
|
+
where: where(),
|
|
110
|
+
priority: -1,
|
|
111
|
+
match: ({context}) => context.evaluateWord && context.paraphrase && context.word && (context.number == 'many' || context.number > 1) && !context.interpolate,
|
|
112
|
+
apply: ({context, objects}) => {
|
|
113
|
+
const override = objects.plural[context.word]
|
|
114
|
+
return override || pluralize.plural(context.word)
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
{
|
|
119
|
+
where: where(),
|
|
120
|
+
priority: -1,
|
|
121
|
+
match: ({context}) => context.evaluateWord && context.isVerb && context.paraphrase && context.word && context.number == 'one' && !context.imperative && !context.interpolate,
|
|
122
|
+
apply: ({context}) => {
|
|
123
|
+
const infinitive = englishHelpers.getInfinitive(context.word)
|
|
124
|
+
const cases = englishHelpers.conjugateVerb(infinitive)
|
|
125
|
+
return pluralize.plural(context.word)
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
{
|
|
130
|
+
where: where(),
|
|
131
|
+
priority: -1,
|
|
132
|
+
match: ({context}) => context.evaluateWord && context.paraphrase && context.word && context.number == 'one' && !context.interpolate,
|
|
133
|
+
apply: ({context, objects}) => {
|
|
134
|
+
const override = objects.singular[context.word]
|
|
135
|
+
return override || pluralize.singular(context.word)
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
}
|
|
140
|
+
|
|
31
141
|
const template = {
|
|
32
142
|
configs: [],
|
|
33
143
|
fragments: [],
|
|
34
144
|
}
|
|
35
145
|
|
|
36
146
|
knowledgeModule( {
|
|
37
|
-
config
|
|
147
|
+
config,
|
|
38
148
|
includes: [tokenize],
|
|
39
149
|
initializer,
|
|
150
|
+
api: () => new API(),
|
|
40
151
|
|
|
41
152
|
module,
|
|
42
153
|
description: 'talking about words',
|