const { NlpManager } = require('node-nlp');
async function main() {
const manager = new NlpManager({ languages: ['en'], nlu: { useNoneFeature: false, log:false }});
manager.addDocument(
'en',
'I saw %hero% together with %hero%, they were eating %food%',
'saw_heroes_eating'
);
manager.addAnswer('en', 'saw_heroes_eating', 'You saw {{ hero_0 }} with {{ entities.hero.items[1].sourceText }} eating {{ food }} {{ 5*2 }}');
'you have {{ numMessages }} new message{{ numMessages === 1 ? "" : "s" }}'
manager.addNamedEntityText('hero', 'spiderman', ['en'], ['Spider-man']);
manager.addNamedEntityText('hero', 'iron man', ['en'], ['iron man']);
manager.addNamedEntityText('hero', 'thor', ['en'], ['Thor']);
manager.addNamedEntityText('food', 'burger', ['en'], ['Burger']);
manager.addNamedEntityText('food', 'pizza', ['en'], ['pizza']);
manager.addNamedEntityText('food', 'pasta', ['en'], ['Pasta', 'spaghetti']);
await manager.train();
const result = await manager.process('en','I saw spiderman together with ironman, they were eating spaghetti');
console.log(result.answer);
}
main();