File tree 3 files changed +19
-0
lines changed
BasicPythonScripts/Plagiarism Checker
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ Hello Everyone.
2
+ Welcome to Lets Grow More & Together.Our motive is to gain personal and professional skills in the area of Technological development.
3
+ The purpose is to provide a platform from where we all can deploy real world projects with along with great community.
Original file line number Diff line number Diff line change
1
+ Hello, everyone.
2
+ Welcome to Lets Grow More & Together.
3
+ Our goal is to improve personal and professional skills in the field of technological development.
4
+ The goal is to provide a platform from which we can all deploy real-world projects while also building a strong community.
Original file line number Diff line number Diff line change
1
+ # difflib module is nothing just a module in python which provides functions like comparing data btw files
2
+ # SequenceMatcher is a class in difflib which compare the sequence of characters or elements btw files as long as they are hashable
3
+ from difflib import SequenceMatcher
4
+ # open function opens the files in reading mode
5
+ with open ('Plagiarism Checker/Text Files/file1.txt' ) as file1 , open ('Plagiarism Checker/Text Files/file2.txt' ) as file2 :
6
+ file1_data = file1 .read () # Read file1 data and store that in file1_data
7
+ file2_data = file2 .read () # Read file2 data and store that in file2_data
8
+ # None,1st file,2nd file are passes as an argumnet in SequenceMatcher function and result is stored in similarity
9
+ # None is passed so that not a single element is ignored during comparison
10
+ similarity = SequenceMatcher (None ,file1_data ,file2_data ).ratio ()
11
+ # Now at last print the similarities in the form of %
12
+ print (f"\n The Similarities between files are { similarity * 100 } %\n " )
You can’t perform that action at this time.
0 commit comments