Code Monkey home page Code Monkey logo

twitter-sentiment-analysis's Introduction

Sentiment Analysis Project

Introduction

Sentiment analysis involves determining the sentiment expressed in a piece of text, often used to understand the opinions and emotions of individuals. In the context of this project, we aim to contribute to Twitter's efforts to combat the misuse of the platform by creating a robust NLP-based classifier. The goal is to distinguish negative tweets and take measures to block or address such content.

Data Source

The dataset for this project was obtained from Kaggle and can be found here. Each row in the dataset contains the text of a tweet and a corresponding sentiment label. The training set includes a word or phrase from the tweet (selected_text) that encapsulates the provided sentiment.

About the Dataset

  • The dataset consists of 27,481 unique values.

Columns:

  • textID: Unique ID for each piece of text
  • text: The text of the tweet
  • sentiment: The general sentiment of the tweet

Code Overview

  1. Understanding the Dataset & Cleanup:

    • Loaded the dataset from 'Tweets.csv'.
    • Explored and cleaned the dataset, handling missing values and preprocessing the text.
  2. Building Classification Models:

    • Developed classification models to predict Twitter sentiments.
    • Implemented two classifiers: Multinomial Naive Bayes and Logistic Regression.
  3. Comparison of Evaluation Metrics:

    • Compared the evaluation metrics of various classification algorithms.
    • Utilized metrics such as accuracy, confusion matrix, and classification report.

Key Dependencies

  • numpy==1.23.3
  • pandas==1.4.3
  • matplotlib==3.5.2
  • seaborn==0.12.0
  • wordcloud==1.8.2.2
  • scikit-learn==1.1.1
  • nltk==3.7

Usage

  1. Clone the Repository:

    git clone https://github.com/payal-soni28/Twitter-Sentiment-analysis.git
    
  2. Install Dependencies:

    pip install -r requirements.txt
    
  3. Run the Jupyter Notebook:

Ensure that you have Jupyter Notebook installed in your Python environment. If not, you can install it using:

pip install jupyter

Start Jupyter Notebook by running the following command in the project directory:

jupyter notebook
  • Your default web browser will open, and you can navigate to SentimentAnalysis.ipynb in the Jupyter Notebook interface.

OR

  • Open the project folder in your preferred IDE (e.g., VSCode, PyCharm) and run the script.

Feel free to customize the code according to your specific needs or further insights.

made by payal soni❤️

twitter-sentiment-analysis's People

Contributors

payal-soni28 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.