Python 3.x 我可以在运行中向snips nlu添加更多数据吗?
我正在使用snips nlu创建一个“简单”聊天机器人,用于管理某些任务。但我似乎不了解如何(如果可能的话)在运行时添加新的意图 我面临的问题是,假设我的yaml文件中有以下内容:Python 3.x 我可以在运行中向snips nlu添加更多数据吗?,python-3.x,nlp,dataset,yaml,chatbot,Python 3.x,Nlp,Dataset,Yaml,Chatbot,我正在使用snips nlu创建一个“简单”聊天机器人,用于管理某些任务。但我似乎不了解如何(如果可能的话)在运行时添加新的意图 我面临的问题是,假设我的yaml文件中有以下内容: type: intent name: questionAboutFood slots: - name: foodType entity: foodType utterances: - what color is a [foodType] - where can I buy a [foodType]
type: intent
name: questionAboutFood
slots:
- name: foodType
entity: foodType
utterances:
- what color is a [foodType]
- where can I buy a [foodType]
---
type: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
从这个文件中,我可以将它安装到我的snips nlu引擎中。
但是我如何在运行时附加更多的食物类型呢
代码:
我可以看到两种变通方法: 重新训练 一种方法是动态地重新训练
引擎
,使用附加实体值更新数据集。如果您的数据集不太大,这可能是一个合理的解决方案,因为培训将非常快
改进数据集
另一种解决方案是在yaml文件中提供更多的意图公式,以便生成的引擎
能够提取出看不见的实体值。
在您的例子中,您只提供了两个公式,其中实体是最后一个标记。此外,您提供的实体值仅为Unigram。由于这些原因,很可能NLU引擎在捕获多个令牌和/或当它们位于句子中间时不能捕获实体。
下面是一个稍微好一点的数据集,它已经概括得更好了:
type: intent
name: questionAboutFood
slots:
- name: foodType
entity: foodType
utterances:
- what color is a [foodType]
- what is the color of an [foodType] in general
- how much does an [foodType] cost
- can you describe a [foodType] for me please
- in which country is [foodType] generally found
- where can I buy a [foodType]
- how big are [foodType] in average
---
type: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
- red meat
- black eyed pea
- brussels sprouts
type: intent
name: questionAboutFood
slots:
- name: foodType
entity: foodType
utterances:
- what color is a [foodType]
- what is the color of an [foodType] in general
- how much does an [foodType] cost
- can you describe a [foodType] for me please
- in which country is [foodType] generally found
- where can I buy a [foodType]
- how big are [foodType] in average
---
type: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
- red meat
- black eyed pea
- brussels sprouts