Skip to content

Text Sentiment Analysis in Python using Natural Language Processing (NLP) for Negative/Positive Content Detection. Deployed on the Cloud using Streamlit on the Heroku Platform.

License

Notifications You must be signed in to change notification settings

khanfarhan10/TextSentimentAnalysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Sentiment Analysis

Python Version Tensorflow Version Keras Version Pypi Version Hits

GitHub Issues Open GitHub Issues Closed GitHub Open Pull Requests GitHub Closed Pull Requests GitHub Forks GitHub Stars GitHub License

Text Sentiment Analysis in Python using Natural Language Processing (NLP) for Negative/Positive Content Predictions. Deployed on the Cloud using Streamlit on the Heroku Platform.

Winter of Code 2020 : View Project Ideas or View Issues to Solve.

Web Application Demo

View the deployed WebApp on Heroku.

Installation : Setting up the Application Locally

  • Dependencies:
    • Run the command pip install -r requirements.txt on your cmd/python terminal.
    • It is highly recommended to create a new Virtual Environment first before running the above commands. The instructions for doing the same is provided below.
  • Deployment:
    • Use Streamlit App : streamlit run TextSentimentApp.py
  • If there is no popup window opening in the browser you can paste the following address : http://localhost:8501/.

Creating Virtual Environments for Python Development in Visual Studio Code for this Project

A Guide to Creating Virtual Environments into Python and Using them Effectively.

Clone the Text Sentiment Analysis Repo :

Head over to our github repository ,fork the repo to your github account & clone the repository into your local machine.

Initial Setup

Open CMD/PowerShell from the VSCode Terminal :

It should display an output like the following :

CMD

Microsoft Windows [Version 10.0.18363.1198] (c) 2019 Microsoft Corporation. All rights reserved. C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>

or

Powershell

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6

Check for the python version you're running :

C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>python --version Python 3.7.6

Check for the Python Packaging Index (Pypi) version you're running :

C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>pip --version pip 20.0.2 from C:\ProgramData\Anaconda3\lib\site-packages\pip (python 3.7)

Install the virtualenv module from pip :

C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>pip install virtualenv

Create a project environment directory with YourAwesomeProjectNameEnvironment :

C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>mkdir TextSentimentEnv

Create a new (empty) virtual environment in YourAwesomeProjectNameEnvironment :

C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>virtualenv TextSentimentEnv

Users for other python versions may Install Python 3.7.6 first and then run the following command to choose the correct python interpreter with the correct path :

virtualenv --python=python3.7.6 TextSentimentEnv

Note : If you have problems with this step, try followng the debugging options provided below.

Enter into the newly created (empty) virtual environment in YourAwesomeProjectNameEnvironment : C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>TextSentimentEnv\Scripts\activate

You will notice a (YourAwesomeProjectNameEnvironment) appearing in the Command Line Interface : (TextSentimentEnv) C:\Users\farha\Documents\GitHub\TextSentimentAnalysis>

Wohoooo! You're now in your virtual environment.

Install Dependencies :

Okay Great! We've got our virtualenv setup, but it's empty right now. Lets install some modules into it.

For this we will be needing a .txt file noting all the dependency requirements for a project under the project directory.

This file contains packages in the following naming fashion and can be obtained using

pip freeze > requirements.txt

or using

conda list --explicit > reqs.txt

When you've obtained the requirements file, do the following with your Environment Activated : pip install -r requirements.txt

You are now happy to go forth coding and running your app with : streamlit run TextSentimentApp.py

Useful Links for Debugging :

Voila Magic!

If you have further issues/queries regarding the project, feel free to contact us :

Using the Streamlit App

To start using the streamlit application follow these steps:

  1. Clone the repo:
git clone https://github.com/khanfarhan10/TextSentimentAnalysis.git
  1. Start the streamlit app:
cd TextSentimentAnalysis/streamlit
streamlit run sentiment.py
  1. Start the flask server:
cd TextSentimentAnalysis/server
python server.py

Usage of Paraphrase and Summarization Utilities

In the streamlit application, you can enter the text, and in the sidebar you can choose the task you want to perform, and hit the button for the corresponding inference.

CLI Tool Usage

Please follow the steps to use the CLI Tool for text sentiment analysis and for summarization.

  1. Clone the repo:
git clone https://github.com/khanfarhan10/TextSentimentAnalysis.git
  1. Change directory into the application folder:
cd TextSentimentAnalysis/TxT-CLI
  1. Install the CLI through pip:
pip3 install .
  1. Usage of the CLI:
TxT <option> <inputfilepath> <outputfilepath>
  1. Options
<option> = "tsa" (Text Sentiment Analysis)
         = "sum" (Summarization)
         
<inputfilepath> = Path to a csv file containing texts in the first column

<outputfilepath> = Path to an empty csv file

About

Text Sentiment Analysis in Python using Natural Language Processing (NLP) for Negative/Positive Content Detection. Deployed on the Cloud using Streamlit on the Heroku Platform.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks