tpmkms_4wp 8.0.0-beta.7 → 8.0.0-beta.70
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 +2871 -1379
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/avatar.js +5 -9
- package/common/characters.js +22 -28
- package/common/colors.instance.json +7170 -3657
- package/common/colors.js +4 -8
- package/common/colors.test.json +345 -780
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +438 -2
- package/common/concept.js +120 -118
- package/common/countable.js +19 -13
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +13066 -6469
- package/common/crew.js +36 -41
- package/common/crew.test.json +714 -452
- package/common/currency.js +27 -45
- package/common/dialogues.js +161 -285
- package/common/dimension.instance.json +474 -253
- package/common/dimension.js +16 -22
- package/common/dimension.test.json +446 -1640
- package/common/edible.instance.json +20053 -10093
- package/common/edible.js +3 -8
- package/common/emotions.instance.json +147 -69
- package/common/emotions.js +35 -38
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +49 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +10 -14
- package/common/fastfood.instance.json +221166 -111223
- package/common/fastfood.js +75 -85
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +455 -249
- package/common/formulas.js +19 -26
- package/common/gdefaults.js +24 -26
- package/common/help.js +7 -12
- package/common/help.test.json +63 -8
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +54 -62
- package/common/helpers.js +6 -5
- package/common/hierarchy.js +16 -24
- package/common/javascript.js +11 -18
- package/common/kirk.instance.json +584 -290
- package/common/kirk.js +5 -8
- package/common/length.instance.json +8834 -4757
- package/common/length.js +4 -8
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +425 -1187
- package/common/math.js +16 -20
- package/common/meta.js +23 -47
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/numbers.js +27 -31
- package/common/ordering.instance.json +366 -246
- package/common/ordering.js +80 -86
- package/common/people.instance.json +2074 -1022
- package/common/people.js +8 -13
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +53 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +11745 -6329
- package/common/pipboy.js +48 -59
- package/common/pokemon.instance.json +4226 -2081
- package/common/pokemon.js +7 -20
- package/common/pos.js +15 -13
- package/common/pressure.instance.json +2208 -1175
- package/common/pressure.js +4 -8
- package/common/properties.instance.json +131 -61
- package/common/properties.js +57 -134
- package/common/punctuation.js +15 -7
- package/common/reports.instance.json +1018 -530
- package/common/reports.js +77 -100
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +18 -30
- package/common/sdefaults.js +16 -7
- package/common/sizeable.js +6 -10
- package/common/spock.instance.json +584 -290
- package/common/spock.js +5 -8
- package/common/stgame.js +19 -19
- package/common/stm.js +164 -27
- package/common/stm.test.json +1734 -1
- package/common/tell.js +14 -18
- package/common/temperature.instance.json +2271 -1222
- package/common/temperature.js +4 -8
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +20 -25
- package/common/tokenize.js +5 -6
- package/common/ui.instance.json +459 -240
- package/common/ui.js +16 -22
- package/common/weight.instance.json +7646 -4026
- package/common/weight.js +4 -8
- package/common/yesno.js +5 -5
- package/main.js +14 -2
- package/package.json +28 -5
package/common/properties.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const dialogues = require('./dialogues')
|
4
4
|
const meta = require('./meta')
|
@@ -79,7 +79,7 @@ const template = {
|
|
79
79
|
|
80
80
|
const api = new API();
|
81
81
|
|
82
|
-
let
|
82
|
+
let config = {
|
83
83
|
name: 'properties',
|
84
84
|
operators: [
|
85
85
|
"([hierarchyAble|])",
|
@@ -221,7 +221,7 @@ let configStruct = {
|
|
221
221
|
notes: 'expression with constraints',
|
222
222
|
where: where(),
|
223
223
|
match: ({context}) => context.constraints && context.paraphrase,
|
224
|
-
apply: ({context, g}) => {
|
224
|
+
apply: async ({context, g}) => {
|
225
225
|
// TODO assume one constaints deal with more in the future
|
226
226
|
const constraint = context.constraints[0]
|
227
227
|
const constrained = Object.assign({}, constraint.constraint)
|
@@ -234,86 +234,25 @@ let configStruct = {
|
|
234
234
|
paraphrase.paraphrase = true;
|
235
235
|
paraphrase[constraint.property] = property
|
236
236
|
if (false && context.isResponse) {
|
237
|
-
return g({...constraint.paraphrase, paraphrase: true})
|
237
|
+
return await g({...constraint.paraphrase, paraphrase: true})
|
238
238
|
} else {
|
239
|
-
return g(constrained)
|
239
|
+
return await g(constrained)
|
240
240
|
}
|
241
241
|
},
|
242
242
|
},
|
243
243
|
{
|
244
244
|
where: where(),
|
245
245
|
match: ({context}) => context.marker == 'xfx',
|
246
|
-
apply: ({context, g}) => `${context.word} between ${g(context.arguments)}`
|
246
|
+
apply: async ({context, g}) => `${context.word} between ${await g(context.arguments)}`
|
247
247
|
},
|
248
|
-
// {
|
249
|
-
// notes: '"fire type, water type and earth type" to "fire water and earth type"',
|
250
|
-
// tests: [
|
251
|
-
// 'chicken modifies strips',
|
252
|
-
// ],
|
253
|
-
// /*
|
254
|
-
// {
|
255
|
-
// "water": {
|
256
|
-
// "marker": "water",
|
257
|
-
// "value": "water",
|
258
|
-
// "word": "water"
|
259
|
-
// },
|
260
|
-
// "marker": "water_type",
|
261
|
-
// "modifiers": [
|
262
|
-
// "water"
|
263
|
-
// ],
|
264
|
-
// "types": [
|
265
|
-
// "water_type"
|
266
|
-
// ],
|
267
|
-
// "value": "water_type",
|
268
|
-
// "word": "type",
|
269
|
-
// "paraphrase": true
|
270
|
-
// },
|
271
|
-
// */
|
272
|
-
// where: where(),
|
273
|
-
// match: ({context}) => {
|
274
|
-
// if (!context.paraphrase) {
|
275
|
-
// return
|
276
|
-
// }
|
277
|
-
// if (context.marker !== 'list') {
|
278
|
-
// return
|
279
|
-
// }
|
280
|
-
// if ((context.value || []).length < 2) {
|
281
|
-
// return
|
282
|
-
// }
|
283
|
-
// if (!context.value[0].word) {
|
284
|
-
// return
|
285
|
-
// }
|
286
|
-
// const word = context.value[0].word
|
287
|
-
|
288
|
-
// for (let value of context.value) {
|
289
|
-
// if (!(value.modifiers && value.modifiers.length == 1 && value.word == word)) {
|
290
|
-
// return
|
291
|
-
// }
|
292
|
-
// }
|
293
|
-
// return true
|
294
|
-
// },
|
295
|
-
// apply: ({g, context}) => {
|
296
|
-
// const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
|
297
|
-
// context.word = context.value[0].word
|
298
|
-
// context.value = null
|
299
|
-
// context.modifiers = ['modifier']
|
300
|
-
// context.modifier = {
|
301
|
-
// marker: 'list',
|
302
|
-
// paraphrase: true,
|
303
|
-
// value: modifiers
|
304
|
-
// }
|
305
|
-
// context.paraphrase = true
|
306
|
-
// return g(context)
|
307
|
-
// }
|
308
|
-
// },
|
309
248
|
{
|
310
249
|
notes: 'add possession ending',
|
311
250
|
priority: -1,
|
312
251
|
where: where(),
|
313
252
|
match: ({context}) => context.paraphrase && context.possessive,
|
314
|
-
apply: ({context, g}) => {
|
253
|
+
apply: async ({context, g}) => {
|
315
254
|
context.possessive = false
|
316
|
-
const phrase = g(context)
|
255
|
+
const phrase = await g(context)
|
317
256
|
context.possessive = true
|
318
257
|
if (phrase.endsWith('s')) {
|
319
258
|
return `${phrase}'`
|
@@ -322,13 +261,6 @@ let configStruct = {
|
|
322
261
|
}
|
323
262
|
}
|
324
263
|
},
|
325
|
-
/*
|
326
|
-
{
|
327
|
-
where: where(),
|
328
|
-
match: ({context}) => context.marker == 'modifies' && context.paraphrase,
|
329
|
-
apply: ({context}) => `${context.modifier.word} modifies ${context.concept.word}`,
|
330
|
-
},
|
331
|
-
*/
|
332
264
|
{
|
333
265
|
where: where(),
|
334
266
|
match: ({context}) => context.marker == 'objectPrefix' && context.value == 'other' && context.paraphrase,
|
@@ -353,15 +285,8 @@ let configStruct = {
|
|
353
285
|
notes: 'negative do questions',
|
354
286
|
where: where(),
|
355
287
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'canBeDoQuestion') && context.paraphrase && context.negation,
|
356
|
-
apply: ({context, g}) => {
|
357
|
-
|
358
|
-
let query = ''
|
359
|
-
if (context.query) {
|
360
|
-
query = "?"
|
361
|
-
}
|
362
|
-
return `${g(context.object)} ${context.word} ${g(context.property)}${query}`
|
363
|
-
*/
|
364
|
-
return `${g(context[context.do.left])} doesnt ${pluralize.plural(context.word)} ${g(context[context.do.right])}`
|
288
|
+
apply: async ({context, g}) => {
|
289
|
+
return `${await g(context[context.do.left])} doesnt ${pluralize.plural(context.word)} ${await g(context[context.do.right])}`
|
365
290
|
},
|
366
291
|
},
|
367
292
|
{
|
@@ -369,23 +294,22 @@ let configStruct = {
|
|
369
294
|
// debug: 'call9',
|
370
295
|
where: where(),
|
371
296
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'canBeDoQuestion') && context.paraphrase && context.query && context.do,
|
372
|
-
apply: ({context, g}) => {
|
297
|
+
apply: async ({context, g}) => {
|
373
298
|
const right = context['do'].right
|
374
299
|
if (context[right].query) {
|
375
300
|
const left = context['do'].left
|
376
|
-
return `${g(context[right])} ${chooseNumber(context[right], "does", "do")} ${g(context[left])} ${context.word}`
|
301
|
+
return `${await g(context[right])} ${chooseNumber(context[right], "does", "do")} ${await g(context[left])} ${context.word}`
|
377
302
|
} else {
|
378
|
-
// return `does ${g(context[context.do.left])} ${pluralize.singular(context.word)} ${g(context[context.do.right])}`
|
379
303
|
// the marker is the infinite form
|
380
|
-
return `${chooseNumber(context[context.do.left], "does", "do")} ${g(context[context.do.left])} ${context.marker} ${g(context[context.do.right])}`
|
304
|
+
return `${chooseNumber(context[context.do.left], "does", "do")} ${await g(context[context.do.left])} ${context.marker} ${await g(context[context.do.right])}`
|
381
305
|
}
|
382
306
|
},
|
383
307
|
},
|
384
308
|
{
|
385
309
|
where: where(),
|
386
310
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'canBeDoQuestion') && context.paraphrase && !context.query,
|
387
|
-
apply: ({context, g}) => {
|
388
|
-
return `${g(context.object)} ${context.word} ${g(context.property)}`
|
311
|
+
apply: async ({context, g}) => {
|
312
|
+
return `${await g(context.object)} ${context.word} ${await g(context.property)}`
|
389
313
|
}
|
390
314
|
},
|
391
315
|
{
|
@@ -393,17 +317,21 @@ let configStruct = {
|
|
393
317
|
where: where(),
|
394
318
|
// match: ({context}) => context.paraphrase && context.modifiers && context.object,
|
395
319
|
match: ({context}) => context.paraphrase && !context.possession && context.object,
|
396
|
-
apply: ({context, g, gs}) => {
|
320
|
+
apply: async ({context, g, gs}) => {
|
397
321
|
const base = { ...context }
|
398
322
|
base.object = undefined;
|
399
323
|
if (context.object.marker == 'objectPrefix') {
|
400
|
-
return `${g(context.object)} ${g(base)}`
|
324
|
+
return `${await g(context.object)} ${await g(base)}`
|
401
325
|
} else {
|
402
326
|
if (context.objects) {
|
403
|
-
|
327
|
+
const gObjects = []
|
328
|
+
for (const object of context.objects) {
|
329
|
+
gObjects.push(await g({...object, paraphrase: true}))
|
330
|
+
}
|
331
|
+
return await gs(gObjects, ' of ')
|
404
332
|
} else {
|
405
333
|
// TODO make paraphrase be a default when paraphrasing?
|
406
|
-
return `${g(base)} of ${g({...context.object, paraphrase: true})}`
|
334
|
+
return `${await g(base)} of ${await g({...context.object, paraphrase: true})}`
|
407
335
|
}
|
408
336
|
}
|
409
337
|
},
|
@@ -412,9 +340,9 @@ let configStruct = {
|
|
412
340
|
// ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.value && !context.evaluate,
|
413
341
|
where: where(),
|
414
342
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.object && !context.possession && !context.evaluate && !context.object.marker == 'objectPrefix',
|
415
|
-
apply: ({context, g}) => {
|
343
|
+
apply: async ({context, g}) => {
|
416
344
|
const property = Object.assign({}, context, { object: undefined })
|
417
|
-
return `${g(property)} of ${g({ ...context.object, paraphrase: true })}`
|
345
|
+
return `${await g(property)} of ${await g({ ...context.object, paraphrase: true })}`
|
418
346
|
}
|
419
347
|
},
|
420
348
|
{
|
@@ -422,25 +350,25 @@ let configStruct = {
|
|
422
350
|
where: where(),
|
423
351
|
// match: ({context}) => context.paraphrase && !context.modifiers && context.object,
|
424
352
|
match: ({context}) => !context.modifiers && context.object,
|
425
|
-
apply: ({context, g, gs}) => {
|
353
|
+
apply: async ({context, g, gs}) => {
|
426
354
|
if (context.objects) {
|
427
355
|
const objects = [ ...context.objects ]
|
428
356
|
objects.reverse()
|
429
357
|
let phrase = ''
|
430
358
|
let separator = ''
|
431
359
|
for (let i = 0; i < objects.length-1; ++i) {
|
432
|
-
phrase = phrase + separator + g({...objects[i], paraphrase: context.paraphrase, possessive: true})
|
360
|
+
phrase = phrase + separator + await g({...objects[i], paraphrase: context.paraphrase, possessive: true})
|
433
361
|
separator = ' '
|
434
362
|
}
|
435
|
-
phrase = phrase + separator + g({...objects[objects.length-1], paraphrase: context.paraphrase})
|
363
|
+
phrase = phrase + separator + await g({...objects[objects.length-1], paraphrase: context.paraphrase})
|
436
364
|
return phrase
|
437
365
|
} else {
|
438
366
|
const base = { ...context }
|
439
367
|
base.object = undefined; // TODO make paraphrase be a default when paraphrasing?
|
440
368
|
if (context.object.marker == 'objectPrefix') {
|
441
|
-
return `${g(context.object)} ${g(base)}`
|
369
|
+
return `${await g(context.object)} ${await g(base)}`
|
442
370
|
} else {
|
443
|
-
return `${g({...context.object, paraphrase: context.paraphrase})}'s ${g(base)}`
|
371
|
+
return `${await g({...context.object, paraphrase: context.paraphrase})}'s ${await g(base)}`
|
444
372
|
}
|
445
373
|
}
|
446
374
|
},
|
@@ -534,15 +462,15 @@ let configStruct = {
|
|
534
462
|
notes: 'greg has eyes?',
|
535
463
|
where: where(),
|
536
464
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'have') && context.query,
|
537
|
-
apply: ({context, g, api, objects}) => {
|
465
|
+
apply: async ({context, g, api, objects}) => {
|
538
466
|
const object = pluralize.singular(context.object.value);
|
539
467
|
const property = pluralize.singular(context.property.value);
|
540
468
|
context.isResponse = true
|
541
|
-
if (!api.knownObject(object)) {
|
542
|
-
context.verbatim = `There is no object named ${g({...context.object, paraphrase: true})}`
|
469
|
+
if (!await api.knownObject(object)) {
|
470
|
+
context.verbatim = `There is no object named ${await g({...context.object, paraphrase: true})}`
|
543
471
|
return
|
544
472
|
}
|
545
|
-
if (!api.hasProperty(object, property)) {
|
473
|
+
if (!await api.hasProperty(object, property)) {
|
546
474
|
context.evalue = {
|
547
475
|
marker: 'yesno',
|
548
476
|
value: false,
|
@@ -561,7 +489,7 @@ let configStruct = {
|
|
561
489
|
where: where(),
|
562
490
|
// match: ({context}) => context.marker == 'property' && context.same && context.object,
|
563
491
|
match: ({context, hierarchy, uuid}) => hierarchy.isA(context.marker, 'property') && context.same && context.objects && !context[`disable${uuid}`],
|
564
|
-
apply: ({context, objects, km, api, log, s, uuid}) => {
|
492
|
+
apply: async ({context, fragments, objects, km, api, log, s, uuid}) => {
|
565
493
|
const objectContext = context.object;
|
566
494
|
const propertyContext = context;
|
567
495
|
const objectId = context.object.value
|
@@ -576,7 +504,7 @@ let configStruct = {
|
|
576
504
|
// greg HERE
|
577
505
|
*/
|
578
506
|
propertyContext[`disable${uuid}`] = true
|
579
|
-
const propertyId = km("dialogues").api.evaluateToConcept(propertyContext, context, log, s).evalue;
|
507
|
+
const propertyId = (await km("dialogues").api.evaluateToConcept(propertyContext, context, log, s)).evalue;
|
580
508
|
try{
|
581
509
|
// greg
|
582
510
|
// api.makeObject({config, context: objectContext, doPluralize: false})
|
@@ -588,8 +516,8 @@ let configStruct = {
|
|
588
516
|
} catch (e) {
|
589
517
|
log(`Error processing set property of an object: ${e}`)
|
590
518
|
const config = km('properties')
|
591
|
-
const fragment =
|
592
|
-
const value = api.getProperty(objectId, propertyId)
|
519
|
+
const fragment = fragments("the property1 of object1 is value1")
|
520
|
+
const value = await api.getProperty(objectId, propertyId)
|
593
521
|
if (value.value == context.same.value) {
|
594
522
|
context.evalue = [
|
595
523
|
{ marker: 'yesno', value: true, paraphrase: true },
|
@@ -620,7 +548,7 @@ let configStruct = {
|
|
620
548
|
context.evalue = [
|
621
549
|
{ marker: 'yesno', value: false, paraphrase: true },
|
622
550
|
]
|
623
|
-
context.evalue = context.evalue.concat(fragment.instantiate(mappings))
|
551
|
+
context.evalue = context.evalue.concat(await fragment.instantiate(mappings))
|
624
552
|
context.evalue.forEach( (r) => r.paraphrase = true )
|
625
553
|
context.isResponse = true
|
626
554
|
context.sameWasProcessed = true
|
@@ -638,48 +566,47 @@ let configStruct = {
|
|
638
566
|
!context.evaluate.toConcept, // && !context.value,
|
639
567
|
// greghere
|
640
568
|
// match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.evaluate,
|
641
|
-
apply: ({context, api, kms, objects, g, s, log}) => {
|
569
|
+
apply: async ({context, api, kms, objects, g, s, log}) => {
|
642
570
|
const toDo = [ ...context.objects ]
|
643
571
|
|
644
|
-
const toValue = (objectContext) => {
|
572
|
+
const toValue = async (objectContext) => {
|
645
573
|
if (!objectContext.value) {
|
646
574
|
return objectContext;
|
647
575
|
}
|
648
576
|
let objectValue = kms.stm.api.getVariable(objectContext.value);
|
649
|
-
if (!api.knownObject(objectValue)) {
|
650
|
-
context.verbatim = `There is no object named "${g({...objectContext, paraphrase: true})}"`
|
577
|
+
if (!await api.knownObject(objectValue)) {
|
578
|
+
context.verbatim = `There is no object named "${await g({...objectContext, paraphrase: true})}"`
|
651
579
|
return
|
652
580
|
}
|
653
581
|
return objectValue
|
654
582
|
}
|
655
583
|
|
656
584
|
let currentContext = toDo.pop()
|
657
|
-
let currentValue = toValue(currentContext)
|
585
|
+
let currentValue = await toValue(currentContext)
|
658
586
|
while (toDo.length > 0) {
|
659
587
|
const nextContext = toDo.pop()
|
660
|
-
const nextValue = toValue(nextContext)
|
588
|
+
const nextValue = await toValue(nextContext)
|
661
589
|
if (!nextValue) {
|
662
590
|
// TODO maybe this I aware so it can say "I don't know about blah..." and below
|
663
591
|
// if (currentContext.unknown || !currentContext.value) {
|
664
592
|
if (!api.conceptExists(currentContext.value)) {
|
665
593
|
// api.conceptExists(currentContext)
|
666
|
-
const objectPhrase = g({...currentContext, paraphrase: true})
|
594
|
+
const objectPhrase = await g({...currentContext, paraphrase: true})
|
667
595
|
context.verbatim = `What "${objectPhrase}" means is unknown`
|
668
596
|
return
|
669
597
|
}
|
670
598
|
|
671
|
-
const propertyPhrase = g({...nextContext, paraphrase: true})
|
672
|
-
const objectPhrase = g({...currentContext, paraphrase: true})
|
599
|
+
const propertyPhrase = await g({...nextContext, paraphrase: true})
|
600
|
+
const objectPhrase = await g({...currentContext, paraphrase: true})
|
673
601
|
context.verbatim = `There is no interpretation for "${propertyPhrase} of ${objectPhrase}"`
|
674
602
|
return
|
675
603
|
}
|
676
604
|
|
677
|
-
if (!api.knownProperty(currentContext, nextContext)) {
|
678
|
-
|
679
|
-
context.verbatim = `There is no property ${g({...nextContext, paraphrase: true})} of ${g({...currentContext, paraphrase: true})}`
|
605
|
+
if (!await api.knownProperty(currentContext, nextContext)) {
|
606
|
+
context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`
|
680
607
|
return
|
681
608
|
}
|
682
|
-
currentContext = api.getProperty(currentValue, nextValue, g)
|
609
|
+
currentContext = await api.getProperty(currentValue, nextValue, g)
|
683
610
|
currentValue = currentContext.value
|
684
611
|
}
|
685
612
|
context.focusable = ['object[0]']
|
@@ -690,30 +617,26 @@ let configStruct = {
|
|
690
617
|
]
|
691
618
|
};
|
692
619
|
|
693
|
-
const createConfig = () => {
|
694
|
-
const config = new Config(configStruct, module)
|
695
|
-
config.stop_auto_rebuild()
|
696
|
-
config.api = api
|
697
|
-
config.add(concept(), meta(), dialogues())
|
698
|
-
config.restart_auto_rebuild()
|
699
|
-
return config
|
700
|
-
}
|
701
|
-
|
702
620
|
knowledgeModule( {
|
621
|
+
config,
|
622
|
+
api: () => new API(),
|
623
|
+
includes: [concept, meta, dialogues],
|
624
|
+
|
703
625
|
module,
|
704
626
|
description: 'properties of objects',
|
705
|
-
createConfig,
|
706
627
|
test: {
|
707
628
|
name: './properties.test.json',
|
708
629
|
contents: properties_tests,
|
709
630
|
checks: {
|
710
631
|
context: defaultContextCheck,
|
632
|
+
/*
|
711
633
|
objects: [
|
712
634
|
'children',
|
713
635
|
'concept',
|
714
636
|
'parents',
|
715
637
|
'properties'
|
716
638
|
]
|
639
|
+
*/
|
717
640
|
},
|
718
641
|
include: {
|
719
642
|
words: true,
|
package/common/punctuation.js
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const gdefaults = require('./gdefaults')
|
4
4
|
const punctuation_tests = require('./punctuation.test.json')
|
5
5
|
|
6
|
-
let
|
6
|
+
let config = {
|
7
7
|
name: 'punctuation',
|
8
8
|
operators: [
|
9
9
|
"([leftParenthesis|] (phrase) ([rightParenthesis|]))",
|
10
10
|
"((before) [comma|])", // comma applies if before is dead
|
11
11
|
"([colon|])",
|
12
|
+
"((sentence) <endOfSentence|>)",
|
12
13
|
"([doubleQuote|] (!doubleQuote/*)* (doubleQuote/*))",
|
13
14
|
],
|
14
15
|
bridges: [
|
@@ -30,7 +31,14 @@ let configStruct = {
|
|
30
31
|
bridge: "{ ...next(operator) }",
|
31
32
|
words: [{ word: ")", value: ')', depth: '-' }],
|
32
33
|
},
|
33
|
-
{
|
34
|
+
{
|
35
|
+
id: "colon",
|
36
|
+
words: [':'],
|
37
|
+
},
|
38
|
+
{
|
39
|
+
id: "endOfSentence", words: ['.'],
|
40
|
+
bridge: "{ ...before, postModifiers: append(before.postModifiers, ['endOfSentence']), endOfSentence: operator }",
|
41
|
+
},
|
34
42
|
{
|
35
43
|
id: "doubleQuote",
|
36
44
|
level: 0,
|
@@ -45,16 +53,16 @@ let configStruct = {
|
|
45
53
|
where: where(),
|
46
54
|
priority: -1,
|
47
55
|
match: ({context}) => context.parenthesis == '(',
|
48
|
-
apply: ({context, g}) => `(${g({ ...context, parenthesis: null })})`
|
56
|
+
apply: async ({context, g}) => `(${await g({ ...context, parenthesis: null })})`
|
49
57
|
},
|
50
58
|
],
|
51
59
|
};
|
52
60
|
|
53
|
-
const createConfig = () => new Config(configStruct, module).add(gdefaults())
|
54
|
-
|
55
61
|
knowledgeModule( {
|
62
|
+
config,
|
63
|
+
includes: [gdefaults],
|
64
|
+
|
56
65
|
module,
|
57
|
-
createConfig,
|
58
66
|
description: 'punctuation',
|
59
67
|
test: {
|
60
68
|
name: './punctuation.test.json',
|