Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Similify ๐Ÿš€

Similarity, Simplified.

AI-powered duplicate news detection system built using NLP and TF-IDF similarity scoring.
Similify helps detect highly similar or duplicate articles instantly with accurate similarity scores.


๐Ÿ“Œ Overview

Similify is an intelligent content similarity detection system designed to:

  • Detect duplicate or near-duplicate news articles
  • Calculate similarity scores using TF-IDF + Cosine Similarity
  • Help publishers maintain originality
  • Prevent repeated content publishing
  • Improve editorial quality control

The system exposes a FastAPI backend and can be integrated with web or mobile applications.


๐Ÿง  How It Works

  1. Clean and preprocess text
  2. Convert text into TF-IDF vectors
  3. Compare new article with stored articles
  4. Calculate cosine similarity score
  5. Flag as duplicate if similarity โ‰ฅ threshold

๐Ÿ—๏ธ Beckend Project Architecture

Similify/
โ”‚
โ”œโ”€โ”€ app.py                  # FastAPI application
โ”œโ”€โ”€ clean_data.csv          # Preprocessed articles dataset
โ”œโ”€โ”€ tfidf_matrix.pkl        # Stored TF-IDF matrix
โ”œโ”€โ”€ vectorizer.pkl          # Saved TF-IDF vectorizer
โ”œโ”€โ”€ utils.py                # Cleaning + similarity functions
โ”œโ”€โ”€ requirements.txt        # Dependencies
โ””โ”€โ”€ README.md

โš™๏ธ Tech Stack

  • Python
  • FastAPI
  • Scikit-learn
  • Pandas
  • NumPy
  • TF-IDF Vectorizer
  • Cosine Similarity
  • Uvicorn
  • Ngrok (for public API testing)

โœจ Features

  • ๐Ÿ”Ž Real-time article similarity detection
  • ๐Ÿ“Š Similarity score percentage output
  • ๐Ÿšจ Duplicate threshold control (default: 0.80 / 0.85)
  • ๐Ÿงน Custom NLP cleaning pipeline
  • โšก FastAPI REST API
  • ๐ŸŒ Ngrok public endpoint support
  • ๐Ÿ“ CSV-based dataset support
  • ๐Ÿ” TF-IDF pre-trained model loading

๐Ÿ“ˆ Industry Use Cases

  • ๐Ÿ“ฐ News Agencies (duplicate detection)
  • ๐Ÿข Content Publishing Platforms
  • ๐Ÿ“š Academic Plagiarism Checking
  • ๐Ÿ›’ Product Description Similarity Check
  • ๐Ÿค– AI Content Validation Systems
  • ๐Ÿงพ Media Monitoring Systems

๐Ÿ’ผ Business Benefits

  • Prevents duplicate content publishing
  • Saves editorial review time
  • Improves content credibility
  • Maintains SEO quality
  • Scalable to millions of documents
  • Lightweight and cost-effective solution

๐Ÿ“ฑ Running the React Native App (Similify Mobile)

Similify also includes a React Native mobile application that connects to the FastAPI backend for real-time duplicate detection.


๐Ÿ› ๏ธ Prerequisites

Before running the mobile app, make sure you have installed:

  • Node.js (LTS version recommended)
  • npm or yarn
  • Android Studio (for Android development)
  • Xcode (Mac only โ€“ for iOS development)
  • React Native CLI or Expo CLI (depending on your setup)

Verify installation:

node -v
npm -v

๐Ÿ“ฆ Install Dependencies

Navigate to the mobile app directory:

cd similify-app
npm install

โ–ถ๏ธ Start Metro Bundler

npx react-native start

๐Ÿ“ฑ Run on Android

Make sure Android Emulator is running OR a physical device is connected.

npx react-native run-android

๐ŸŽ Run on iOS (Mac Only)

npx react-native run-ios

๐ŸŒ Connecting Mobile App to Backend

Update the API base URL inside your project:

const BASE_URL = "http://127.0.0.1:8000";

โš ๏ธ Important Notes

If using Android Emulator, use:

const BASE_URL = "http://10.0.2.2:8000";

If using a real physical device, use your systemโ€™s local IP address:

const BASE_URL = "http://192.168.X.X:8000";

To find your local IP:

ipconfig   # Windows
ifconfig   # macOS/Linux

๐ŸŒ Using Ngrok for Public Testing

Start backend:

uvicorn app:app --reload

Start ngrok:

ngrok http 8000

Copy the generated HTTPS URL and update:

const BASE_URL = "https://your-ngrok-url.ngrok.io";

๐Ÿงช Troubleshooting

Clear Metro Cache

npx react-native start --reset-cache

Reinstall Node Modules

rm -rf node_modules
npm install

๐Ÿš€ Backend Installation & Setup

1๏ธโƒฃ Clone Repository

git clone https://github.com/shabbir0000/Similify_Model.git

2๏ธโƒฃ Create Virtual Environment

python -m venv venv
source venv/bin/activate   # macOS/Linux
venv\Scripts\activate      # Windows

3๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

โ–ถ๏ธ Running the API

uvicorn app:app --reload

Server will start at:

http://127.0.0.1:8000

๐ŸŒ Run with Ngrok (Public URL)

Install ngrok and run:

ngrok http 8000

You will get a public HTTPS URL like:

https://abcd1234.ngrok.io

Use this URL in your frontend/mobile app.


๐Ÿ“ก API Endpoint

POST /check-duplicate

Request Body

{
  "text": "string",
  "top_n": 5
}

Response

{
  "is_duplicate": true,
  "results": [
    {
      "article_id": 101,
      "title": "Sample News Title",
      "similarity_score": 0.87,
      "url": "https://example.com"
    }
  ]
}

๐ŸŽฏ Duplicate Threshold

Default threshold: 0.80

You can modify it inside:

duplicate_threshold = 0.80

Recommended range:

  • 0.75 โ†’ Loose matching
  • 0.80 โ†’ Balanced (Recommended)
  • 0.85 โ†’ Strict duplicate detection

๐Ÿ”ฎ Future Improvements

  • Semantic similarity using Transformers (BERT)
  • Elasticsearch integration
  • MongoDB support
  • Real-time streaming comparison
  • Admin dashboard
  • Similarity heatmap visualization

๐Ÿ‘จโ€๐Ÿ’ป Author

Muhammad Shabbir
AI Engineer | NLP & AI Automation Specialist
IBM Certified AI Professional

About

Similify is an AI-powered duplicate detection system that uses NLP and TF-IDF similarity scoring to identify and prevent repeated content in real time.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages