46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
import os
|
|
from text_normalizer import TextNormalizer
|
|
# from general import *
|
|
from general_functions import *
|
|
from elastic_helper import ElasticHelper
|
|
|
|
|
|
|
|
def moveDataset1(elastic, file, index_name_o):
|
|
try:
|
|
try:
|
|
list = elastic.iterateJsonFile(file)
|
|
except Exception as e:
|
|
save_error(0, e)
|
|
|
|
count = 0
|
|
text_normal = TextNormalizer()
|
|
|
|
for mentry in list:
|
|
count += 1
|
|
#print(mentry)
|
|
|
|
entry = mentry["source"]
|
|
id = entry.get("id", "")
|
|
domain = entry.get("domain", "")
|
|
|
|
if domain == 'تغییرات قانون':
|
|
continue
|
|
|
|
#"value":"استخراج کلیدواژه 11 هزارتایی"
|
|
|
|
print(id)
|
|
#print(entry["content"])
|
|
|
|
# data = {}
|
|
# # data["chunk_keywords"]= chunk_keywords
|
|
# update = False
|
|
# eid = id
|
|
# try:
|
|
# resp = elastic.update_index_doc(update, index_name_o, eid, data)
|
|
|
|
# except Exception as e:
|
|
# save_error(id, e)
|
|
|
|
except Exception as e:
|
|
save_error(id, e) |