Skip to content

Latest commit

ย 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Plagiarism Detection Tool

Python Version License: MIT Code style: black Contributions Welcome

A powerful Python-based plagiarism detection tool that compares text files and calculates similarity scores using advanced text analysis algorithms. Ideal for educators, content creators, and researchers who need to verify document originality.

Plagiarism Detection Demo

โœจ Features

  • Multiple Comparison Algorithms: Supports various similarity metrics including cosine similarity, Jaccard index, and Levenshtein distance
  • Batch Processing: Compare multiple documents simultaneously
  • Detailed Reports: Generate comprehensive similarity reports with highlighted matches
  • Flexible Input: Supports TXT, DOCX, PDF, and other common text formats
  • Threshold Customization: Set custom similarity thresholds for plagiarism detection
  • Fast Performance: Optimized algorithms for quick processing of large documents
  • Visual Output: Color-coded similarity scores and match visualization

๐Ÿ“‹ Table of Contents

๐Ÿš€ Installation

Prerequisites

  • Python 3.7 or higher
  • pip package manager

Install via pip

pip install plagiarism-detector

Install from source

git clone https://github.com/yourusername/plagiarism-detector.git
cd plagiarism-detector
pip install -r requirements.txt
python setup.py install

โšก Quick Start

Compare two text files:

from plagiarism_detector import PlagiarismDetector

detector = PlagiarismDetector()
result = detector.compare_files('document1.txt', 'document2.txt')

print(f"Similarity Score: {result.similarity_score}%")
print(f"Plagiarism Detected: {result.is_plagiarized}")

๐Ÿ“– Usage

Basic Comparison

from plagiarism_detector import PlagiarismDetector

# Initialize detector
detector = PlagiarismDetector(
    algorithm='cosine',
    threshold=75.0,
    ignore_case=True
)

# Compare two files
result = detector.compare_files('file1.txt', 'file2.txt')

# Access results
print(result.similarity_score)  # Similarity percentage
print(result.matched_segments)  # Specific matching text segments
print(result.report())           # Detailed report

Batch Comparison

# Compare one document against multiple documents
results = detector.compare_against_corpus(
    target_file='submission.txt',
    corpus_files=['doc1.txt', 'doc2.txt', 'doc3.txt']
)

for result in results:
    print(f"{result.file_name}: {result.similarity_score}%")

Advanced Configuration

detector = PlagiarismDetector(
    algorithm='hybrid',           # Use multiple algorithms
    threshold=70.0,               # Custom threshold
    min_match_length=50,          # Minimum words for match
    ignore_case=True,             # Case-insensitive comparison
    ignore_whitespace=True,       # Normalize whitespace
    stemming=True,                # Apply word stemming
    stop_words='english'          # Remove common words
)

Generate Report

# Generate detailed HTML report
detector.generate_report(
    results=results,
    output_file='plagiarism_report.html',
    format='html'
)

# Or JSON format
detector.generate_report(
    results=results,
    output_file='plagiarism_report.json',
    format='json'
)

โš™๏ธ Configuration

Create a config.yaml file for default settings:

algorithm: cosine
threshold: 75.0
min_match_length: 30
ignore_case: true
ignore_whitespace: true
stemming: false
stop_words: english
output_format: html

Load configuration:

detector = PlagiarismDetector.from_config('config.yaml')

๐Ÿงฎ Algorithms

Cosine Similarity

Measures the cosine of the angle between two document vectors. Best for general text comparison.

Jaccard Index

Calculates the ratio of shared words to total unique words. Effective for shorter texts.

Levenshtein Distance

Measures character-level differences. Useful for detecting minor modifications.

Hybrid Approach

Combines multiple algorithms for more accurate detection.

๐Ÿ“Š Output Format

Similarity Score

A percentage (0-100%) indicating how similar two documents are.

Match Details

{
  "similarity_score": 85.5,
  "is_plagiarized": true,
  "algorithm": "cosine",
  "matched_segments": [
    {
      "text": "matching text segment",
      "position_doc1": [100, 150],
      "position_doc2": [200, 250],
      "length": 50
    }
  ],
  "metadata": {
    "file1": "document1.txt",
    "file2": "document2.txt",
    "timestamp": "2025-01-12T10:30:00"
  }
}

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please read CONTRIBUTING.md for details on our code of conduct and development process.

๐Ÿ“ License

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

๐Ÿ™ Acknowledgments

  • Thanks to all contributors who have helped improve this tool
  • Inspired by academic integrity tools and natural language processing research
  • Built with Python and powered by NLTK and scikit-learn

๐Ÿ“ง Contact

Name - Supriya

Project Link: https://github.com/supriya-cybertech/PythonPlagiarismDetector.git

๐ŸŒŸ Star History

If you find this project useful, please consider giving it a star! โญ


Keywords: plagiarism detection, text similarity, document comparison, python, nlp, text analysis, cosine similarity, academic integrity, content verification

About

Python tool to detect plagiarism by comparing text files and calculating similarity scores.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages