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

Using Exported Corpus from NLP.js-App within NLP.js #877

Open
briward opened this issue Mar 2, 2021 · 2 comments
Open

Using Exported Corpus from NLP.js-App within NLP.js #877

briward opened this issue Mar 2, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@briward
Copy link

briward commented Mar 2, 2021

Using Exported Corpus from NLP.js-App within NLP.js

Summary

At the moment we're looking to make use of the NLP.js application (https://github.com/axa-group/nlp.js-app) to train our model via the interface and export it to JSON for external storage. Then, we hope to use this exported Corpus data within a separate NLP.js application (https://github.com/axa-group/nlp.js) to respond to the user(s).

However, we are having difficulty using the exported Corpus data within the separate NLP.js system. It appears that the exported data from the App uses "Brain" as the primary classifier, but when attempting to load this configuration into NLP.js it throws errors.

Simplest Example to Reproduce

const { NlpManager } = require('node-nlp');

const corpus = require('./neural-corpus.json');

(async () => {  
  const manager = new NlpManager({ useNeural: 'brain' });

  await manager.import(corpus);

  await manager.train();

  const response = await manager.nlp.process('en', 'Hello');

  console.log(JSON.stringify(response));
})();

Here is the supplied Corpus which was exported from the NLP.js-App (after training) using manager.export();:

neural-corpus copy.json.txt

Expected Behavior

The expected behaviour would be that we could train the data, export it and then use this exported model in the processor (NLP.js NlpManager).

Current Behavior

(node:11966) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined at NluManager.fromJSON (node_modules/@nlpjs/nlu/src/nlu-manager.js:351:38)

Possible Solution

If possible, could you supply us with the correct way to achieve this?

Your Environment

Software Version
nlp.js 4.21.3
node v12.14.0
npm 7.6.0
Operating System Mac OS BigSur v11.12.1
@briward briward changed the title Using Exported Corpus from NLP.js-App within the NLP.js Using Exported Corpus from NLP.js-App within NLP.js Mar 2, 2021
@briward
Copy link
Author

briward commented Mar 3, 2021

Update

I have noticed that the App uses version 3 out of the box, this seems to be the issue I'm having - trying to import a Version 3 Corpus into a Version 4 processor. That said, my problem is solved although it would be interesting to find out if the UI is being updated to use the new V4 of NLP.js?

Thanks!

@ninjamoba
Copy link

ninjamoba commented Apr 23, 2021

After a review of the above how do we v4 nlp.js with NLP.js-App?

@aigloss aigloss added the enhancement New feature or request label Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants