-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (30 loc) · 672 Bytes
/
main.py
File metadata and controls
44 lines (30 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from src.preprocess import clean_text
from src.similarity import calculate_similarity
from src.report import generate_report
def read_file(path):
with open(path, "r", encoding="utf-8") as file:
return file.read()
original = read_file(
"documents/original.txt"
)
submitted = read_file(
"documents/submitted.txt"
)
original = clean_text(original)
submitted = clean_text(submitted)
score, matches = calculate_similarity(
original,
submitted
)
report = generate_report(
score,
matches
)
print(report)
with open(
"reports/report.txt",
"w",
encoding="utf-8"
) as file:
file.write(report)
print("\nReport Saved.")