Getting started with RASA_NLU

1. Introduction

environment:

Project address: https://github.com/crownpku/Rasa_NLU_Chi

Chinese introduction (author): http://www.crownpku.com/2017/07/27/%E7%94%A8Rasa_NLU%E6%9E%84%E5%BB%BA%E8%87%AA%E5%B7 %B1%E7%9A%84%E4%B8%AD%E6%96%87NLU%E7%B3%BB%E7%BB%9F.html

Source: jieba, sklearn, mitie,

Follow the README.md steps:

1. Download project:

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

 

2. MITIE model training,

Training is too slow and time-consuming. You can use the model trained by the author. The model address is:

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

Model (323957KB): total_word_feature_extractor_zh.dat

Place the model under the data folder:

data\total_word_feature_extractor_zh.dat

 

3. Construct as much sample data as possible to use as training data for intent recognition and entity recognition:

The author's data is used here. Of course, the data can be expanded. The format is json.

Location: data/examples/rasa/demo-rasa_zh.json

 

4、PIPELINE

There are two types of Chinese:

  1. MITIE+Jieba,
  2. MITIE+Jieba+sklearn (sample_configs/config_jieba_mitie_sklearn.json)

We use the second one: MITIE+Jieba+sklearn

Rasa NLU workflow. . .

jieba custom dictionary. . .

 

5. Training Rasa NLU model

cd to the current folder and execute the following command

python -m rasa_nlu.train -c sample_configs/config_jieba_mitie_sklearn.yml --data data/examples/rasa/demo-rasa_zh.json --path models

 

6. Build local rasa_nlu background service

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

 

7. Open a new terminal and use the curl command to get the results.

curl -XPOST localhost:5000/parse -d '{"q":"我发烧了该吃什么药?", "project": "rasa_nlu_test", "model": "model_20190115-110659"}' | python -mjson.tool

A brief overview of the process:

(1) Configure three dependencies: jieba, sklearn, and mitie. Configuring mitie is a pitfall.

(2) Download the project file, download the trained mitie model, and place the model in the data folder

(3), train Rasa NLU model (PIPELINE: MITIE+Jieba+sklearn)

(4) Set up background services

(5), curl command test results, this is another pitfall,

The main operations are in parts 3, 4, and 5

 

 

 

2. Those pits

1. Install MITIE dependencies

Install MITIE under win10: https://blog.csdn.net/liu765023051/article/details/83107254

This article is very detailed. Install VS first, and the subsequent boost requires the VS environment; then install cmake and configure environment variables; then install boostm, and the test is successful; finally install NITIE and use pip install git+https://github. The com/mit-nlp/MITIE.git command seems to be successful. It reaches the end and finally displays

Running setup.py install for mitie... error , still the same after multiple attempts,

The error reported is also puzzling:

So I had to give up this method.

 

Then I saw this link: https://blog.csdn.net/ld326/article/details/80965689

The usage method is the same as above, but the version is lower and there is no bin directory, but the mitie distribution link is given:

mitie release version: https://github.com/mit-nlp/MITIE/releases/

Wouldn’t it be nice to download the latest version V0.6 (actually it should be 0.5?) and then install it using the released version.

Method: Right-click shift in the release version project directory, select powershell, and then use the python setup.py install command.

Then use the conda list command to see that the mitie package has been installed.

 

A brief overview of mitie dependency installation:

Use the mitie distribution version to install mitie dependencies,

Release version address: https://github.com/mit-nlp/MITIE/releases/

Reference: Release and installation of python custom packages:  https://blog.csdn.net/qq_33523482/article/details/80941084

 

2. Curl command to get results

After starting the rasa_nlu background service, we used the curl command to test the results. Even if curl.exe was configured, the command was wrong. We had no choice but to use another method. We used postman.

Postman 4.1.2 download address:  http://files.cnblogs.com/files/mafly/postman-4.1.2.rar

Installation method: https://www.cnblogs.com/wxinyu/p/7691465.html

Start the background and get the port, as follows:

After obtaining the port, you can use postman, as shown below:

The result is as follows:

Check the model loading status: http://localhost:5000/status

All endpoints provided by Rasa are fully described here: https://nlu.rasa.com/http.html

 

 

3. Reference summary:

1. Project address: https://github.com/crownpku/Rasa_NLU_Chi

2. Project introduction (author): http://www.crownpku.com/2017/07/27/%E7%94%A8Rasa_NLU%E6%9E%84%E5%BB%BA%E8%87%AA%E5 %B7%B1%E7%9A%84%E4%B8%AD%E6%96%87NLU%E7%B3%BB%E7%BB%9F.html

 

3. MITIE model address: Link: https://pan.baidu.com/s/1kNENvlHLYWZIddmtWJ7Pdg Password: p4vx

 

4. mitie release version: https://github.com/mit-nlp/MITIE/releases/

4.1. Release and installation of python custom packages:  https://blog.csdn.net/qq_33523482/article/details/80941084

 

5. Postman 4.1.2 download address:  http://files.cnblogs.com/files/mafly/postman-4.1.2.rar

5.1. Postman installation method: https://www.cnblogs.com/wxinyu/p/7691465.html

 

6. Getting started with NLU installation (including how to use postman): https://www.xunjin.me/index.php/2018/06/24/rasa-nlu-installation/

 

7. Online annotation tool: https://rasahq.github.io/rasa-nlu-trainer/

 

Guess you like

Origin blog.csdn.net/bailixuance/article/details/86494799