Docs 文件 » Dialogue Bot for goal-oriented task
翻译自 Dialogue Bot for goal-oriented task
我在pycharm中尝试运行代码,运行结果为对每句输入的回复。
from deeppavlov import build_model, configs
bot1 = build_model(configs.go_bot.gobot_dstc2, download=True)
print(bot1(['hi, i want restaurant in the cheap pricerange']))
print(bot1(['bye']))
The dialogue bot is based on 一篇论文 which introduces Hybrid Code Networks (HCNs) that combine an RNN with domain-specific knowledge and system action templates.
该对话机器人基于Jason d. Williams,Kavosh Asadi,Geoffrey Zweig 提出的混合代码网络(Hybrid Code Networks,HCNs)架构,混合代码网络: 实用且高效的端到端对话控制,带有监督和强化学习-2017 这篇论文,引入了混合编码网络(hcn) ,该混合编码网络将 RNN 与特定领域的知识和系统动作模板相结合。
虚线对应不需要的(可选的)模块,黑色方块对应训练模型,梯形是依赖于数据集的模块,必须由软件开发人员提供。
下面是一个与受过训练的对话机器人进行交互的简单示例:
(这些是框架中举的例子)
>> Hello, welcome to the Cambridge restaurant system. You can ask for restaurants by area, price range or food type. How may I help you?
x::hi, i want cheap food
2018-05-16 12:28:48.459 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap'}, got 22 results.
>> The lucky star serves chinese food in the cheap price range.
x::is there anything with french food?
2018-05-16 12:29:02.795 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap', 'food': 'french'}, got 0 results.
>> Sorry there is no french restaurant in the cheap price range.
x::ok, maybe there is something in expensive pricerange?
2018-05-16 12:29:23.337 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'french'}, got 2 results.
>> Cote serves french food in the expensive price range.
x::in what part of town is it?
2018-05-16 12:29:31.193 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'french'}, got 2 results.
>> Restaurant two two is a nice place in the north of town serving tasty french food.
x::ok, give me their phone number
>> The phone number of restaurant two two is 01223 351880.
x::address and post code too
>> Restaurant two two is on 22 chesterton road chesterton, c.b 4, 3 a.x.
x::ok, thank you!
>> Restaurant two two serves french food in the expensive price range.
x::and if i wanted an italian restuarant?
2018-05-16 12:30:15.98 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'expensive', 'food': 'italian'}, got 4 results.
>> Frankie and bennys serves italian food in the expensive price range.
x::more cheaply priced?
2018-05-16 12:30:36.560 INFO in 'deeppavlov.models.go_bot.bot'['bot'] at line 346: Made api_call with {'pricerange': 'cheap', 'food': 'italian'}, got 5 results.
>> Da vinci pizzeria serves italian food in the cheap price range.
x::ok, give me their phone number and address, please
>> The phone number of da vinci pizzeria is 01223 351707 and it is on 20 milton road chesterton.
x::thanks
>> Da vinci pizzeria serves italian food in the cheap price range.
x::bye
>> You are welcome!
A minimal model without slot_filler, intent_classifier and embedder is configured in configs/go_bot/gobot_dstc2_minimal.json.
没有槽填充、意图分类器和嵌入器的最小模型是在 configs / go_bot / gobot_dstc2 minimal.json中配置的。
除了chainer,用于训练管道的配置应该有三个额外的元素: dataset_reader数据集读取器、dataset_iterator 数据集迭代器和train训练器:
{
"dataset_reader": {
"class_name": ...,
...
},
"dataset_iterator": {
"class_name": ...,
...
},
"chainer": {
...
},
"train": {
...
}
}
下面是我的使用样例 ,调整
这个是通过python交互的形式,(
或者配置文件已经下载好之后,可以直接读取CONFIG_PATH
首先寻找cheap +south+chinese food ,并获取其phone number+ address + post code
然后寻找French food ,系统自动认为在原来的条件上,结合 cheap + french + north/south/east/west ,都got 0 results。
然后我意识到可能是因为价格的限制,于是调整为 expensive+french + centre/north ,都有相应的results。
对我们的机器人模型进行不同的修改,并与现有基准进行比较,结果如下
There were a few modifications to the original dataset. It differs from ours in train/valid/test split and intent/action labeling.
对原始数据集做了一些修改。 在训练 / 有效 / 测试分裂 和 意图 / 行动 标签上和我们的有所不同。