entodicton
Version:
63 lines (59 loc) • 1.42 kB
JavaScript
const { Config, knowledgeModule, where } = require('theprogrammablemind')
/*
This demo does not use the knowledge modules and just shows the
basic API.
*/
let config = {
name: 'demo',
operators: [
'((i) [went] ([to] (<the> store)))'
],
bridges: [
{
id: 'the',
level: 0,
bridge: "{ ...after, determiner: 'the' }"
},
{
id: 'to',
level: 0,
bridge: '{ ...next(operator), after: after[0] }'
},
{
id: 'went',
level: 0,
generatorp: ({ context, gp }) => `${gp(context.actor)} went to ${gp(context.place)}`,
bridge: "{ action: 'go', marker: 'went', actor: before[0], place: after[0].after }"
}
],
generators: [
{
match: ({ context }) => context.isResponse,
apply: ({ context }) => context.evalue
},
{
match: ({ context }) => context.marker === 'unknown',
apply: ({ context }) => context.text
}
],
semantics: [
{
match: ({ context }) => context.marker === 'went',
apply: ({ context }) => {
// same way as kms that I wrote. you dont have to do this though
context.isResponse = true
context.evalue = 'okay, sounds good'
}
}
]
}
config = new Config(config, module)
knowledgeModule({
module,
config,
description: 'demo for readme',
test: {
name: './demo.test.json',
contents: require('./demo.test.json')
}
})