This commit is contained in:
hsafaei
2025-09-17 14:53:16 +03:30
parent 3fe8ec8588
commit a507fff651
3 changed files with 56 additions and 48 deletions
+1
View File
@@ -6,6 +6,7 @@ node_modules
data_back/
data/
output/
__pycache__/
# local env files
config.env
+12 -10
View File
@@ -10,14 +10,13 @@ class Normalizer():
def __init__(self,
half_space_char='\u200c',
date_normalizing_needed=False,
pinglish_conversion_needed=False,
train_file_path="resource/tokenizer/Bijan_khan_chunk.txt",
token_merger_path="resource/tokenizer/TokenMerger.pckl"):
self.dir_path = os.path.dirname(os.path.realpath(__file__)) + "/"
pinglish_conversion_needed=False):
self.dic1_path = self.dir_path + 'resource/normalizer/Dic1_new.txt'
self.dic2_path = self.dir_path + 'resource/normalizer/Dic2_new.txt'
self.dic3_path = self.dir_path + 'resource/normalizer/Dic3_new.txt'
self.resource_path = os.path.dirname(os.path.realpath(__file__)) + "/../"
self.dic1_path = self.resource_path + 'resource/normalizer/Dic1_new.txt'
self.dic2_path = self.resource_path + 'resource/normalizer/Dic2_new.txt'
self.dic3_path = self.resource_path + 'resource/normalizer/Dic3_new.txt'
self.dic1 = self.load_dictionary(self.dic1_path)
self.dic2 = self.load_dictionary(self.dic2_path)
self.dic3 = self.load_dictionary(self.dic3_path)
@@ -1091,12 +1090,15 @@ class DateNormalizer():
class PinglishNormalizer():
def __init__(self):
self.data_helper = DataHelper()
self.file_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
self.en_dict_filename = self.file_dir + "resource/tokenizer/enDict"
# self.resource_path = os.path.dirname(os.path.realpath(__file__)) + "/"
self.resource_path = os.path.dirname(os.path.realpath(__file__)) + "/../"
self.en_dict_filename = self.resource_path + "resource/tokenizer/enDict"
self.en_dict = self.data_helper.load_var(self.en_dict_filename)
self.fa_dict_filename = self.file_dir + "resource/tokenizer/faDict"
self.fa_dict_filename = self.resource_path + "resource/tokenizer/faDict"
self.fa_dict = self.data_helper.load_var(self.fa_dict_filename)
+41 -36
View File
@@ -4,17 +4,17 @@ from common.text_normalizer import TextNormalizer
# from general import *
from common.general_functions import *
from common.elastic_helper import ElasticHelper
from create_relation_tags import *
from for_ai.create_relation_tags import *
from temp_refactor_gn_dataset import *
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_112')
password=os.getenv('HOST_112_PASS')
# host=os.getenv('HOST_118')
# password=os.getenv('HOST_118_PASS')
@@ -41,9 +41,14 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
# elastic.backupIndexToZipfile("G:/Project2/111/haditha", "dh_volume")
# elastic.backupIndexToZipfile("G:/Project2/111/haditha", "dh_haditha")
# elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_domain")
# elastic.createIndex( 'mj_qa_domain', 'majles', 'mj_domain')
# elastic.restorFileToElastic2('G:/Project2/111/mj_qa_domain.zip', 'mj_qa_domain', 'majles', False, 'mj_domain')
# elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section-m1")
elastic.createIndex( 'mj_qa_section-m1', 'majles', 'mj_qa_section')
elastic.restorFileToElastic2('G:/Project2/111/server112/mj_qa_section-m1.zip', 'mj_qa_section-m1', 'majles', False, 'mj_qa_section')
# elastic.createIndex( 'mj_qa_section-m1', 'majles', 'mj_qa_section')
# elastic.restorFileToElastic2('G:/Project2/111/server112/mj_qa_section-m1.zip', 'mj_qa_section-m1', 'majles', False, 'mj_qa_section')
# elastic.backupIndexToZipfile("G:/Project2/111", "gn_calendar")
#elastic.createIndex( 'gn_calendar', 'general', 'gn_calendar')
@@ -150,35 +155,35 @@ path_back = 'G:/Project2/111/server112/'
# elastic.restorFileToElastic2('G:/Project2/111/mj_qa_section_2_majles_repair.zip', 'mj_qa_section', 'majles', False, 'mj_qa_section')
body= {
"query": {
"terms": {
"qanon_id": [
"qq83354",
"qq83382",
"qq112748",
"qq112296",
"qq83435",
"qq114127",
"qq175888",
"qq85335",
"qq84208",
"qq114652",
"qq114640"
]
}
},
"sort": [
{
"qanon_id": {
"order": "asc"
},
"child_order": {
"order": "asc"
}
}
]
}
# body= {
# "query": {
# "terms": {
# "qanon_id": [
# "qq83354",
# "qq83382",
# "qq112748",
# "qq112296",
# "qq83435",
# "qq114127",
# "qq175888",
# "qq85335",
# "qq84208",
# "qq114652",
# "qq114640"
# ]
# }
# },
# "sort": [
# {
# "qanon_id": {
# "order": "asc"
# },
# "child_order": {
# "order": "asc"
# }
# }
# ]
# }
#elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section", "mj_qa_section_Aab", body, False, ["content", "simplifies", "tcode_sub_old", "tcode_main_old", "code-ai", "ai_keywords"])