-
Notifications
You must be signed in to change notification settings - Fork 501
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (20 loc) · 660 Bytes
/
main.py
File metadata and controls
28 lines (20 loc) · 660 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
#!/usr/bin/env python
# coding: utf-8
# Import from summary_make.py
from summary_make import summarize_sentences
def main():
"""
Main function, wrapper around summary_make
"""
filepath = input("Enter the Source File: ")
with open(filepath, encoding="utf-8") as f:
sentences = f.readlines()
sentences = " ".join(sentences)
summary = summarize_sentences(sentences)
filepath_index = filepath.find(".txt")
outputpath = filepath[:filepath_index] + "_lexRank.txt"
with open(outputpath, "w") as w:
for sentence in summary:
w.write(str(sentence) + "\n")
if __name__ == "__main__":
main()