I am currently trying to create a chatbot and adding some contextdata to it, like in this example: https://github.com/axa-group/nlp.js/tree/master/examples/14-ner-corpus
I have tried several variants of configs, filenames, file paths etc. I even looked up the source code if the contextdata corpus gets read, which it does.
But at the end when running my code against "what is the real name of spiderman?" the {{ hero }} part gets replaced, but the {{ _data[entities.hero.option].realName }} doesn't.
My code currently looks like this:
import { NlpManager, ConversationContext } from 'node-nlp'
const manager = new NlpManager({
languages: ['en'],
forceNER: true,
autoSave: false,
nlu: { useNoneFeature: true }
})
const context = new ConversationContext()
manager.addCorpora('./corpus.json')
await manager.train()
const response = await manager.process(
'en',
'what is the real name of spiderman?',
context
)
console.log(response)
The corpus files i use are those linked in the example above:
https://github.com/axa-group/nlp.js/blob/master/examples/14-ner-corpus/corpus.json
https://github.com/axa-group/nlp.js/blob/master/examples/14-ner-corpus/heros.json
I hope someone can give me a pointer at what i am doing wrong here.
I solved it with the help of https://github.com/jesus-seijas-sp
const { NlpManager } = require('node-nlp');
(async () => {
const activity = {
conversation: {
id: 'a1'
}
}
const manager = new NlpManager({
languages: ['en'],
forceNER: true,
autoSave: false,
nlu: { useNoneFeature: true }
})
manager.addCorpora('./corpus.json')
await manager.train()
const response = await manager.process({ locale: 'en', utterance: 'what is the real name of spiderman?', activity });
console.log(response)
})();