main

2018/08/21

Building your chatbot with RASA(tutorial 2)

This tutorial continues on my previous post, however, includes TensorFlow into the embedding.

Just as the page https://rasa.com/docs/core/quickstart/
Of course you want your bot to understand real language, not just structured input.An interpreter is responsible for parsing messages. It performs the Natural Language Understanding (NLU) and transforms the message into structured output. In this example we are going to use Rasa NLU for this purpose.
In Rasa NLU, we need to define the user messages our bot should be able to handle in the Rasa NLU training data format
1) Here we first add nlu_config.yml file as following:
language: en
pipeline: tensorflow_embedding

2) Then we add another intent bye to the following three files
trainingData.md
stories.md
domain.yml
3) We created a Makefile, including make train and make run.
    a) make train
    b) make run

  The detailed commands are :
train:
$(PYTHON) -m rasa_nlu.train -c nlu_config.yml --data trainingData.md -o models --fixed_model_name nlu --project current --verbose

run:
$(PYTHON) -m rasa_core.run -d models/dialogue -u models/current/nlu


The GitHub link is https://github.com/chaowu2009/sample_chatbot_RASA

Building your chatbot with RASA (tutorial 1)

I was recently introduced to RASA, a new chat bot which immediately captured my attention after playing with it.

Here I am using Python framework , following their own example as https://rasa.com/docs/core/quickstart/ and hopefully you can learn to practice it yourself.

However, I do divert from that a little bit to provide a better flow based on my experience.

Basically a conversation has question/answers. We just need make the bot understand our question and then provide a proper answer.  Here is one example:

If we say: Hello/Hey/Hi/Good morning/Good afternoon/Hi, Hi/ Hi, Bot/, we are greeting the bot. The bot should understand this question ( here in RASA, it is called intent) and answer accordingly. The bot can answer as simple as "hey" or "hey, nice to meet you", or "hey, what can I do for you, etc" .

So we need build a system which understand the "intent", "action" based on the intent, then "answer" the human.

Here is the steps:

1) create the domain.yml file, which defines intent, actions, templates
intents:
    - greet

actions:
    - utter_greet

templates:
    utter_greet:
        - "Hello. Can I help you?"

2) create stories.md file, which define the story line
## general greetings
* greet
   - utter_greet

3) training the model in the command line
python -m rasa_core.train -d domain.yml -s stories.md -o models/dialogue

4) run the chatbot in the command line
python -m rasa_core.run -d models/dialogue

5) or run the chatbot in non-stop mode as in the RASA tutorial
python sample_chatbot.py

The GitHub repo is https://github.com/chaowu2009/sample_chatbot_RASA

2018/08/15

technology forward

I am dedicated this space to my technology passion and will write frequently.

I am living in Columbia, Maryland.

How to Supercharge Your Python Classes with Class Methods

  How to Supercharge Your Python Classes with Class Methods | by Siavash Yasini | May, 2024 | Towards Data Science As we just mentioned, a c...