Text detection using Python
Python language is widely used for modern machine learning and data analysis. One can detect an image, speech, can even detect an object through Python. For now, we will detect whether the text from the user gives a positive feeling or negative feeling by classifying the text as positive, negative, or neutral. In the code, Vader sentiment analysis and Tkinter are used. Tkinter is a standard GUI library for creating the GUI application.
Required Installations in Anaconda:
- tkinter: This module is used for creating a simple GUI application. This module generally comes pre-installed with Python but to install it externally type the below command in the terminal.
Using conda command.
conda install -c anaconda tk
Linux users can also use the below command.
sudo apt-get install python3-tk
- nltk: This module is used for making computers understand the natural language. To install it type the below command in the terminal.
conda install -c anaconda nltk
pip install nltk
- numpy: This module is the fundamental package for scientific computing with Python. To install it type the below command in the terminal.
conda install -c conda-forge numpy
pip install numpy
- pandas: This module is used for data analysis. It provides highly optimized performance with back-end source code is purely written in C or Python. To install it type the below command in the terminal.
conda install -c anaconda pandas
pip install pandas
- matplotlib: This module is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays. To install it type the below command in the terminal.
conda install -c conda-forge matplotlib
pip install matplotlib
VADER Sentiment Analysis
VADER (Valence Aware Dictionary and sEntiment Reasoner) is a lexicon and rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media. VADER uses a combination of A sentiment lexicon is a list of lexical features (e.g., words) which are generally labeled according to their semantic orientation as either positive or negative. VADER not only tells about the Positivity and Negativity score but also tells us about how positive or negative a sentiment is.
Note: For more information, refer to Python | Sentiment Analysis using VADER.
Below is the implementation.