DEV Community

Cover image for FREE Sentiment Analysis ✌🏼 REST API for the community 🙏🏻
Sharad Raj (He/Him)
Sharad Raj (He/Him)

Posted on

FREE Sentiment Analysis ✌🏼 REST API for the community 🙏🏻

I've created a sentiment analysis REST API for the community ... Have a look

Link : https://sentim-api.herokuapp.com

How to use

Just send a POST request to

https://sentim-api.herokuapp.com/api/v1/
Enter fullscreen mode Exit fullscreen mode

with headers of

Accept: "application/json", 
"Content-Type": "application/json"
Enter fullscreen mode Exit fullscreen mode

and body

{ 
    "text": "Your text here"
}
Enter fullscreen mode Exit fullscreen mode

And you'll get response like this:

{
  "result": {
    "polarity": 0.11,
    "type": "positive"
  },
  "sentences": [
    {
      "sentence": "We have been through much darker times than these, and somehow each generation of Americans carried us through to the other side,\" he said.",
      "sentiment": {
        "polarity": 0.04,
        "type": "positive"
      }
    },
    {
      "sentence": "\"Not by sitting around and waiting for something to happen, not by leaving it to others to do something, but by leading that movement for change themselves.",
      "sentiment": {
        "polarity": 0,
        "type": "neutral"
      }
    },
    {
      "sentence": "And if you do that, if you get involved, and you get engaged, and you knock on some doors, and you talk with your friends, and you argue with your family members, and you change some minds, and you vote, something powerful happens.",
      "sentiment": {
        "polarity": 0.3,
        "type": "positive"
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Enjoy 😎😎😎😎

Latest comments (11)

Collapse
 
harishkotra profile image
Harish Kotra (he/him)

@sharadcodes is this on a heroku free dyno? If yes, do you plan to maintain this since Heroku is now moving to paid only mode?

Collapse
 
nminaya profile image
Nelson Minaya

Does it have multiple language support?

Collapse
 
abrkic0 profile image
abrkic0

It's not working currently? I get an Application error

Collapse
 
sharadcodes profile image
Sharad Raj (He/Him)

Sorry @abrkic0 I was not online, It will start working from tomorrow.
Once again sorry for not being able to reply on time.

Collapse
 
simpleauthority profile image
Jacob Andersen

Is the code on GitHub?

Collapse
 
sharadcodes profile image
Sharad Raj (He/Him) • Edited

No will make it open source soon, I don't store any data though

Collapse
 
simpleauthority profile image
Jacob Andersen

Would just like to see the code

Collapse
 
meatboy profile image
Meat Boy

Awesome! How does it works?

Collapse
 
sharadcodes profile image
Sharad Raj (He/Him)

I can't understand what are you saying.
Are you asking how can you use this API ?
Elaborate please.

Collapse
 
meatboy profile image
Meat Boy

How do you build this api? Do you used any machine learning?

Thread Thread
 
sharadcodes profile image
Sharad Raj (He/Him)

Yeah NLP algorithm