This commit is contained in:
hsafaei
2025-06-09 18:23:48 +03:30
parent 53764fd4ef
commit 34dae25ba6
+45 -3
View File
@@ -132,6 +132,43 @@ def moveSimplifies(elastic, index_name_o, data):
def moveClassifierAiCodes(elastic, index_name_o, data):
text_normal = TextNormalizer()
index = 0
percent_prev = 0
list_bulk=[]
for item in data:
index += 1
# percent = int((index / len(data)) * 100)
# if percent != percent_prev:
# print("progress -> %.2f %%" % percent)
# percent_prev = percent
id = item['id']
other_codes = item['other-codes']
best_codes = item['best_codes']
ai_codes = []
ai_code = {}
list_bulk.append({
'_id': id,
'_source': {
"ai_code" : ai_code,
"ai_codes" : ai_codes
}
})
if len(list_bulk) > 200 :
elastic.updateBulkList(list_bulk, index_name_o)
list_bulk = []
if len(list_bulk) :
elastic.updateBulkList(list_bulk, index_name_o)
@@ -161,8 +198,13 @@ path_base_map = "G:/Project2/gateway2_main/repo/_other/"
elastic = ElasticHelper(host, password, "elastic", path_base_map)
moveKeywords(elastic,"mj_qa_section", "data/sections_kw_llama8b_170k_concatenated.json")
moveKeywords(elastic,"mj_qa_section", "data/sections_kw_llama8b_40k_concatenated.json")
# moveKeywords(elastic,"mj_qa_section", "data/sections_kw_llama8b_170k_concatenated.json")
# moveKeywords(elastic,"mj_qa_section", "data/sections_kw_llama8b_40k_concatenated.json")
moveZipSimplifies(elastic,"mj_qa_section", "G:\Work\_majles\_data\simpilified_final.zip")
# moveZipSimplifies(elastic,"mj_qa_section", "G:\Work\_majles\_data\simpilified_final.zip")
moveClassifierAiCodes(elastic,"mj_qa_section", [])