Blink.

Something that astounds me is how much perspective can have an impact on a person’s experiences. I’m not just talking about mindset or outlook here, I mean literal, tangible viewing angles on the…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Build a Rasa NLU Chatbot with spaCy and FastText

The intention of this write-up is to show the way to build a chatbot using 3 most popular open-source technologies in the market. Yes, now you can build your own chatbot in over 157 languages without having to wait for a latest release from top chatbot vendors. Open-source bots are the way forward specially in areas where there is huge potential for bots but lacks access and availability of the linguistic sources on the digital market.

Building word vectors from scratch (take a look at what you need to get started with)

I haven’t used it but i have heard good stuff about it. But i wont write much here

One of the example i based this exercise on was taken from this code

You have all the information but in short Fast Text was released by Facebook that provides a lot of pre trained vectors out of the box in many languages. Like 157 of them. That is literally a gift for the open-source world.

Rasa don’t natively support FastText as a backend but Spacy however is able to load Fasttext vectors based on the example code above..

Only change i made is add

This allow the model to be saved in SpaCy format with loaded vectors from Fast Text which you can download from here

Download the .vec file for the language you want and load them on the example code from SpaCy.

Run the command

It will generate a model in the path you provided above.

Here my goal again was to test the intent classification and compare it with SpaCy’s default

One more step to go before you can use it though i.e packaging the model.

Copy the .tar.gz file which is basically your model and load it onto Rasa NLU’s container( Yes, I use Docker)

The Dockerfile to load the spaCy model to the Rasa NLU , along with the other general requirements that you usually have.

i added these lines to my Dockerfile

Here is my config file from Rasa NLU

Now add your training data to see if it works well or not. You can simply run some cross-validation to gather results on your test data. I ran mine on google’s small talk intents downloaded from Dialogflow.com and converted to Rasa format. I am using the dutch pre-trained vectors on spaCy.

Instructions for evaluation is here

Let’s have a look at the metrics based on the cross-validation running on 10 folds:

Though the result don’t seem so convincing here, it is also because i used the small talk intent from Dialogflow which evidently showed me lack of examples as i did not have enough for 10 folds. I hope with your data, it can give better indications.

You can find the code for loading the vectors here:

Welcome to the world of Open Source Chatbots!!!!

Add a comment

Related posts:

One advice to the new crypto traders.

There are many tricks to help you trade better, but i know only one which has helped me and i hope it helps u. Even if the price is not accurate to the actual as the candle are calculated but the…

Control Your Habits by Understanding Them

This article on habits would be a three part guide. The first part involves understanding how habits work. Every human has habits that have become a part of them. The big question is — are they…

4 Steps To Beat Anxiety At Work

Have you ever sent a proposal to an important client and waited anxiously for the answer? Maybe you launched a new product and now can’t wait to see how it performs. How do you feel? Anxiety is a…