rasa nlu需要大量的语料训练,而如果我们通过直接手写配置文件必然是工作量很大的事情。这里选择了一个开源工具chatito。官方地址在: https://github.com/rodrigopivi/Chatito
使用指南
安装
npm install -g chatito
说明
One particular behavior of the Rasa adapter is that when a slot definition sentence only contains one alias, and that alias defines the ‘synonym’ argument with ‘true’, the generated Rasa dataset will map the alias as a synonym. e.g.:
Rasa适配器的一种特殊行为是,当插槽定义语句仅包含一个别名,并且该别名将“ synonym”参数定义为“ true”时,生成的Rasa数据集会将别名映射为同义词。 例如:
%[some intent]('training': '1') @[some slot] @[some slot] ~[some slot synonyms] ~[some slot synonyms]('synonym': 'true') synonym 1 synonym 2
创建定义语料文件
vim botTrainData.chatito
这里选用了一个定义好的配置文件: https://github.com/GaoQ1/chatito_gen_nlu_data/blob/master/trainClimateBot.chatito
具体的文件定义语法可以参考: https://github.com/rodrigopivi/Chatito/blob/master/spec.md
%[greet]('training': '2') ~[hi] @[name?] ~[whatsUp?] ~[hi] hi hey 你好 你好啊 嗨 哈罗 hello @[name] Janis Bob shengl 盛领 小皮 ~[whatsUp] whats up how is it going 怎么样 咋啦 最近咋样了
生成训练文件
npx chatito botTrainData.chatito
NOTE: Using regular as default frequency distribution. Processing file: /Users/shengl/0000-hugerfuture/0-code/20-xiaoling/205-brain/00-github-demo/02-rasa-chatbot-cn/chatito_gen_nlu_data/01-hellochatito/botTrainData.chatito Saved training dataset: /Users/shengl/0000-hugerfuture/0-code/20-xiaoling/205-brain/00-github-demo/02-rasa-chatbot-cn/chatito_gen_nlu_data/01-hellochatito/default_dataset_training.json
查看生成的文件
vim default_dataset_training.json
{
“greet”: [
[{
“type”: “Text”,
“value”: “嗨 “
}, {
“value”: “Bob”,
“type”: “Slot”,
“slot”: “name”
}, {
“type”: “Text”,
“value”: “ how is it going”
}],
[{
“type”: “Text”,
“value”: “你好 咋啦”
}]
]
}
版权声明
本文标题:108-【RASA系列教程-2】-使用chatito生成配置及语料
文章作者:盛领
发布时间:2020年09月26日 - 13:06:59
原始链接:http://blog.xiaoyuyu.net/post/bfa48480.html
许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。
如您有任何商业合作或者授权方面的协商,请给我留言:sunsetxiao@126.com
