Giter Club home page Giter Club logo

rasa_weather's Introduction

天气预报聊天机器人安装部署

https://github.com/pingyuan2016/rasa_weather/

本文说明

注:本文是学习使用rasa框架构建任务型聊天机器人,数据和逻辑来自Xiaoquan Kong @ https://github.com/howl-anderson,用最新版rasa翻新,感谢大佬,原文详情请看https://github.com/howl-anderson/WeatherBot

rasa官网:https://rasa.com/

rasa帮助文档:https://rasa.com/docs/rasa/ (能解决百分九十的问题)

环境

python = 3.6

rasa = 1.5.3

rasa环境安装

注:最好在python虚拟环境中安装,例如virtualenv

安装 rasa

pip install rasa-x --extra-index-url https://pypi.rasa.com/simple

安装mitie

pip install git+https://github.com/mit-nlp/MITIE.git

pip install rasa[mitie]

安装jieba

pip install jieba

数据准备

data目录中,nlu和stories都已存在

total_word_feature_extractor.dat需要下载:

https://github.com/howl-anderson/MITIE_Chinese_Wikipedia_corpus 下载,解压缩后放置到 data/total_word_feature_extractor.dat

天气预测调用的心知天气的接口,需要申请api key(私钥)放入到api.py中

训练

注:默认自带一个模型,不想训练,环境装好可以直接运行(如果运行报错,需要重新训练)

注:默认会训练rasa_nlu和rasa_core

rasa train

结果在models里面

两种方法运行:

第一种:shell运行(windows或者linux都可以)

action执行,启动解析用户说话内容:

rasa run actions

rasa_actions

执行rasa,启动模型:

rasa shell

rasa_shell

rasa_run

第二种:带聊天界面

action执行,启动解析用户说话内容:

rasa run actions

rasa执行(启动rasa接口,指定端口,cors是解决跨域名的问题):

rasa run -m models --enable-api --log-file out.log -p 5500 --cors "*"

运行web服务,

python http-server.py

默认访问http://127.0.0.1:5000/index

rasa_html

在线演示

天气预报聊天机器人

个人网站

rasa_weather's People

Contributors

pingyuan2016 avatar

Stargazers

faliolay avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar dorian5656 avatar  avatar P小二 avatar 阿良 avatar Song Liu avatar

Watchers

 avatar

rasa_weather's Issues

Exception: Unable to create entity detections.

message.text, message.get("tokens"), mitie_feature_extractor

File "/home/wang/anaconda3/envs/rasa/lib/python3.6/site-packages/rasa/nlu/extractors/mitie_entity_extractor.py", line 38, in extract_entities
entities = self.ner.extract_entities(tokens_strs, feature_extractor)
File "/home/wang/anaconda3/envs/rasa/lib/python3.6/site-packages/mitie/mitie.py", line 285, in extract_entities
raise Exception("Unable to create entity detections.")
Exception: Unable to create entity detections.

anyhelp for this problem?

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.