Coder Social home page Coder Social logo

rasa_chatbot_cn's Introduction

Rasa Core and Rasa NLU

rasa对话系统系列文章

Introduction

这个demo是用rasa-nlu完成slot filling和intent classify,用rasa-core完成DM(dialogue management)和NLG(natural language generate)。demo完成的对话主要有办理套餐和查询话费和流量,其他意图做了default回答。demo是参考了_rasa_chatbot。_rasa_chatbot存在的问题,一是版本更新不及时,API没有做相应的更改;二是没有自定义的component。 由于rasa社区最近版本更新很频繁,以前很多方法被弃用,而且还增加了好多新的功能,这个demo比较全面和及时。

rasa-nlu:      0.13.4
rasa-core:     0.12.3
rasa-core-sdk: 0.12.1

Command

train nlu model

python bot.py train-nlu

total_word_feature_extractor.dat可去https://pan.baidu.com/s/1-ma0ndXBWL0rnbUqCAcL-w ,密码:lhi4 下载。nlu_model_config.yml中的pipeline可自定义,这里由于数据量较少,用了开源的方法和词向量。如果你的rasa_dataset_training.json上数据足够多,可以尝试使用nlu_embedding_config.yml配置来训练nlu model.

train dialogue

python bot.py train-dialogue

train dialogue in online mod

python -m rasa_core_sdk.endpoint --actions actions &
python -m rasa_core.train --online -o models/dialogue -d mobile_domain.yml -s data/mobile_story.md --endpoints endpoints.yml

test dialogue

python -m rasa_core_sdk.endpoint --actions actions &
python -m rasa_core.run --nlu models/nlu/default/current --core models/dialogue --endpoints endpoints.yml

provide dialogue service

python -m rasa_core_sdk.endpoint --actions actions &
python -m rasa_core.train --online -o models/dialogue -d mobile_domain.yml -s data/mobile_story.md --endpoints endpoints.yml

compare policy

python -m rasa_core.train compare -c keras_policy.yml embed_policy.yml -d mobile_domain.yml -s data/mobile_edit_story.md -o comparison_models/ --runs 3 --percentages 0 25 50 70

evaluate policy

python -m rasa_core.evaluate compare -s data/mobile_edit_story.md --core comparison_models/ -o comparison_results/

Some tips

rename and count story

utils/re_story.py 是用来对mobile_story.md里面的故事进行重命名和重新计数

auto generate rasa_dataset_training.json

data/rasa_dataset_training.json 是通过一些规则自动生成的,节省很多人力。仓库是chatito_gen_nlu_data 具体用法可参考官方文档

Some magical functions

最近自己开源了基于rasa-nlu的rasa-nlu-gao新增了四个自定义组件,具体用法和说明请参考上面rasa对话系统踩坑系列二rasa对话系统踩坑记(三)。那下面就是介绍如何使用了。

首先需要下载rasa-nlu-gao

pip install rasa-nlu-gao

训练模型

python bot.py train-nlu-gao

测试使用模型

python -m rasa_nlu_gao.server -c config_embedding_bilstm.yml --path models/nlu_gao/

后续rasa-nlu-gao会持续更新,也欢迎贡献。

rasa_chatbot_cn's People

Watchers

James Cloos avatar tx-anin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.