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

dfty9e19  于 22天前  发布在  其他
关注(0)|答案(2)|浏览(24)

使用NLP.js应用中的导出语料库

摘要

目前我们希望通过NLP.js应用程序( https://github.com/axa-group/nlp.js-app )的接口训练模型,并将其导出为JSON格式以供外部存储。然后,我们希望在单独的NLP.js应用程序( https://github.com/axa-group/nlp.js )中使用此导出的语料库数据来响应用户。
然而,我们在单独的NLP.js系统中使用导出的语料库数据遇到了困难。似乎从应用程序导出的数据使用"Brain"作为主要分类器,但在尝试将此配置加载到NLP.js时会抛出错误。

重现最简单的示例

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));
})();

这是从NLP.js-App(经过训练后)导出的提供的语料库,使用 manager.export(); :
neural-corpus copy.json.txt

预期行为

预期的行为是我们可以训练数据、导出它,然后在处理器(NLP.js NlpManager)中使用此导出的模型。

当前行为

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

可能的解决方案

如果可能的话,您能向我们提供实现此目标的正确方法吗?

您的环境

软件版本
nlp.js4.21.3
nodev12.14.0
npm7.6.0
操作系统Mac OS BigSur v11.12.1
plicqrtu

plicqrtu1#

更新

我注意到这个应用默认使用版本3,这似乎是我遇到的问题——试图将一个版本3的语料库导入到版本4的处理器中。尽管如此,我的问题已经解决了,不过如果UI能够更新以使用NLP.js的新版本4就更好了。
谢谢!

55ooxyrt

55ooxyrt2#

在回顾上述内容后,我们如何使用NLP.js-App v4 nlp.js?

相关问题