GithubHelp home page GithubHelp logo

tweet_sentiment_analysis's Introduction

Twitter Sentiment Analysis Project

Overview

This project aims to perform sentiment analysis on Twitter data using machine learning techniques. The goal is to classify tweets as either positive or negative based on their content.

Dataset

The dataset used in this project is sourced from Twitter and contains tweets labeled with sentiment. It consists of various features including tweet text, user information, and timestamps. The target variable indicates whether the tweet is positive or negative.

Preprocessing

  • Cleaning: Text data is preprocessed to remove noise and irrelevant information.
  • Stemming: Words are stemmed using the Porter stemming algorithm to reduce them to their root form.
  • Vectorization: Text data is transformed into numerical vectors using TF-IDF vectorization.

Machine Learning Model

  • Model: Logistic Regression is utilized as the classification algorithm.
  • Training: The model is trained on the preprocessed tweet data.
  • Evaluation: Model accuracy is evaluated on both training and testing datasets.

Results

The trained model achieves a high accuracy score on both training and testing data, indicating its effectiveness in classifying tweet sentiments.

Saving Model

The trained model along with the TF-IDF vectorizer is saved using the pickle library for future use.

Usage

To predict sentiment for a given text, use the predict_sentiment() function provided in the sentiment_analysis.py script.

from sentiment_analysis import predict_sentiment

# Example usage
text = "I love puppies"
sentiment = predict_sentiment(text)
print(sentiment)  # Output: "Positive sentiment"

Requirements

  • Python 3.x
  • pandas
  • numpy
  • scikit-learn
  • nltk

tweet_sentiment_analysis's People

Contributors

christiansada 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.