Spaces:
Paused
Paused
normalize steel
Browse files
utils.py
CHANGED
|
@@ -195,19 +195,24 @@ def debug_search_tables(vector_index, search_term="С-25"):
|
|
| 195 |
|
| 196 |
return matching
|
| 197 |
|
| 198 |
-
from documents_prep import normalize_text
|
| 199 |
|
| 200 |
def answer_question(question, query_engine, reranker, current_model, chunks_df=None, rerank_top_k=20):
|
|
|
|
| 201 |
normalized_question = normalize_text(question)
|
|
|
|
|
|
|
|
|
|
| 202 |
|
| 203 |
if query_engine is None:
|
| 204 |
return "<div style='background-color: #e53e3e; color: white; padding: 20px; border-radius: 10px;'>Система не инициализирована</div>", "", ""
|
| 205 |
|
| 206 |
try:
|
| 207 |
start_time = time.time()
|
| 208 |
-
retrieved_nodes = query_engine.retriever.retrieve(
|
| 209 |
log_message(f"user query: {question}")
|
| 210 |
log_message(f"normalized query: {normalized_question}")
|
|
|
|
| 211 |
|
| 212 |
log_message(f"RETRIEVED: {len(retrieved_nodes)} nodes")
|
| 213 |
|
|
|
|
| 195 |
|
| 196 |
return matching
|
| 197 |
|
| 198 |
+
from documents_prep import normalize_text, normalize_steel_designations
|
| 199 |
|
| 200 |
def answer_question(question, query_engine, reranker, current_model, chunks_df=None, rerank_top_k=20):
|
| 201 |
+
|
| 202 |
normalized_question = normalize_text(question)
|
| 203 |
+
log_message(f"Normalized question: {normalized_question}")
|
| 204 |
+
normalized_question_2 = normalize_steel_designations(normalized_question)
|
| 205 |
+
log_message(f"After steel normalization: {normalized_question_2}")
|
| 206 |
|
| 207 |
if query_engine is None:
|
| 208 |
return "<div style='background-color: #e53e3e; color: white; padding: 20px; border-radius: 10px;'>Система не инициализирована</div>", "", ""
|
| 209 |
|
| 210 |
try:
|
| 211 |
start_time = time.time()
|
| 212 |
+
retrieved_nodes = query_engine.retriever.retrieve(normalized_question_2)
|
| 213 |
log_message(f"user query: {question}")
|
| 214 |
log_message(f"normalized query: {normalized_question}")
|
| 215 |
+
log_message(f"after steel normalization: {normalized_question_2}")
|
| 216 |
|
| 217 |
log_message(f"RETRIEVED: {len(retrieved_nodes)} nodes")
|
| 218 |
|