Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
wiki:software:beuthbot:rasa [13.12.2019 11:10] Christopher Lehmann |
wiki:software:beuthbot:rasa [24.01.2020 15:18] (aktuell) Abirathan Yogarajah |
||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
==== Table Of Content ==== | ==== Table Of Content ==== | ||
+ | |||
- [[wiki: | - [[wiki: | ||
- [[wiki: | - [[wiki: | ||
- | - [[wiki: | ||
- [[wiki: | - [[wiki: | ||
- | - [[wiki: | + | - [[wiki: |
- | - [[wiki: | + | - [[wiki: |
- | - [[wiki: | + | |
- [[wiki: | - [[wiki: | ||
- [[wiki: | - [[wiki: | ||
Zeile 19: | Zeile 18: | ||
- [[wiki: | - [[wiki: | ||
- | ==== Understanding | + | |
+ | |||
+ | ==== Getting Started ==== | ||
+ | |||
+ | The following instructions are intended to help the user run the Rasa-NLU-component on the local machine for development. | ||
+ | |||
+ | |||
+ | === Understanding Rasa-NLU | ||
Rasa NLU allows the processing of natural language to classify user intentions and extract entities from text. | Rasa NLU allows the processing of natural language to classify user intentions and extract entities from text. | ||
Zeile 25: | Zeile 31: | ||
e.g.\\ | e.g.\\ | ||
\\ | \\ | ||
- | ''" | + | ''" |
\\ | \\ | ||
- | The user intention is then determined from the text.\\ | + | The user intention is then determined from the text. In the figure below, the response to the message is displayed. The user intention (" |
<code javascript> | <code javascript> | ||
- | " | + | { |
- | | + | |
- | | + | " |
+ | " | ||
+ | }, | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ... | ||
+ | } | ||
+ | ] | ||
+ | ... | ||
} | } | ||
</ | </ | ||
- | Training data is needed so that Rasa can identify the intention of a text. Training | + | Training data is needed so that Rasa can identify the intention of a text. For this purpose, training |
To create a trained model for Rasa from the Markdown or JSON, Rasa offers a REST API. An alternative to creating trained models is to install Rasa on your local machine and then create the model using the command "rasa train nlu". Rasa creates the training model (tar.gz) from the Markdown or JSON. | To create a trained model for Rasa from the Markdown or JSON, Rasa offers a REST API. An alternative to creating trained models is to install Rasa on your local machine and then create the model using the command "rasa train nlu". Rasa creates the training model (tar.gz) from the Markdown or JSON. | ||
- | Furthermore Rasa NLU is configurable and is defined by pipelines. These pipelines define how the models are generated with the training data and which entities are extracted. For this, a preconfigured pipeline with "spaCy" is used. spaCy works in this case with pre-trained language models. | + | Furthermore Rasa NLU is configurable and is defined by pipelines. These pipelines define how the models are generated with the training data and which entities are extracted. For this, a preconfigured pipeline with "supervised_embeddings" is used. " |
- | ==== Getting Started ==== | ||
- | The following | + | ==== Perform Rasa locally ==== |
+ | |||
+ | You need the local installation of Rasa to create and test training models. For this, you use the directory " | ||
+ | |||
+ | |||
+ | === Basic requirements === | ||
+ | |||
+ | The following installations must be made:\\ | ||
+ | - Pip \\ | ||
+ | - Python (Version 3.6.8)\\ | ||
+ | - Tensorflow\\ | ||
+ | - Making further installations ([[https:// | ||
+ | - If necessary, further installation via pip (depending on the message of the compiler) \\ | ||
+ | |||
+ | |||
+ | === Project structure === | ||
+ | |||
+ | The following | ||
+ | |||
+ | - config.yaml: | ||
+ | contains the configuration of the NLU e.g. specification of the pipeline (how the trained model is generated) \\ | ||
+ | - /data (directory): | ||
+ | contains training data in the form of JSON (Markdown would also be possible) \\ | ||
+ | - /models (directory): | ||
+ | contains the trained model in the form of tar.gz.files The model is needed to capture entities and the user intent of a message. \\ | ||
+ | |||
+ | |||
+ | === Commands === | ||
+ | |||
+ | You need to run the following commands in the directory ' | ||
+ | |||
+ | < | ||
+ | # Create training-model: | ||
+ | rasa train nlu | ||
+ | |||
+ | # Communicating with Rasa NLU on the command line: | ||
+ | rasa shell nlu –m models/name-of-the-model.tar.gz | ||
+ | </ | ||
+ | |||
+ | Running Duckling: | ||
+ | |||
+ | After using the command "rasa train nlu" a model is generated. When communicating with Rasa via the shell ("rasa shell nlu ...") the component | ||
+ | |||
+ | === How to generate training datasets === | ||
+ | |||
+ | In this project we write training data in the form of JSON, because JSON offers the possibility to extract entities from a text message. For this purpose the data was generated with the tool | ||
+ | |||
+ | {{: | ||
+ | |||
+ | === Add new Model for Rasa-Container (Docker) === | ||
+ | |||
+ | You have to add the generated model (tar.gz) under the path " | ||
- | === Prerequisites | + | ==== Use of Docker ==== |
You will need to install Docker in order to use the Docker-Compose-file for running the application. | You will need to install Docker in order to use the Docker-Compose-file for running the application. | ||
Zeile 54: | Zeile 123: | ||
=== Installing === | === Installing === | ||
- | After the repository has been cloned and the prerequisites have been fulfilled, you can run the Docker-Compose-file. | + | After the repository has been cloned and the prerequisites have been fulfilled, you can run the Docker-Compose-file. |
+ | |||
+ | :!: FIXME FIXME FIXME | ||
< | < | ||
- | # build and start Rasa-NLU-Container | + | # build and start Containers |
docker-compose up | docker-compose up | ||
- | # stop and remove rasa-container, volumes, images and networks | + | # stop and remove rasa-containers, volumes, images and networks |
docker-compose down | docker-compose down | ||
Zeile 74: | Zeile 145: | ||
</ | </ | ||
- | ==== Overview | + | === Overview === |
- | As part of the chatbot-project, | + | As part of the chatbot-project, |
- | < | + | < |
version: ' | version: ' | ||
services: | services: | ||
rasa: | rasa: | ||
- | image: rasa/ | + | image: rasa/ |
ports: | ports: | ||
- 5005:5005 | - 5005:5005 | ||
volumes: | volumes: | ||
- | - ./ | + | - ./rasa-app-data:/app |
command: | command: | ||
- run | - run | ||
Zeile 92: | Zeile 163: | ||
- --cors | - --cors | ||
- " | - " | ||
+ | duckling: | ||
+ | image: rasa/ | ||
+ | ports: | ||
+ | - 8000:8000 | ||
</ | </ | ||
Zeile 133: | Zeile 208: | ||
- https:// | - https:// | ||
- https:// | - https:// | ||
+ | <WRAP pagebreak></ |