Update app.py
Browse files
app.py
CHANGED
|
@@ -539,8 +539,8 @@ def load_and_process_documents(path):
|
|
| 539 |
|
| 540 |
doc_texts = load_and_process_documents(folder_path)
|
| 541 |
|
| 542 |
-
with open(
|
| 543 |
-
stop_words = set(
|
| 544 |
|
| 545 |
def remove_stop_words(text, stop_words):
|
| 546 |
words = text.split()
|
|
@@ -619,6 +619,10 @@ if query:
|
|
| 619 |
for line in closest_lines
|
| 620 |
]
|
| 621 |
summarized_text = summarize_text_by_frequency("\n".join(cleaned_closest_lines), num_sentences=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
|
| 623 |
|
| 624 |
if summarized_text:
|
|
|
|
| 539 |
|
| 540 |
doc_texts = load_and_process_documents(folder_path)
|
| 541 |
|
| 542 |
+
with open("stopwords.txt", "r", encoding="utf-8") as f:
|
| 543 |
+
stop_words = set(line.strip() for line in f if line.strip())
|
| 544 |
|
| 545 |
def remove_stop_words(text, stop_words):
|
| 546 |
words = text.split()
|
|
|
|
| 619 |
for line in closest_lines
|
| 620 |
]
|
| 621 |
summarized_text = summarize_text_by_frequency("\n".join(cleaned_closest_lines), num_sentences=1)
|
| 622 |
+
summarized_cleaned = " ".join([
|
| 623 |
+
word for word in summarized_text.split()
|
| 624 |
+
if word not in stop_words
|
| 625 |
+
])
|
| 626 |
|
| 627 |
|
| 628 |
if summarized_text:
|