【发布时间】:2019-07-31 16:52:07
【问题描述】:
我正在使用 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: entity
name: foodType
automatically_extensible: yes
values:
- banana
- apple
- orange
从这个文件中,我可以将它安装到我的 snips-nlu 引擎中。 但是我如何在运行时附加更多的 foodTypes?
代码:
from snips_nlu import SnipsNLUEngine
from snips_nlu.default_configs import CONFIG_EN
import io
import json
seed = 42
engine = SnipsNLUEngine(config=CONFIG_EN, random_state=seed)
with io.open("dataset.json") as f:
dataset = json.load(f)
engine.fit(dataset)
parsing = self.engine.parse("what color is the apple?")
【问题讨论】:
标签: python-3.x nlp dataset yaml chatbot