diff --git a/Plagiarism_detector/README.md b/Plagiarism_detector/README.md new file mode 100644 index 0000000..143d93b --- /dev/null +++ b/Plagiarism_detector/README.md @@ -0,0 +1,8 @@ +# Plagiarism Detector +This script helps to detect the amount (percentage) of similarity between 2 files . + +## Input +It takes paths of 2 files you want to compare as input + +## Output +It returns the percentage of similarity between the 2 files \ No newline at end of file diff --git a/Plagiarism_detector/plagiarism.py b/Plagiarism_detector/plagiarism.py new file mode 100644 index 0000000..ed096a9 --- /dev/null +++ b/Plagiarism_detector/plagiarism.py @@ -0,0 +1,13 @@ +from difflib import SequenceMatcher + +def similarity_per(f1,f2): + with open(f1,errors="ignore") as file1,open(f2,errors="ignore") as file2: + file1_data=file1.read() + file2_data=file2.read() + similarity=SequenceMatcher(None,file1_data,file2_data).ratio() + print(f"these 2 files are {similarity*100} % similar") + +if __name__ == '__main__': + f1=input("file 1 path :") + f2=input("file 2 path :") + similarity_per(f1,f2) diff --git a/README.md b/README.md index ecc14a0..4052399 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ So far, the following projects have been integrated to this repo: |[Folder Locker and hider](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Folder%20Locker%20%26%20Hider)|[Prajjwal Pathak](https://github.com/pyguru123)| |[Image Compressor](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Image_Compressor)|[Prathima Kadari](https://github.com/prathimacode-hub)| |[Test Your Internet Speed](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/TestMyInternetSpeed)|[TheSmartDeveloperr](https://github.com/thesmartdeveloperr)| +|[Plagiarism_detector](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Plagiarism_detector)|[Akshita Singhal](https://github.com/akshitasinghal4444)| ## How to use :