Skip to content

rajeshnayak1106/sentiment_analysis_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment Analysis API


About

The Flask application provides two different endpoints for sentiment analysis of text data. One of that APIS takes a single sentence/paragraph and other one that takes a list of sentences/paragraphs. Based on assumptions line break/new line is takes as the list separator. The API uses a pre-trained sentiment analysis model to predict sentiment score. Based on the rules provided in the model classification document, if the prediction score is >= 0.0 then result is positive else negative. The API uses REST methodology and us written using Flask framework. There are many benefits of using REST format which benefits this API requirements such as


* Ease of implementation : This API is very simple in nature hence REST is best option
* Supports JSON hence lightweight on network : There is no limitation in the lengths of text hence JSON would be the better format to transfer data over network as its semi-structured and also lightweight
* Stateless : Each request to the endpoints need to be isolated from each other an the server side does not need to store the state of the request sent via the endpoints

API Documentation

There 2 API endpoints for multiple needs.
/singleinput
Accepts a single sentences/paragraph without line break and returns prediction score and sentiment analysis result in JSON format along with the text which was sent for analysis <br

 - input : text/plain
 - output : application/json

/listinput
Accepts a list of sentences/paragraphs and returns prediction score and sentiment analysis result in JSON format for each sentences/paragraph in the list and also the overall list.
 - input : text/plain
 - output : application/json

For better understanding please refer to the SwaggerHub link below

https://app.swaggerhub.com/apis/Personal8618/sentiment_analysis_api/1.0.0

Technologies

The following technologies are used in this project:

Requirements

Before starting you need to have Python installed.

Running

# Clone this project
$ git clone https://github.com/rajeshnayak1106/sentiment_analysis_api.git

# Access
$ cd sentiment_analysis_api

# Install dependencies
$ pip install -r requirements.txt

# Run the project
$ python app.py

# The server will initialize in the <http://localhost:5000>

# Test the endpoints
$ pytest api_test.py

# To run with docker
$ docker build -t sentiment_analysis_app:latest .
$ docker run -d -p 5000:5000 sentiment_analysis_api

Back to top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors