Sentiment Analysis - An small experiment

Hi Koders,
In today’s guide, I will explain how you can make your Sentiment Analysis API and use it with kodular.

Before starting you let me clear some Questions

How are we going to make the API?

I have already built the API using python .you need to fork my repl.

Where will we deploy are API?

Our API would be hosted on Replit servers.

Step 1

First you need to fork my repl

Step 2

After forking the repl it would look something like this

Step 3

Click on the run button that is on the top.

Step 4

After clicking on the run button wait until you see this box with a URL

copy that URL and paste it in notepad

How does the API work ?

So for this API, I am using TextBlob Module. TextBlob has a method to get sentence polarity. I am using that method for sentiment analysis.

the API is formated like if you enter some text after the main URL, for example :-

https://sentiment-analysis.yashsehgal3.repl.co/hello+how+are+you

and run it in a browser, it will tell the sentiment of the text

Step 5

Now make a new project in Kodular and design it something like this

Coding part

now code it like this

The code first checks when the button is clicked. If the textbox text is empty, it will show an error message. Else it will get a web request from the API. After it receives the result, it displays the result on the label.

Results of the API


Here we come to the end of the guide. I hope you liked it :slight_smile:

5 Likes

Learned something new :star:

3 Likes

awesome guide :+1: :clap:

3 Likes