Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NlpManager unable to process onIntent #1274

Closed
web3-anon opened this issue Feb 7, 2023 · 2 comments
Closed

NlpManager unable to process onIntent #1274

web3-anon opened this issue Feb 7, 2023 · 2 comments

Comments

@web3-anon
Copy link

web3-anon commented Feb 7, 2023

I've been using the following for the past few weeks and it works fine for onIntent function:

const { dockStart } = require('@nlpjs/basic');
const dock = await dockStart();
const nlp = dock.get('nlp');
await nlp.addCorpus('corpus-en.json');
await nlp.train();
nlp.onIntent = onIntent;

However, I just replaced it with the following & onIntent is no longer working (producing blank answer):

const { NlpManager } = require('node-nlp');
const nlp = new NlpManager();
await nlp.addCorpus('corpus-en.json');
await nlp.train();
nlp.onIntent = onIntent;

May I know the correct format for NlpManager to make it work?

@Apollon77
Copy link
Contributor

NlpManager is NOT the Nlp class but a convenient wrapper, so yes this code is not equivalent and so it will not work.

I think a short cut is nlp.nlp.onIntent = onIntent

@web3-anon
Copy link
Author

It worked, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants