Update app.py
Browse files
app.py
CHANGED
@@ -553,6 +553,11 @@ def summarize_text_with_kmeans(text, num_sentences=3):
|
|
553 |
summary = [sentences[i] for i in similar_sentences_indices]
|
554 |
return ' '.join(summary)
|
555 |
|
|
|
|
|
|
|
|
|
|
|
556 |
# تابع تمیز کردن متن
|
557 |
def clean_text(text):
|
558 |
cleaned_text = re.sub(r'[^آ-ی۰-۹0-9،.؟!؛+\-* ]+', '', text)
|
@@ -570,9 +575,6 @@ if query:
|
|
570 |
threshold = 75
|
571 |
keywords = query.split() # فرض میکنیم که query یک رشته است و کلمات کلیدی به طور پیشفرض از آن استخراج میشود
|
572 |
|
573 |
-
# خلاصهسازی متن قبل از ارسال به LLM
|
574 |
-
text_to_summarize = "\n".join(all_sentences) # تمام جملات را با هم ترکیب کنید
|
575 |
-
summarized_text = summarize_text_with_kmeans(text_to_summarize)
|
576 |
|
577 |
# استفاده از پردازش موازی برای افزایش سرعت fuzzy matching
|
578 |
max_workers = os.cpu_count()
|
|
|
553 |
summary = [sentences[i] for i in similar_sentences_indices]
|
554 |
return ' '.join(summary)
|
555 |
|
556 |
+
|
557 |
+
# خلاصهسازی متن قبل از ارسال به LLM
|
558 |
+
text_to_summarize = "\n".join(all_sentences) # تمام جملات را با هم ترکیب کنید
|
559 |
+
summarized_text = summarize_text_with_kmeans(text_to_summarize)
|
560 |
+
|
561 |
# تابع تمیز کردن متن
|
562 |
def clean_text(text):
|
563 |
cleaned_text = re.sub(r'[^آ-ی۰-۹0-9،.؟!؛+\-* ]+', '', text)
|
|
|
575 |
threshold = 75
|
576 |
keywords = query.split() # فرض میکنیم که query یک رشته است و کلمات کلیدی به طور پیشفرض از آن استخراج میشود
|
577 |
|
|
|
|
|
|
|
578 |
|
579 |
# استفاده از پردازش موازی برای افزایش سرعت fuzzy matching
|
580 |
max_workers = os.cpu_count()
|