forked from SSC-ICT-Innovatie/LearningLion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
summarize.py
31 lines (27 loc) · 1.08 KB
/
summarize.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
"""
Summarization is implemented in 2 ways:
- Quick summarization (Map Reduce method)
- More extensive summariation (Refine method)
"""
from loguru import logger
# local imports
from summarize.summarizer import Summarizer
import utils
def main():
"""
Main function enabling summarization
"""
# Get source folder with docs from user
content_folder_name = input("Source folder of documents (without path): ")
# choose way of summarizing
summarization_method = input("Summarization Method [Map_Reduce, Refine]: ")
content_folder_path, vectordb_folder_path = utils.create_vectordb_name(content_folder_name)
summarizer = Summarizer(content_folder=content_folder_path,
collection_name=content_folder_name,
summary_method=summarization_method,
vectordb_folder=vectordb_folder_path)
logger.info(f"Starting summarizer with method {summarization_method}")
summarizer.summarize()
logger.info(f"{content_folder_name} successfully summarized.")
if __name__ == "__main__":
main()