I.Rasaについて
オープンソースで、クラウドでなくダウンロードしてPythonでプログラムを書ける、Chatbotの学習にはうってつけですが、依存ライブラリオンバージョンの不整合でエラーになることが多くてPythonに慣れた人でも戸惑うと思います。
しかし、Rasaがどのようなものであるかは、インストールの手間をかけることなく、オンラインで確認することができます。
II.用語の説明
Building a chatbot with Rasaからの引用です。
Rasa NLU:
A natural language understanding solution which takes the user input and tries to infer the intent and extract the available entities.
Rasa Core:
A dialog management solution tries to build a probability model which decides the set of actions to perform based on the previous set of user inputs.
Some keywords you will find repeatably used in the post in reference to Rasa functions/tools,
Intent:
Consider it as the aim or target of the user input. If a user say, “Which day is today?”, the intent would be finding the day of the week.
Entity:
Consider it as the useful information from the user input that can be extracted. From previous example, by intent we understand the aim is to find the day of week, but of which date? If we extract “Today” as the entity, we can perform the action on today.
Actions:
As the name suggest, its an operation which can be performed by the bot. It could be replying something in return, querying a database or any other thing possible by code.
Stories:
These are a sample interaction between the user and bot, defined in terms of intents captured and actions performed. So developer can mention what to do if you get a use input of some intent with/without some entities. Like saying if user intent is to find the day of week and entity is today, find day of week of today and reply.
To make this work, Rasa need some files, which stores all the training and model information to build the bot. To give a brief overview, most important ones are,
NLU training file:
It contains a bunch of examples of the user input along with their mapping to a suitable intent and entities present in each of them. The more varying examples you provide, better your bot’s NLU capabilities become. Find one interactive way of creating training data here.
Stories file:
Contains a bunch of stories to learn from. From each stories, creates a probability model of interactions.
Domain file: Here you list all of the intents, entities, actions and similar information. You can also add sample bot reply templates and use them as actions.
III.Try it outの説明
オンラインで次の会話をします。順にRunをクリックすれば会話できます。
しかし、画像は取得できませんでした。どうして画像が表示されないかは今もわかりません。
スクリプトについて説明します。不明なところは飛ばして、説明7を参考に会話すれば、スクリプトの概要を理解できます。
1.
2.
3.
4.
5.
6.Pipelineは次の二種類あります。トレーニングサンプル数に応じて選択します。
language: “en”
pipeline: “spacy_sklearn”
language: “en”
pipeline: “tensorflow_embedding”
詳しい説明は次にあります。
7.ボットと会話
/restartでストーリーを挨拶から始められます。