1 RASA NLU简介... 2

2 准备... 2

2.1 环境说明... 2

3 安装... 4

3.1 下载软件... 4

3.2 安装... 4

3.4 安装问题... 5

4 使用... 6

5 参考... 8

RASA NLU Chi安装

1 RASA NLU简介

自然语言理解(NLU)系统是问答系统、聊天机器人等更高级应用的基石。基本的NLU工具,包括实体识别和意图识别两个任务。

2 准备

2.1 环境说明

1 操作系统 centos 6.5 64 bit

$ rpm -q centos-release

centos-release-6-5.el6.centos.11.2.x86_64

$ lsb_release -a

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch

Distributor ID: CentOS

Description:    CentOS release 6.5 (Final)

Release:    6.5

Codename:   Final

2 python版本 3.7.0

$ python3 -V

Python 3.7.0

3 需要的包信息

pip3 list >> ~/piplist.txt

more piplist.txt

Package

Version

------------------

---------

attrs

19.3.0

Automat

0.8.0

boto3

1.10.28

botocore

1.13.28

certifi

2019.6.16

characteristic

14.3.0

chardet

3.0.4

Click

7.0

cloudpickle

1.2.2

colorama

0.4.1

coloredlogs

10.0

constantly

15.1.0

cycler

0.10.0

Cython

0.29.14

docutils

0.15.2

future

0.18.2

gevent

1.4.0

greenlet

0.4.15

humanfriendly

4.18

hyperlink

19.0.0

idna

2.8

importlib-metadata

0.23

incremental

17.5.0

jieba

0.39

jmespath

0.9.4

joblib

0.14.0

jsonschema

3.2.0

kiwisolver

1.1.0

klein

19.6.0

matplotlib

3.1.2

mitie

0.7.36

more-itertools

7.2.0

neobolt

1.7.13

neotime

1.7.4

numpy

1.14.3

packaging

19.2

pathlib

1.0.1

pip

10.0.1

prompt-toolkit

2.0.9

py2neo

4.3.0

pyahocorasick

1.4.0

Pygments

2.3.1

PyHamcrest

1.9.0

pyparsing

2.4.5

pyrsistent

0.15.6

python-dateutil

2.8.0

pytz

2019.2

PyYAML

5.1.2

rasa-nlu

0.12.2

requests

2.22.0

s3transfer

0.2.1

scikit-learn

0.19.2

scipy

1.3.3

setuptools

39.0.1

simplejson

3.17.0

six

1.12.0

sklearn

0.0

tqdm

4.39.0

Tubes

0.2.0

Twisted

19.10.0

typing

3.7.4.1

urllib3

1.24.3

wcwidth

0.1.7

Werkzeug

0.16.0

zipp

0.6.0

zope.interface

4.7.1

1 也可以通过该项目里的requirements.txt按照需要的包

pip3 install -r requirements.txt

2 建议按照国内的源结合包版本号安装,如:

sudo pip3 install numpy==1.14.3 -i  http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

sudo pip3 install scikit-learn==0.19.2 -i  http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

3 有部分包不是本项目必需的,比如py2neo、neobolt 、neotime等。

3 安装

3.1 下载软件

Github上下载rasa_nlu_chi

下载地址 https://github.com/crownpku/rasa_nlu_chi

或者:

git clone https://github.com/crownpku/rasa_nlu_chi.git

3.2 安装

1 将下载好的压缩文件解压到指定目录下.这里是当前用户主目录的workdata下。

unzip Rasa_NLU_Chi-master.zip

2 进入解压的目录进行安装

cd Rasa_NLU_Chi-master

sudo python3 setup.py install

3.4 安装问题

1启动服务时报错,见红色部分:

python -m rasa_nlu.server -c sample_configs/config_jieba_mitie_sklearn.yml --path models

ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' (/usr/local/python3/lib/python3.7/site-packages/urllib3-1.23-py3.7.egg/urllib3/util/ssl_.py

原因是python3编译时未支持ssl,这里需要额外安装ssl并重新编译python3,如下是ssl安装部分

wget http://www.openssl.org/source/openssl-1.1.0e.tar.gz

tar -zxvf openssl-1.1.0e.tar.gz

cd openssl-1.1.0e

sudo ./config shared zlib --prefix=/usr/local/openssl

sudo make

sudo make install

#查看openssl版本

/usr/bin/openssl version

OpenSSL 1.0.1e-fips 11 Feb 2013

#建立软链接

ln -s openssl ssl

2源码编译python3

找到python3源码分别对文件Setup.dist、Setup打开ssl方面的注释。这里python3源文件需要按自己的情况修改。

vi ~/software/Python-3.7.0/Modules/Setup.dist

vi ~/software/Python-3.7.0/Modules/Setup

命令行模式下输入:

:set number

直接跳转到209行,打开一下四行注释,见下:

:210

:q!

#回到python3源文件目录

cd ~/software/Python-3.7.0

sudo ./configure --prefix=/usr/local/python3 --with-ssl

sudo make

sudo make install

3如果出现共享库找不到的错误,可以通过软连接的方式解决,然后再重新进行python3的源码编译、安装。

error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory错误

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

如果出现下图,则证明ssl安装成功

4 Rasa_NLU能正常启动服务,但报如下错误

“error”: “bad input shape (1, 5)”
这是因为scikit-learn版本较高,安装0.19.1即可。这里验证

0.19.2亦可。

包名

版本号

numpy

1.14.3

scikit-learn

0.19.2

scipy

1.3.3

4 使用

1 训练MITIE模型

这里直接使用项目里已经训练好的模型文件,下载地址见下:

链接:https://pan.baidu.com/s/1kNENvlHLYWZIddmtWJ7Pdg 密码:p4vx

2 构建意图识别和实体识别的训练数据。这里使用项目里的,位置见项目主文件下的:

data/examples/rasa/demo-rasa_zh.json

3 训练Rasa NLU模型。这会在Rasa NLU主目录的model文件下生成模型相关的文件

sudo python3 -m rasa_nlu.server -c sample_configs/config_jieba_mitie_sklearn.yml --path models

4 启动后台Rasa NLU服务

python -m rasa_nlu.server -c sample_configs/config_jieba_mitie_sklearn.yml --path models

5 访问验证

#查看服务状态以及项目信息

sudo curl 'http://localhost:5000/status'

#请求并返回意图识别

$ sudo curl -XPOST localhost:5000/parse -d '{"q":"我发烧了该吃什药?", "project": "default", "model": "model_20191127-232941"}' | python3 -mjson.tool

sudo curl -XPOST localhost:5000/parse -d '{"q":"哪家的湘菜好吃?", "project": "default", "model": "model_20191127-232941"}' | python3 -mjson.tool

5 参考

1 ssl安装配置:

centos6-openssl1.1.0e安装_dodowolf_51CTO博客

CentOS6.5 安装openssl_weixin_33862041的博客-CSDN博客

2 share package缺少

解决openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory错误 - 我是一个NLPer哦啦啦 - 博客园

3 openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory错误

解决openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory错误 - 我是一个NLPer哦啦啦 - 博客园

4 Rasa NLU 安装、使用

RASA_NLU 入门_bailixuance的博客-CSDN博客

搭建一个中文rasa-nlu踩过的坑_Lorenly的博客-CSDN博客

Rasa 安装过程中的坑_u011244708的博客-CSDN博客_python 安装rasa

用Rasa NLU构建自己的中文NLU系统

RASA NLU Chi安装相关推荐

  1. 【机器学习】Rasa NLU以及Rasa Core概念和语法简介(超详细必看)

    觉得有帮助请点赞关注收藏~~~ 一.Rasa简介 Rasa是一个开源机器学习框架,可以用于构建基于文本和语音的对话驱动型自动化智能客服助手,能够克服传统客服的部分缺陷,在Windows操作系统环境下, ...

  2. 用Rasa NLU构建自己的中文NLU系统

    代码在 https://github.com/crownpku/rasa_nlu_chi 自然语言理解(NLU)系统是问答系统.聊天机器人等更高级应用的基石.基本的NLU工具,包括实体识别和意图识别两 ...

  3. 章节五:RASA NLU组件介绍--语言模型和分词器

    ​ 这里写目录标题 一.前言 二.语言模型组件 1.MitieNLP 2.SpacyNLP 三.分词器 1.WhitespaceTokenizer 2.JiebaTokenizer 3.MitieTo ...

  4. 支持中文的Rasa NLU训练服务部署---Rasa_NLU_Chi

    代码在 https://github.com/crownpku/rasa_nlu_chi 本文大部分内容抄自http://www.crownpku.com/2017/07/27/%E7%94%A8Ra ...

  5. 章节七:RASA NLU组件介绍--意图分类器和实体提取器

    目录 一.前言 二.意图分类器 2.1 MitieIntentClassifier 2.2 LogisticRegressionClassifier 2.3 SklearnIntentClassifi ...

  6. Rasa课程、Rasa培训、Rasa面试系列之: Rasa NLU意图和实体-分词器

    Rasa课程.Rasa培训.Rasa面试系列之: Rasa NLU意图和实体-分词器 在Rasa项目中,NLU管道定义了将非结构化用户消息转换为意图和实体的处理步骤.它由一系列组件组成,可以由开发人员 ...

  7. 1.Understanding the Rasa NLU Pipeline

    在Rasa项目中,NLU管道定义了将非结构化用户消息转换为意图和实体的处理步骤. 它由一系列组件组成,开发人员可以对其进行配置和定制. 本文的目的是解释各个组件在Rasa NLU管道中扮演的角色,并解 ...

  8. rasa、rasa-webchat 安装使用记录

    rasa.rasa-webchat 安装使用记录 rasa是一个开源的智能assistant框架,在安装rasa的过程中遇到了一些问题,在这里记录一下问题内容以及解决方案. 1 相关环境说明 这里使用 ...

  9. 章节六:RASA NLU组件介绍--特征生成器

    目录 一.前言 二.特征生成器 MitieFeaturizer SpacyFeaturizer ConveRTFeaturizer LanguageModelFeaturizer RegexFeatu ...

最新文章

  1. 正则表达式的学习二:正则表达式的匹配规则总结
  2. 2016.11.17随笔
  3. NPM useful library path: request.js
  4. HDU 3555 - Bomb
  5. 使用Envoy代理的微服务模式,第二部分:超时和重试
  6. c语言 将点同时保证x坐标从小到大,y坐标从小到大地排序,C语言第五六次作业.ppt...
  7. android 添加so,Android studio 中添加 .so 文件
  8. HTML5 canvas组件
  9. DPM灾难切换应用场景
  10. nux 平台的 libpcap 源代码分析
  11. ssh 无法连接 z/OS 主机
  12. Windows系统结构
  13. linux抓取僵尸网络进程脚本
  14. 8051单片机驱动TM1620任意字符循环显示程序(详细注释版)
  15. matlab误差平方和
  16. CodeForces596D Wilbur and Trees
  17. nn.Linear()函数详解
  18. Buct oj 1019
  19. Vpp源码解读--workhandoff处理
  20. 操作系统基础知识用户态和内核态的区别

热门文章

  1. opengl加载显示3D模型md2类型文件
  2. wxWidgets:wxMediaEvent类用法
  3. wxWidgets:基于 XML 的资源系统 (XRC)
  4. boost::geometry::dot_product用法的测试程序
  5. boost::container实现双端队列选项的测试程序
  6. Boost::context模块callcc的解析器测试程序
  7. Boost:BOOST_VERIFY_MSG扩展的用法测试程序
  8. Boost:双图bimap分配的测试程序
  9. ITK:使用分水岭Watershed方法对图像进行分割
  10. DCMTK:创建和验证DICOM数字签名