|
@@ -14,6 +14,7 @@ from structure.three_parse_structure import *
|
|
|
from utils.pic_pos_judge import img_regroup
|
|
|
from func_timeout import func_set_timeout
|
|
|
import requests
|
|
|
+import time
|
|
|
from structure.ans_structure import get_ans_match
|
|
|
|
|
|
from utils.xuanzuoti2slave import toslave_bef, toslave_aft
|
|
@@ -37,11 +38,12 @@ class WordParseStructure:
|
|
|
self.subject = subject
|
|
|
|
|
|
def __call__(self):
|
|
|
+ t1 = time.time()
|
|
|
if self.source in ["school", "qtk"]: # "school" "xue_guan", "teacher"
|
|
|
res = self.structure_combine_DL()
|
|
|
if not res[0]:
|
|
|
return self.structure()
|
|
|
- logger.info("----【paper_id:{}】采用切题服务".format(self.wordid))
|
|
|
+ logger.info("----【paper_id:{}】采用切题服务花费时间:{}".format(self.wordid, time.time()-t1))
|
|
|
return res
|
|
|
else:
|
|
|
return self.structure()
|
|
@@ -137,7 +139,7 @@ class WordParseStructure:
|
|
|
res = list(map(one_item_structure, xyz)) # 和多进程相比,这样速度也很快
|
|
|
# pprint(res)
|
|
|
# ==========最后的清洗=========
|
|
|
- res = wash_after(res, self.subject)
|
|
|
+ res = wash_after(res, self.wordid, self.subject)
|
|
|
# 针对模型可能切错的地方纠正,放在切割模型预测中纠正了
|
|
|
# for i, one_item in enumerate(res):
|
|
|
# if i>0 and one_item['topic_num'] is None and res[i-1]['topic_num'] is not None and res[i+1]['topic_num'] is not None \
|
|
@@ -269,7 +271,7 @@ class WordParseStructure:
|
|
|
res = list(map(one_item_structure, xyz)) # 和多进程相比,这样速度也很快
|
|
|
# pprint(res)
|
|
|
# ==========最后的清洗=========
|
|
|
- res = wash_after(res)
|
|
|
+ res = wash_after(res, self.wordid, self.subject)
|
|
|
# if have_slave and not to_slave:
|
|
|
# res = list(map(toslave_aft, res))
|
|
|
# 结果返回
|