-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
52 lines (43 loc) · 1.83 KB
/
main.py
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
45
46
47
48
49
50
51
52
def main():
prompt_string = ("Choose the type of document you'd like to summarize.\n"
"Type 1 for plain text files.\n"
"Type 2 for Word documents (.doc or .docx).\n"
"Type 3 for PDF files.\n"
"Type 4 for images (.jpg or .png).\n"
"Type 5 for HTML websites.\n")
print(prompt_string)
choice = input("Enter your choice here: ")
if choice == "1":
file_path = input("Enter the relative path of the text file: ")
from inputs.text_parser import Text_Parser
my_parser = Text_Parser(file_path)
parsed_text = my_parser.parse()
elif choice == "2":
file_path = input("Enter the relative path of the Word document: ")
from inputs.docx_parser import Docx_Parser
my_parser = Docx_Parser(file_path)
parsed_text = my_parser.parse()
elif choice == "3":
file_path = input("Enter the relative path of the PDF file: ")
from inputs.pdf_parser import Pdf_Parser
my_parser = Pdf_Parser(file_path)
parsed_text = my_parser.parse()
elif choice == "4":
file_path = input("Enter the relative path of the image file: ")
from inputs.image_parser import Image_Parser
my_parser = Image_Parser(file_path)
parsed_text = my_parser.parse()
elif choice == "5":
url = input("Enter the URL of the website: ")
from inputs.html_parser import Html_Parser
my_parser = Html_Parser(url)
parsed_text = my_parser.parse()
else:
print("That is not a valid choice. Exiting...")
return
from summarizer.summarizer import Summarizer
my_summarizer = Summarizer(parsed_text)
print("Below is a summary of the document:")
print(my_summarizer.summarize())
if __name__ == "__main__":
main()