anlyzes update to elastic search
This commit is contained in:
@@ -31,3 +31,4 @@ yarn-error.log*
|
||||
*.sw?
|
||||
*.rar
|
||||
*.zip
|
||||
analyzed_domains.json
|
||||
|
||||
@@ -206,10 +206,13 @@ def extract_domain_words(
|
||||
final_structure = {}
|
||||
|
||||
all_code_labels = list(json_input_data.keys())
|
||||
|
||||
# برای هر عنوان اصلی
|
||||
for code_label in all_code_labels:
|
||||
|
||||
if code_label == 'سایر':
|
||||
continue
|
||||
current_words_dict = json_input_data[code_label]
|
||||
|
||||
code_label = text_normalizer.normalize_qanon(code_label)
|
||||
if not code_label in dict_domain_id:
|
||||
print( "------------ error ", item )
|
||||
@@ -218,7 +221,6 @@ def extract_domain_words(
|
||||
domain_id = dict_domain_id[code_label]
|
||||
code_label_id = domain_type + "_" + domain_id
|
||||
|
||||
current_words_dict = json_input_data[code_label]
|
||||
|
||||
|
||||
# 1. words_general — تمام کلمات این عنوان — مرتب بر اساس تکرار
|
||||
@@ -266,15 +268,17 @@ def extract_domain_words(
|
||||
list_code_words = []
|
||||
|
||||
for other_title in all_code_labels:
|
||||
if other_title == code_label:
|
||||
continue
|
||||
|
||||
|
||||
other_words = set(json_input_data[other_title].keys())
|
||||
current_words = set(current_words_dict.keys())
|
||||
|
||||
other_title = text_normalizer.normalize_qanon(other_title)
|
||||
if not other_title in dict_domain_id :
|
||||
|
||||
if (other_title == code_label) or (other_title =='سایر'):
|
||||
continue
|
||||
|
||||
|
||||
|
||||
if not (other_title in dict_domain_id):
|
||||
print( "========================= error ", other_title )
|
||||
continue
|
||||
|
||||
@@ -323,11 +327,15 @@ def extract_domain_words(
|
||||
final_structure[code_label] = data
|
||||
|
||||
eid = code_label_id
|
||||
print(f'data Created! {eid}')
|
||||
try:
|
||||
resp = elastic.update_index_doc(True, index_name_o, eid, data)
|
||||
|
||||
except Exception as e:
|
||||
pass
|
||||
import traceback
|
||||
print(traceback.print_exc())
|
||||
print(f'data NOT saved in es')
|
||||
print(f'data saved in es')
|
||||
|
||||
# ذخیره خروجی نهایی
|
||||
with open("./analyzed_domains.json", "w", encoding="utf-8") as f:
|
||||
@@ -353,4 +361,6 @@ path_base_map = "G:/Project2/gateway2_main/repo/_other/"
|
||||
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
|
||||
|
||||
final_domain_words = extract_domain_words("data/ai/corrected_sorted1.json", elastic, "mj_qa_doamin")
|
||||
final_domain_words = extract_domain_words(r"C:\Users\TAVASI-3\Desktop\init_mahdi\project\bank_words_per\data\corrected_sorted1.json", elastic, "mj_qa_domain")
|
||||
# final_domain_words = extract_domain_words("data/ai/corrected_sorted1.json", elastic, "mj_qa_doamin")
|
||||
# python -m app.for_ai.codes_tokens
|
||||
|
||||
Reference in New Issue
Block a user