Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fake Review Detection using NLP, Machine Learning

Python Scikit-Learn TensorFlow NLP License


Overview

Fake reviews have become a major challenge for e-commerce platforms, influencing customer purchasing decisions and reducing trust in online marketplaces.

This project leverages Natural Language Processing (NLP), Machine Learning, and Deep Learning techniques to automatically identify whether a review is genuine or fraudulent.

The system analyzes review text, extracts meaningful linguistic patterns, and classifies reviews as Real or Fake with high accuracy.


Key Features

  • Automated Fake Review Detection
  • NLP-Based Text Processing
  • TF-IDF Feature Extraction
  • Machine Learning Models
  • Deep Learning Integration
  • Real-Time Review Classification
  • Performance Evaluation Metrics

Problem Statement

Online platforms receive thousands of reviews every day. Many of these reviews are artificially generated to:

  • Increase product ratings
  • Manipulate customer opinions
  • Damage competitors' reputation
  • Influence purchasing decisions

This project aims to build an intelligent system capable of distinguishing genuine customer feedback from deceptive reviews.


Project Workflow

Dataset
   │
   ▼
Text Preprocessing
   │
   ▼
Feature Extraction (TF-IDF)
   │
   ▼
Model Training
   │
   ▼
Model Evaluation
   │
   ▼
Prediction

Dataset

Source

Amazon Product Reviews Dataset

Features

Feature Description
Review Text Customer review content
Rating Product rating (1–5 stars)
Reviewer ID Unique reviewer identifier
Product ID Product identifier
Verified Purchase Purchase authenticity flag

Labels

Label Meaning
0 Genuine Review
1 Fake Review

Text Preprocessing

Raw review text undergoes several preprocessing steps before model training.

Steps

  • Convert text to lowercase
  • Remove stopwords
  • Tokenization
  • Lemmatization
  • Remove punctuation
  • Remove special characters
  • Text normalization

Example

Input:

"This product is AMAZING!!!"

Output:

product amazing

Feature Engineering

TF-IDF Vectorization

TF-IDF (Term Frequency–Inverse Document Frequency) converts textual reviews into numerical vectors suitable for machine learning algorithms.

Benefits

  • Highlights important words
  • Reduces impact of common words
  • Improves classification performance
  • Efficient for large datasets

Machine Learning Models

  • Logistic Regression
  • Naive Bayes
  • Support Vector Machine (SVM)
  • Random Forest

Deep Learning Models

  • Recurrent Neural Network (RNN)
  • Long Short-Term Memory (LSTM)
  • Bidirectional LSTM
  • BERT Transformer

Model Training

Training Configuration

Training Data : 80%
Testing Data  : 20%

Input

TF-IDF Feature Vectors

Output

Real Review
or
Fake Review

Model Evaluation

The model is evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • Confusion Matrix

Sample Evaluation

Actual Predicted Result
Fake Fake Correct
Real Fake Incorrect
Real Real Correct

Prediction Examples

Example 1

Input:

Excellent product!!! Must buy!!!

Prediction:

Fake Review
Confidence Score: 87%

Example 2

Input:

I used this product for 2 weeks. Battery backup is excellent, but the camera quality could be improved.

Prediction:

Genuine Review
Confidence Score: 91%

Fake Review Indicators

The model identifies common patterns in fake reviews:

  • Excessive promotional language
  • Repetitive wording
  • Too many exclamation marks
  • Generic descriptions
  • Lack of personal experience

Example:

Best product ever!!!
Amazing!!!
Highly recommended!!!

Genuine Review Indicators

The model identifies characteristics of authentic reviews:

  • Detailed explanations
  • Personal experiences
  • Balanced opinions
  • Natural writing style
  • Mention of both pros and cons

Example:

The battery life is impressive, but charging speed is slightly slower than expected.

Technology Stack

Programming Language

  • Python

Data Processing

  • Pandas
  • NumPy

NLP Libraries

  • NLTK
  • SpaCy

Machine Learning

  • Scikit-Learn

Deep Learning

  • TensorFlow
  • Keras
  • Transformers

Visualization

  • Matplotlib
  • Seaborn

Project Structure

Fake-Review-Detection/
│
├── dataset/
│   └── reviews.csv
│
├── notebooks/
│   └── EDA.ipynb
│
├── models/
│   └── trained_model.pkl
│
├── src/
│   ├── preprocessing.py
│   ├── feature_extraction.py
│   ├── train.py
│   ├── predict.py
│
├── app.py
├── requirements.txt
├── README.md
└── LICENSE

Project Screenshot

Project Structure


Installation

Clone Repository

git clone https://github.com/your-username/Fake_Review_Detection_Project.git

Move to Project Directory

cd Fake_Review_Detection_Project

Install Dependencies

pip install -r requirements.txt

Run Application

python app.py

Future Enhancements

  • Fine-Tuned BERT Models
  • Real-Time Review Monitoring
  • Browser Extension Integration
  • MERN Stack Dashboard
  • Multilingual Review Analysis
  • Cloud Deployment
  • Explainable AI (XAI)

Challenges & Limitations

  • Dataset quality affects accuracy
  • Fake reviews are becoming increasingly realistic
  • Domain-specific reviews may require retraining
  • Language variations can impact predictions

Results

This project demonstrates how NLP, Machine Learning, and Deep Learning can effectively identify deceptive online reviews and improve trust in digital marketplaces.


Author

Komal Khatod

Aarti Pansari

B.Tech Computer Science Engineering
Mody University of Science and Technology

GitHub: https://github.com/komalkhatod1105


⭐ If you found this project useful, consider giving it a star on GitHub.

About

Built a Fake Review Detection System using Machine Learning and Natural Language Processing (NLP) to detect deceptive online reviews. The system preprocesses review text, extracts relevant features, and classifies reviews as genuine or fake to improve the reliability of e-commerce platforms

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages