我正在使用阈值为0.8的NerManager。我要在函数中添加一组非常具体的训练样本(注意:以下是示例代码,显示了大约30%的训练样本)
它正在正确地从输入文本中提取实体“ AB_99876”,但我遇到的问题是它也在提取“ Today”,“ 01/01/2019”,“ test@email.com”和“((123 )-456-7890”。
我在做什么错了?
这是示例代码:
const { NerManager } = require('node-nlp');
const manager = new NerManager({ threshold: 0.8 });
manager.addNamedEntityText(
'sample_a',
'category_a',
['en'],
['AB_12345','AB_54321','AC_12245','AC_12355','BA_12345','BA_87653','AC_99876','DC_54321','BC_12232'],
);
manager.findEntities(
'Today 01/01/2019 is a good day. My email is test@email.com and phone is (123)-456-7890 and the the number I am looking for is AB_99876',
'en',
).then(entities => {
// I look for the value in the utteranceText field and process the extracted entity for next steps.
}).catch(err => {
console.log('Error getting entity extracted', err);
})
答案 0 :(得分:0)
您需要将其他配置 builtinWhitelist 传递给NerManager。 默认情况下,将处理所有内置实体。
const manager = new NerManager({
threshold: 0.8,
builtinWhitelist: [],
});