Skip to content

The Review Sentiment Prediction repository uses PyTorch to build and train a sentiment analysis model on the Yelp dataset. It converts text reviews into vectors and applies deep learning techniques to classify reviews as positive or negative.

Notifications You must be signed in to change notification settings

omartarekmoh/Review-Sentiment-Prediction

Repository files navigation

Review Sentiment Prediction

This repository contains a Review Sentiment Analyzer that predicts the sentiment of text based on the Yelp dataset. The project is implemented using PyTorch and includes the following components:

  • Vocabulary: A class for managing the mapping between tokens and their corresponding integer indices.
  • ReviewVectorizer: A class for converting text reviews into numerical vectors.
  • ReviewDataset: A class for handling the dataset and splitting it into training, validation, and test sets.
  • ReviewClassifier: A PyTorch neural network model for sentiment classification.

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/omartarekmoh/Review-Sentiment-Prediction.git
    cd Review-Sentiment-Prediction
  2. Install the required dependencies:

    pip install -r requirements.txt

Usage

  1. Data Preparation:

    Download the Yelp dataset from here and place it in the data/ directory -The one in the directory is a smaller version of the full dataset-.

  2. Training the Model:

    Run the training script to train the model on the dataset:

    python train.py
  3. Making Predictions:

    Use the trained model to predict the sentiment of new reviews:

    python test.py

Project Structure

  • data/: Directory for storing the dataset.
  • train.py: Script for training the model.
  • test.py: Script for making predictions using the trained model.
  • classes.py: Contains the core classes (Vocabulary, ReviewVectorizer, ReviewDataset).
  • model.py: Contains the ReviewClassifier class.
  • helpers.py: Contains utility functions for data processing and model training.

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

The Review Sentiment Prediction repository uses PyTorch to build and train a sentiment analysis model on the Yelp dataset. It converts text reviews into vectors and applies deep learning techniques to classify reviews as positive or negative.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published