Spaces:
Sleeping
Sleeping
Commit ·
7c27a96
1
Parent(s): 78e6c03
new normalizer C to Latin C + max table = 20, max chunk = 3000
Browse files- config.py +1 -1
- documents_prep.py +2 -3
- index_retriever.py +3 -3
config.py
CHANGED
|
@@ -53,7 +53,7 @@ CHUNK_SIZE = 1500
|
|
| 53 |
CHUNK_OVERLAP = 128
|
| 54 |
|
| 55 |
MAX_CHARS_TABLE = 3000
|
| 56 |
-
MAX_ROWS_TABLE =
|
| 57 |
|
| 58 |
CUSTOM_PROMPT = """
|
| 59 |
Вы являетесь высокоспециализированным Ассистентом для анализа нормативных документов (AIEXP). Ваша цель - предоставлять точные, корректные и контекстно релевантные ответы исключительно на основе предоставленного контекста из нормативной документации.
|
|
|
|
| 53 |
CHUNK_OVERLAP = 128
|
| 54 |
|
| 55 |
MAX_CHARS_TABLE = 3000
|
| 56 |
+
MAX_ROWS_TABLE = 20
|
| 57 |
|
| 58 |
CUSTOM_PROMPT = """
|
| 59 |
Вы являетесь высокоспециализированным Ассистентом для анализа нормативных документов (AIEXP). Ваша цель - предоставлять точные, корректные и контекстно релевантные ответы исключительно на основе предоставленного контекста из нормативной документации.
|
documents_prep.py
CHANGED
|
@@ -44,13 +44,12 @@ def normalize_text(text):
|
|
| 44 |
|
| 45 |
# Replace Latin 'C' with Cyrillic 'С' (U+0421)
|
| 46 |
# This is for welding types like C-25 -> С-25
|
| 47 |
-
text = text.replace('
|
| 48 |
-
text = text.replace('C ', 'С ')
|
| 49 |
|
| 50 |
# Also handle cases like "Type C" or variations
|
| 51 |
import re
|
| 52 |
# Match "C" followed by digit or space in context of welding types
|
| 53 |
-
text = re.sub(r'\
|
| 54 |
|
| 55 |
return text
|
| 56 |
|
|
|
|
| 44 |
|
| 45 |
# Replace Latin 'C' with Cyrillic 'С' (U+0421)
|
| 46 |
# This is for welding types like C-25 -> С-25
|
| 47 |
+
text = text.replace('С-', 'C')
|
|
|
|
| 48 |
|
| 49 |
# Also handle cases like "Type C" or variations
|
| 50 |
import re
|
| 51 |
# Match "C" followed by digit or space in context of welding types
|
| 52 |
+
text = re.sub(r'\bС(\d)', r'С\1', text)
|
| 53 |
|
| 54 |
return text
|
| 55 |
|
index_retriever.py
CHANGED
|
@@ -71,18 +71,18 @@ def create_query_engine(vector_index):
|
|
| 71 |
|
| 72 |
bm25_retriever = BM25Retriever.from_defaults(
|
| 73 |
docstore=vector_index.docstore,
|
| 74 |
-
similarity_top_k=
|
| 75 |
)
|
| 76 |
|
| 77 |
vector_retriever = VectorIndexRetriever(
|
| 78 |
index=vector_index,
|
| 79 |
-
similarity_top_k=
|
| 80 |
similarity_cutoff=0.45
|
| 81 |
)
|
| 82 |
|
| 83 |
hybrid_retriever = QueryFusionRetriever(
|
| 84 |
[vector_retriever, bm25_retriever],
|
| 85 |
-
similarity_top_k=
|
| 86 |
num_queries=1
|
| 87 |
)
|
| 88 |
|
|
|
|
| 71 |
|
| 72 |
bm25_retriever = BM25Retriever.from_defaults(
|
| 73 |
docstore=vector_index.docstore,
|
| 74 |
+
similarity_top_k=70
|
| 75 |
)
|
| 76 |
|
| 77 |
vector_retriever = VectorIndexRetriever(
|
| 78 |
index=vector_index,
|
| 79 |
+
similarity_top_k=70,
|
| 80 |
similarity_cutoff=0.45
|
| 81 |
)
|
| 82 |
|
| 83 |
hybrid_retriever = QueryFusionRetriever(
|
| 84 |
[vector_retriever, bm25_retriever],
|
| 85 |
+
similarity_top_k=120,
|
| 86 |
num_queries=1
|
| 87 |
)
|
| 88 |
|