ai hostorycode
This commit is contained in:
@@ -16,7 +16,7 @@ from app.common.text_normalizer import TextNormalizer
|
||||
from app.common.elastic_helper import ElasticHelper
|
||||
|
||||
|
||||
def repair_ai_codes( elastic, index_name_i, index_name_o, file_log) :
|
||||
def ai_fill_history_codes( elastic, index_name_i, index_name_o, file_log) :
|
||||
body = {}
|
||||
|
||||
try:
|
||||
@@ -172,16 +172,16 @@ def repair_ai_codes( elastic, index_name_i, index_name_o, file_log) :
|
||||
|
||||
load_dotenv(dotenv_path='config.env')
|
||||
|
||||
# host=os.getenv('HOST_160')
|
||||
# password=os.getenv('HOST_160_PASS')
|
||||
host=os.getenv('HOST_160')
|
||||
password=os.getenv('HOST_160_PASS')
|
||||
|
||||
host=os.getenv('HOST_113')
|
||||
password=os.getenv('HOST_113_PASS')
|
||||
# host=os.getenv('HOST_113')
|
||||
# password=os.getenv('HOST_113_PASS')
|
||||
|
||||
path_base_map = "G:/Project2/gateway2_main/repo/_other/"
|
||||
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
|
||||
|
||||
repair_ai_codes( elastic, "mj_qa_section", "mj_qa_section", "./output/log__ai_r1.txt")
|
||||
ai_fill_history_codes( elastic, "mj_qa_section", "mj_qa_section", "./output/log__ai_r1.txt")
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ def moveSimplifies(elastic, index_name_o, data):
|
||||
|
||||
|
||||
|
||||
def moveClassifierAiCodes(elastic, index_name_o, data, version_key = "D51_v1"):
|
||||
def copyToAiCodesHistoryCodes(elastic, index_name_o, data, version_key = "D51_v1"):
|
||||
text_normal = TextNormalizer()
|
||||
index = 0
|
||||
percent_prev = 0
|
||||
@@ -217,7 +217,7 @@ def moveClassifierAiCodes(elastic, index_name_o, data, version_key = "D51_v1"):
|
||||
print(f"last ::: send_round -> {len(list_bulk)}")
|
||||
|
||||
|
||||
def moveClassifierAiCodes2( elastic, data_codes, version_key, index_name_i, index_name_o) :
|
||||
def copyToAiCodesHistoryCodes2( elastic, data_codes, version_key, index_name_i, index_name_o) :
|
||||
body = {}
|
||||
|
||||
try:
|
||||
@@ -320,14 +320,14 @@ def moveClassifierAiCodes2( elastic, data_codes, version_key, index_name_i, inde
|
||||
load_dotenv(dotenv_path='config.env')
|
||||
|
||||
|
||||
host=os.getenv('HOST_160')
|
||||
password=os.getenv('HOST_160_PASS')
|
||||
# host=os.getenv('HOST_160')
|
||||
# password=os.getenv('HOST_160_PASS')
|
||||
|
||||
# host=os.getenv('HOST_112')
|
||||
# password=os.getenv('HOST_112_PASS')
|
||||
|
||||
# host=os.getenv('HOST_113')
|
||||
# password=os.getenv('HOST_113_PASS')
|
||||
host=os.getenv('HOST_113')
|
||||
password=os.getenv('HOST_113_PASS')
|
||||
|
||||
# host=os.getenv('HOST_60')
|
||||
# password=os.getenv('HOST_60_PASS')
|
||||
@@ -365,22 +365,69 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
# classes = json.load(f)
|
||||
|
||||
|
||||
#---#-----داده های جدید نسخه
|
||||
#with open("./data/all_sections_classes_new_140406.json", "r", encoding="utf-8") as f:
|
||||
# #---#-----داده های جدید نسخه
|
||||
# with open("./data/all_sections_classes_new_140406.json", "r", encoding="utf-8") as f:
|
||||
# classes = json.load(f)
|
||||
|
||||
# moveClassifierAiCodes(elastic,"mj_qa_section", classes, "D51_v1")
|
||||
|
||||
#---------------------------
|
||||
# copyToAiCodesHistoryCodes(elastic,"mj_qa_section", classes, "D51_v1")
|
||||
|
||||
#---------------------------
|
||||
# کدهای 49 گانه آموزش دیده با دیتاست خوب حدود15 الی 20 هزارتایی که با کمک فایلهای تبیین مفهومی و مدلهای زبانی به دست آمد
|
||||
|
||||
with open("./data/all_sections_classes_full_140407.json", "r", encoding="utf-8") as f:
|
||||
classes = json.load(f)
|
||||
# with open("./data/all_sections_classes_full_140407.json", "r", encoding="utf-8") as f:
|
||||
# classes = json.load(f)
|
||||
|
||||
|
||||
# moveClassifierAiCodes(elastic,"mj_qa_section", classes, "D49_v1")
|
||||
moveClassifierAiCodes2(elastic, classes, "D49_v1","mj_qa_section", "mj_qa_section")
|
||||
print('finished!')
|
||||
# copyToAiCodesHistoryCodes(elastic,"mj_qa_section", classes, "D49_v1")
|
||||
|
||||
#--برای سرعت بیشتر ، که چندان اثری نداشت
|
||||
# copyToAiCodesHistoryCodes2(elastic, classes, "D49_v1","mj_qa_section", "mj_qa_section")
|
||||
# print('finished!')
|
||||
|
||||
|
||||
|
||||
#--------------------------------------
|
||||
#-- دستی این مورد اجرا شد، تا اجزاءی که در مرحله جدید کدگذاری نشدند، و از قبل مواردی داشتند پاک شوند
|
||||
# POST mj_qa_section/_update_by_query
|
||||
# {
|
||||
# "query": {
|
||||
# "bool": {
|
||||
# "should": [
|
||||
# {
|
||||
# "terms": {
|
||||
# "ai_code.label": [
|
||||
# "امور زیربنایی",
|
||||
# "نظامی و انتظامی" ,
|
||||
# "کشاورزی و دامپروری",
|
||||
# "منابع طبیعی",
|
||||
# "آیین دادرسی مدنی و اداری",
|
||||
# "اطلاعات و امنیت"
|
||||
# ]
|
||||
# }
|
||||
# },
|
||||
# {
|
||||
# "terms": {
|
||||
# "ai_codes.label": [
|
||||
# "امور زیربنایی",
|
||||
# "نظامی و انتظامی" ,
|
||||
# "کشاورزی و دامپروری",
|
||||
# "منابع طبیعی",
|
||||
# "آیین دادرسی مدنی و اداری",
|
||||
# "اطلاعات و امنیت"
|
||||
# ]
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
# }
|
||||
# ,"script": {
|
||||
# "source": """
|
||||
# ctx._source.remove("ai_code");
|
||||
# ctx._source.remove("ai_codes");
|
||||
# """,
|
||||
# "lang": "painless"
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
#--------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user