This is a web application built using Streamlit that performs sentiment analysis on tweets. The app classifies the emotional tone of the input text as positive or negative, providing valuable insights into customer opinions.
- User-friendly Interface: Simple input field for entering tweets.
- Sentiment Classification: Classifies the sentiment of the input text as positive or negative.
- Real-time Predictions: Get instant feedback on sentiment analysis.
- Streamlit: For building the web application.
- TensorFlow/Keras: For the machine learning model.
- NLTK: For natural language processing tasks like tokenization, stemming, and stopword removal.
- Pickle: For loading pre-trained models and tokenizers.
To run this application locally, you need to have Python installed. Follow these steps:
-
Clone the repository:
git clone https://github.com/Warishayat/Sentiment-Analysis.git cd Sentiment-Analysis -
Install the required libraries:
pip install streamlit tensorflow nltk
-
Download necessary NLTK resources:
import nltk nltk.download('stopwords') nltk.download('wordnet')
-
Place your
model.pklandtoken.pklfiles in the same directory as the app. -
Run the application:
streamlit run app.py
- Open the application in your web browser.
- Enter the tweet you want to analyze in the input field.
- Click the "Predict" button to see the sentiment classification.
The sentiment analysis model has been trained on a dataset of tweets. It preprocesses the input text by:
- Converting text to lowercase
- Removing punctuation and emojis
- Stemming and removing stopwords
The model outputs a probability score indicating the sentiment, where a score of 0.5 or higher is classified as positive.
If you'd like to contribute to this project, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Streamlit - For creating the web app framework.
- TensorFlow - For the deep learning model.
- NLTK - For natural language processing tools.