This project is a web-based Plagiarism Detector application built with Python, Flask, and D3.js. It allows users to upload multiple documents (.docx or .pdf) and analyzes them to detect similarities using the Jaccard Similarity algorithm. The application also visualizes the relationships between documents using an interactive sociogram.
- Multi-Format Support: Upload and analyze both Word documents (
.docx) and PDF files (.pdf). - Text Extraction: Efficiently extracts text from uploaded documents using
python-docxandPyMuPDF. - Shingling & Hashing: Implements shingling (n-grams) and hashing for effective similarity detection.
- Similarity Calculation: Computes Jaccard Similarity between all pairs of uploaded documents.
- Similarity Filtering: Highlights document pairs with high similarity (>80%).
- Interactive Visualization: Displays a sociogram (network graph) of document similarities using D3.js.
- User-Friendly Interface: Clean and intuitive web interface for uploading files and viewing results.
- Backend: Python, Flask
- Frontend: HTML5, CSS3, JavaScript (D3.js)
- Libraries:
Flask(Web Framework)python-docx(DOCX parsing)PyMuPDF(PDF parsing)itertools(Data processing)hashlib(Hashing)
Plagiarism-Detector/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── static/ # Static files (CSS, JS, images)
│ └── styles.css
├── templates/ # HTML templates
│ ├── index.html # Main upload page
│ └── sociogram.html # Visualization page
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/yourusername/Plagiarism-Detector.git cd Plagiarism-Detector -
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Access the web interface: Open your web browser and go to
http://127.0.0.1:5000/. -
Check for Plagiarism:
- Click on "Select Documents" to choose multiple
.docxor.pdffiles. - Click "Upload Files" to start the analysis.
- View the "High Similarity Results" table for document pairs with similarity > 80%.
- Click on "Select Documents" to choose multiple
-
View Sociogram:
- Click the "View Sociogram" button to see a visual representation of the document relationships.
- Hover over nodes to highlight connections and view similarity percentages.
- Preprocessing: The application reads the text content from the uploaded files.
- Shingling: The text is broken down into small overlapping sequences of words called "shingles" (size 5).
- Hashing: Each shingle is hashed using SHA-256 to create a unique fingerprint.
- Comparison: The set of hashed shingles from each document is compared against every other document using the Jaccard Similarity coefficient. $$ J(A, B) = \frac{|A \cap B|}{|A \cup B|} $$
- Result: The similarity score (percentage) indicates the degree of overlap between the documents.
This project is licensed under the MIT License.