wiki.ziemers.de

ziemer's informatik Wiki

Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:software:beuthbot:rasa

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:software:beuthbot:rasa [22.01.2020 23:23]
Abirathan Yogarajah
wiki:software:beuthbot:rasa [24.01.2020 15:18] (aktuell)
Abirathan Yogarajah
Zeile 9: Zeile 9:
  - [[wiki:software:beuthbot:rasa#table of Content|Table Of Content]]  - [[wiki:software:beuthbot:rasa#table of Content|Table Of Content]]
  - [[wiki:software:beuthbot:rasa#getting started|Getting Started]]  - [[wiki:software:beuthbot:rasa#getting started|Getting Started]]
- - [[wiki:software:beuthbot:rasa#understanding rasa nlu|Understanding Rasa NLU]] 
  - [[wiki:software:beuthbot:rasa#perform rasa locally|Perform Rasa locally]]  - [[wiki:software:beuthbot:rasa#perform rasa locally|Perform Rasa locally]]
  - [[wiki:software:beuthbot:rasa#use of docker|Use of Docker]]  - [[wiki:software:beuthbot:rasa#use of docker|Use of Docker]]
Zeile 26: Zeile 25:
  
  
-==== Understanding Rasa-NLU ====+=== 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 34: Zeile 33:
 ''"Wie ist das Wetter übermorgen?"'' \\  ''"Wie ist das Wetter übermorgen?"'' \\ 
 \\ \\
-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 ("Wetter") and the date for tomorrow are illustrated.\\
  
 <code javascript> <code javascript>
Zeile 49: Zeile 48:
             "value": "2020-01-20T00:00:00.000+01:00",             "value": "2020-01-20T00:00:00.000+01:00",
             "confidence": 1.0,             "confidence": 1.0,
-            "additional_info":+            ...
-                "values":+
-                    { +
-                        "value": "2020-01-20T00:00:00.000+01:00", +
-                        "grain": "day", +
-                        "type": "value" +
-                    } +
-                ], +
-                "value": "2020-01-20T00:00:00.000+01:00", +
-                "grain": "day", +
-                "type": "value" +
-            }, +
-            "entity": "time", +
-            "extractor": "DucklingHTTPExtractor"+
         }         }
-    ], +    ] 
-    "intent_ranking":+    ...
-        { +
-            "name": "wetter", +
-            "confidence": 0.9518181086 +
-        }, +
-        { +
-            "name": "oeffnungszeiten", +
-            "confidence": 0.036207471 +
-        }, +
-        { +
-            "name": "mensa", +
-            "confidence": 0.0119743915 +
-        } +
-    ], +
-    "text": "Wie ist das Wetter übermorgen?"+
 } }
 </code> </code>
-Training data is needed so that Rasa can identify the intention of a text. Training data can be created in the form of Markdown or JSON. You can define this data in a single file or in multiple files in a directory. +Training data is needed so that Rasa can identify the intention of a text. For this purpose, training data can be created in the form of Markdown or JSON. You can define this data in a single file or in multiple files in a directory. 
  
 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.
Zeile 104: Zeile 76:
  
  
-=== Project structure (most important files and directories) ===+=== Project structure === 
 + 
 +The following files and directories are important for the project to configure Rasa, customize training data and create appropriate training models.
  
 - config.yaml: \\ - config.yaml: \\
Zeile 110: Zeile 84:
 - /data (directory): \\ - /data (directory): \\
 contains training data in the form of JSON (Markdown would also be possible) \\ contains training data in the form of JSON (Markdown would also be possible) \\
-- /models: \\+- /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. \\ 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. \\
  
Zeile 125: Zeile 99:
 rasa shell nlu –m models/name-of-the-model.tar.gz rasa shell nlu –m models/name-of-the-model.tar.gz
 </code> </code>
 +
 +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 "Duckling" is not addressed. With Duckling you can identify and resolve dates. To use Duckling you can add the trained model in the path "docker\rasa-app-data\models". Then you can run Rasa and Duckling as docker-containers and query them using the Rest API. Running Rasa and Duckling as docker-containers are explained in a later section.
  
 === How to generate training datasets === === 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   [[https://github.com/YuukanOO/tracy|Tracy]]. In the image below, Tracy is shown with "Öffnungszeiten". Entities are added as "slots", such as "Ort". Training data follows in the lower part of the picture. As training data, you can specify messages, which the user can send to the "chatbot". Currently the three user intentions "Mensa", "Wetter" and "Öffnungszeiten" are supported. 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   [[https://github.com/YuukanOO/tracy|Tracy]]. In the image below, Tracy is shown with "Öffnungszeiten". Entities are added as "slots", such as "Ort". Training data follows in the lower part of the picture. As training data, you can specify messages, which the user can send to the "chatbot". Currently the three user intentions "Mensa", "Wetter" and "Öffnungszeiten" are supported.
 +
 +{{:wiki:software:beuthbot:index.png_.png?400|}}
  
 === Add new Model for Rasa-Container (Docker) === === Add new Model for Rasa-Container (Docker) ===
Zeile 143: 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. The docker commands must be executed in the 'docker'-directory.
  
 :!: FIXME FIXME FIXME :!: FIXME FIXME FIXME
  
 <code> <code>
-# build and start Rasa-NLU-Container && serve at localhost:5005+# build and start Containers && serve at localhost:5005 (rasa) and at localhost:8000 (duckling)
 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 228: Zeile 208:
 - https://www.artificial-solutions.com/wp-content/uploads/chatbots-ebook-deutsche.pdf (Retrieved 12.12.2019)\\ - https://www.artificial-solutions.com/wp-content/uploads/chatbots-ebook-deutsche.pdf (Retrieved 12.12.2019)\\
 - https://docs.docker.com/ (Retrieved 12.12.2019) - https://docs.docker.com/ (Retrieved 12.12.2019)
 +<WRAP pagebreak></WRAP>
wiki/software/beuthbot/rasa.1579731783.txt.gz · Zuletzt geändert: 22.01.2020 23:23 von Abirathan Yogarajah