|
|
@ -42,6 +42,7 @@ pantten_biaoti_1 = '^第[一二三四五六七八九]章\s{0,}?[\u4e00-\u9fa5a-z |
|
|
|
pantten_biaoti_2 = '^[0-9.]+\s{0,}?[\u4e00-\u9fa5a-zA-Z]+' |
|
|
|
pantten_biaoti_3 = '^[((][1-9一二三四五六七八九ⅠⅡⅢⅣⅤⅥⅦⅧⅨ][)_)][、.]{0,}?\s{0,}?[\u4e00-\u9fa5a-zA-Z]+' |
|
|
|
|
|
|
|
|
|
|
|
def get_host_ip(): |
|
|
|
""" |
|
|
|
查询本机ip地址 |
|
|
@ -56,8 +57,8 @@ def get_host_ip(): |
|
|
|
|
|
|
|
return ip |
|
|
|
|
|
|
|
chatgpt_url_predict = "http://{}:12000/predict".format(str(get_host_ip())) |
|
|
|
chatgpt_url_search = "http://{}:12000/search".format(str(get_host_ip())) |
|
|
|
chatgpt_url_predict = "http://{}:12001/predict".format(str(get_host_ip())) |
|
|
|
chatgpt_url_search = "http://{}:12001/search".format(str(get_host_ip())) |
|
|
|
|
|
|
|
|
|
|
|
def smtp_f(name): |
|
|
@ -275,13 +276,13 @@ def get_multiple_urls(urls): |
|
|
|
|
|
|
|
for i in urls: |
|
|
|
input_values.append(i[1]) |
|
|
|
with concurrent.futures.ThreadPoolExecutor() as executor: |
|
|
|
with concurrent.futures.ThreadPoolExecutor(100) as executor: |
|
|
|
# 使用map方法并发地调用worker_function |
|
|
|
results = list(executor.map(request_api_chatgpt, input_values)) |
|
|
|
results_1 = list(executor.map(request_api_chatgpt, input_values)) |
|
|
|
|
|
|
|
with concurrent.futures.ThreadPoolExecutor() as executor: |
|
|
|
with concurrent.futures.ThreadPoolExecutor(100) as executor: |
|
|
|
# 使用map方法并发地调用worker_function |
|
|
|
results = list(executor.map(uuid_search_mp, [results])) |
|
|
|
results = list(executor.map(uuid_search_mp, [results_1])) |
|
|
|
|
|
|
|
return_list = [] |
|
|
|
for i,j in zip(urls, results[0]): |
|
|
@ -457,6 +458,9 @@ def post_sentence_ulit(sentence, text_info): |
|
|
|
sentence = text_info[0] |
|
|
|
return sentence |
|
|
|
|
|
|
|
def has_chinese(s): |
|
|
|
return bool(re.search('[\u4e00-\u9fa5]', s)) |
|
|
|
|
|
|
|
|
|
|
|
def pre_sentence_ulit(sentence): |
|
|
|
''' |
|
|
@ -466,6 +470,8 @@ def pre_sentence_ulit(sentence): |
|
|
|
''' |
|
|
|
sentence = str(sentence).strip() |
|
|
|
if_change = True |
|
|
|
|
|
|
|
# 判断句子长度 |
|
|
|
if len(sentence) > 9: |
|
|
|
|
|
|
|
if sentence[-1] != "。": |
|
|
@ -478,6 +484,7 @@ def pre_sentence_ulit(sentence): |
|
|
|
if_change = False |
|
|
|
return text, if_change |
|
|
|
|
|
|
|
# 判断标题 |
|
|
|
result_biaoti_list_0 = re.findall(pantten_biaoti_0, sentence) |
|
|
|
result_biaoti_list_1 = re.findall(pantten_biaoti_1, sentence) |
|
|
|
result_biaoti_list_2 = re.findall(pantten_biaoti_2, sentence) |
|
|
@ -487,6 +494,11 @@ def pre_sentence_ulit(sentence): |
|
|
|
if_change = False |
|
|
|
return text, if_change |
|
|
|
|
|
|
|
# 判断是否去全英文 |
|
|
|
if has_chinese(sentence) == False: |
|
|
|
if_change = False |
|
|
|
return text, if_change |
|
|
|
|
|
|
|
return text, if_change |
|
|
|
|
|
|
|
|
|
|
|