Give your product AI powered chatbot
That too, for free!
As a part of my exploration about AI, I set my goal to share the best tech that I learn.
In this blog post, I will build a bot from scratch that will help you enable Natural Language Processing just by using an Excel Sheet and a Cloud Service by IBM Watson; Natural Language Classifier. I’ll explain how I did it, so you can build your own.
Natural language Processing is a way for computers to analyze, understand, and derive meaning from human language in a smart and useful way. In simple words, NLP minimizes the language barrier between humans and machines exponentially.
It’s not as complicated as it might sound, this tutorial will make things way easier. We’ll build a “Coffee Bot”. Topic too lame right? The fact, this topic is so generic that even a newbie can ramp up quick. Rest assured, it can be used over any topic of your choice.
To start, open an excel sheet. Focus on column A. Now, think from a users perspective (Your end users) and write one question they are bound to ask to your bot.
For Eg: “how are you doing”
Now, assign a Class Name “doing_well” in column B to that respective question. Class Name can be assigned in whatever way you want.
There are many different ways in which a user can ask this same question. In order to make your bot understand the variation in each question and still have the power of figuring out the meaning, we need to train the bot. So, replicate “how are you doing” to atleast 5 or more similar meaning questions. The more, the better.
In this Microsoft Excel Sheet, Column A represent the questions and Column B represent Classes. That’s all that we need.
Bingo! We have reached our first checkpoint. I know that sounds silly but here’s the fact, this Excel Sheet will serve as our “actual” database.
As we know, this sheet is our Database, we further need to expand the capabilities of the bot and make it smarter by adding more features to it. I’ll repeat the same steps and create more classes. Each class will represent a feature and it’s unique in it’s own way. For better understanding, I have a few listed down.
Don’t forget, you can always enhance the quality of the Corpus (Database) by adding more classes (Features) to the existing database. Make sure you strictly keep them unique to not confuse the bot.
Once you have your Excel sheet ready with enough classes and questions to support the needs of your bot/product, next step is to train it. To train the database that you created, it strictly has to be saved in .csv format. IBM Watson NLC (Natural Language Classifier) doesn't support any other format.
Checkpoint 2 cleared!
Follow these 10 steps to train the database that you created and bring it to life.
Step: 1 “IBM Natural Language Classifier”
Step: 2 Click “Get started free”
Step: 3 Create a free account
Step: 4 Choose a name for your classifier and click create.
Step 5: Keep your service credentials confidential. This username/password helps you keep your Classifier unique.
Step: 6
- Access the beta toolkit
- Click sign in
- Click confirm authorization
Step: 7
- Add training data
- Click upload training data
- Select the .csv file
- Create Classifier
Step: 8 Wait until it gets trained.
Step: 9 This is the final product with a unique classifier ID. Bot ALIVE!
Step: 10 Ask Questions.
Keep testing and adding more questions and classes to the database. Make your bot smarter!
You can integrate this NLP bot with Google Home/Assistant, Alexa, Facebook Messenger, Siri, Stride, Slack or any other smart device/software.
Use the IBM Watson API Endpoint and the Classifier Credentials to connect it with your already exisiting product and you’re good to go!
Feel free to leave feedback or questions in the comments below. 😃
Note: You can replicate this same steps for a different topic.
If you would like to know more about my work with AI/ML check out: https://www.archie.ai