Update app.py
Browse files
app.py
CHANGED
@@ -563,7 +563,7 @@ def clean_text(text):
|
|
563 |
from collections import Counter
|
564 |
import heapq
|
565 |
|
566 |
-
def summarize_text_by_frequency(text, num_sentences=
|
567 |
sentences = text.split('\n')
|
568 |
word_freq = Counter()
|
569 |
|
@@ -585,7 +585,7 @@ def summarize_text_by_frequency(text, num_sentences=3):
|
|
585 |
|
586 |
|
587 |
|
588 |
-
def find_closest_lines(query, doc_texts, stop_words, top_n=
|
589 |
cleaned_query = remove_stop_words(query, stop_words)
|
590 |
query_words = cleaned_query.split()
|
591 |
|
@@ -619,7 +619,7 @@ if query:
|
|
619 |
clean_text(" ".join([word for word in line.split() if word not in stop_words]))
|
620 |
for line in closest_lines
|
621 |
]
|
622 |
-
summarized_text = summarize_text_by_frequency("\n".join(cleaned_closest_lines), num_sentences=
|
623 |
|
624 |
|
625 |
if summarized_text:
|
|
|
563 |
from collections import Counter
|
564 |
import heapq
|
565 |
|
566 |
+
def summarize_text_by_frequency(text, num_sentences=1):
|
567 |
sentences = text.split('\n')
|
568 |
word_freq = Counter()
|
569 |
|
|
|
585 |
|
586 |
|
587 |
|
588 |
+
def find_closest_lines(query, doc_texts, stop_words, top_n=5):
|
589 |
cleaned_query = remove_stop_words(query, stop_words)
|
590 |
query_words = cleaned_query.split()
|
591 |
|
|
|
619 |
clean_text(" ".join([word for word in line.split() if word not in stop_words]))
|
620 |
for line in closest_lines
|
621 |
]
|
622 |
+
summarized_text = summarize_text_by_frequency("\n".join(cleaned_closest_lines), num_sentences=1)
|
623 |
|
624 |
|
625 |
if summarized_text:
|