embeding
This commit is contained in:
+9
-42
@@ -7,8 +7,6 @@ from general_functions import *
|
||||
from dotenv import load_dotenv
|
||||
from elastic_helper import ElasticHelper
|
||||
from create_ai_index import *
|
||||
from create_context_ai import *
|
||||
# from move_to_other import *
|
||||
|
||||
load_dotenv(dotenv_path='config.env')
|
||||
|
||||
@@ -16,8 +14,8 @@ load_dotenv(dotenv_path='config.env')
|
||||
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_60')
|
||||
# password=os.getenv('HOST_60_PASS')
|
||||
@@ -29,14 +27,6 @@ print(host)
|
||||
path_base_map = "G:/Project2/gateway2_main/repo/_other/"
|
||||
elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
|
||||
# elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section")
|
||||
#elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section_ai")
|
||||
#elastic.restorFileToElastic("G:/Project2/111", "mj_qa_section_ai", 'majles', True, "mj_qa_section")
|
||||
|
||||
#### فایده ای نداشت ....!!!
|
||||
## مسیر درختی مفید تولید نشد و عنوان قانون هم که فیلد مجزا داریم !
|
||||
# create_context_ai(elastic, "mj_qa_section" )
|
||||
|
||||
|
||||
## 1 ##-----------------------------------------------------------------
|
||||
##----- انتقال اطلاعات قبلی به اینجا
|
||||
@@ -59,50 +49,28 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
|
||||
## 3 ##-----------------------------------------------------------------
|
||||
|
||||
## محاسبات پردازش داده ای واجب و پیچیده که پایه تمیزی داده در فاز2 و 3 هست اینجا انجام می شود
|
||||
fill_nlp_tags(elastic, "mj_qa_section")
|
||||
|
||||
#fill_nlp_tags(elastic, "mj_qa_section")
|
||||
#extract_nlp_childs(elastic,"mj_qa_section")
|
||||
|
||||
## 4 ## --------------------------------------------------------------
|
||||
## پرکردن فیلدهای هوش مصنوعی برای اجزاء یا قانونهای جدید
|
||||
|
||||
##///////////////////////////////////////////////////////////
|
||||
ai_url_base=os.getenv("AI_URL_BASE")
|
||||
ai_url_vec=ai_url_base+'/vecsim/vector'
|
||||
# ai_url_class=ai_url_base+'/vec_sim/class'
|
||||
ai_url_class='http://192.168.23.51:6111/class'
|
||||
# ai_url_ner=ai_url_base+'/vec_sim/ner'
|
||||
|
||||
## 4.1 ## -----------------------------------------------------------------
|
||||
# تولید بردار برای اجزائی که لازم هست
|
||||
|
||||
# elastic.createIndex("mj_qa_section_ai", 'majles/', "mj_qa_section" )
|
||||
# import_data_embeding(elastic, ai_url_vec ,"mj_qa_section", "mj_qa_section_ai", "content" )
|
||||
|
||||
#extract_nlp_childs(elastic,"mj_qa_section")
|
||||
#elastic.createIndex("mj_qa_section_ai", 'majles/', "mj_qa_section" )
|
||||
|
||||
ai_url_vec=os.getenv("ai_url_vec")
|
||||
import_data_embeding(elastic, ai_url_vec ,"mj_qa_section", "mj_qa_section_ai", "content" )
|
||||
|
||||
|
||||
## 4.2 ## -----------------------------------------------------------------
|
||||
# برچسبهای هوشمند
|
||||
|
||||
# import_classification(elastic, ai_url_class, "mj_qa_section_temp")
|
||||
|
||||
# payload={
|
||||
# "text":"سلام علیکم"
|
||||
# }
|
||||
# response = requests.request("POST", ai_url_vec, headers=HEADERS, json=payload)
|
||||
# print(response.text)
|
||||
# print(response)
|
||||
|
||||
|
||||
# payload={
|
||||
# "text":"طرفین به منظور اتمام مطالعات و احداث نیروگاههای جریانی ارس و تأسیسات مربوطه، منطقه مشترک ساختمانی و مطالعاتی را تعیین و امنیت این منطقه را در طول مدت اجراء و بهرهبرداری تأمین مینمایند. "
|
||||
# }
|
||||
# response = requests.request("POST", ai_url_class, headers=HEADERS, json=payload)
|
||||
# print(response.text)
|
||||
# print(response)
|
||||
|
||||
# resp = json.loads(response.text)
|
||||
# print(resp['result'])
|
||||
|
||||
## 5 ## --------------------------------------------------------------
|
||||
## پشتیبان گیری از داده جدید تکمیلی
|
||||
|
||||
@@ -118,7 +86,6 @@ ai_url_class='http://192.168.23.51:6111/class'
|
||||
# elastic.backupIndexToZipfile(path_back, "mj_rg_section")
|
||||
# elastic.backupIndexToZipfile(path_back, "mj_qa_opinion")
|
||||
|
||||
|
||||
## کد نمونه بازیابی از فایل
|
||||
# path_back = 'G:/Project2/_back/back_data/data_majles/elastic/v1.0/full'
|
||||
# elastic.restorFileToElastic(path_back, 'mj_qa_section', 'majles')
|
||||
|
||||
Reference in New Issue
Block a user