From d3fff825de9bdbdcc11a16383e907129fc906100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Fri, 26 Aug 2022 10:08:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B51?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/jianli.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/utils/jianli.py b/utils/jianli.py index 7dbe506..478fe7e 100644 --- a/utils/jianli.py +++ b/utils/jianli.py @@ -118,6 +118,7 @@ def chkworlkandtime(listdata): 'duty': duty } ress.append(str(date)) + return ress @@ -337,7 +338,7 @@ def get_date(schema, dates, schema_dict): work_exp = date['work_exp'] if not work_exp: - date['work_exp'] = 0 + work_exp = 0 # 工作经验float转化 if work_exp and isinstance(work_exp, str): true_work_exp = re.search(r"\d+\.?\d*", work_exp) @@ -345,7 +346,8 @@ def get_date(schema, dates, schema_dict): work_exp = 0 else: work_exp = float(true_work_exp.group()) - + if work_exp <= 0: + date['work_exp'] = 0 if 1 <= work_exp < 3: date['work_exp'] = 1 if 3 <= work_exp < 5: @@ -576,7 +578,6 @@ def fmtList(txtlist, dates): if ischk: continue # 取出工作经验里面的公司名和时间 - work_list = [] if len(work) > 0: works = '' for i in work: @@ -585,10 +586,11 @@ def fmtList(txtlist, dates): ie = Taskflow('information_extraction', schema=schema) text_lists = ie(works) work_list = chkworlkandtime(text_lists) + if not work_list: + work_list = ["{'company_name ': '测试公司','position_name': '测试职位','duty': '测试职责'}"] else: - work_list = ["{'company_name ': '','position_name': '','duty': ''}"] + work_list = ["{'company_name ': '测试公司','position_name': '测试职位','duty': '测试职责'}"] # 取出获奖经历里面的公司名和时间 - remembrance_list = [] if len(remembrance) > 0: remembrances = '' for i in remembrance: @@ -597,10 +599,11 @@ def fmtList(txtlist, dates): ie = Taskflow('information_extraction', schema=schema) text_lists = ie(remembrances) remembrance_list = chkworlkandtime2(text_lists) + if not remembrance_list: + remembrance_list = ["{'prize_name ': '测试奖项', 'prize_time': '2022-08-26'}"] else: - remembrance_list = ["{'prize_name ': '', 'prize_time': '', }"] + remembrance_list = ["{'prize_name ': '测试奖项', 'prize_time': '2022-08-26'}"] # 取出语言能力里面的语言,掌握程度,听说,读写 - language_list = [] if len(language) > 0: works = '' for i in work: @@ -609,8 +612,10 @@ def fmtList(txtlist, dates): ie = Taskflow('information_extraction', schema=schema) text_lists = ie(works) language_list = chkworlkandtime1(text_lists) + if not language_list: + language_list = ["{'language_name ': '测试语言', 'has_sleep ': '好', 'reading': '听说', 'writing': '读写'}"] else: - language_list = ["{'language_name ': '', 'has_sleep ': '', 'reading': '', 'writing': ''}"] + language_list = ["{'language_name ': '测试语言', 'has_sleep ': '好', 'reading': '听说', 'writing': '读写'}"] # review自我评价, project项目经验,work工作经验,work具体工作的公司和时间,upgrade教育经历,specialty技能特长 dates.update({ 'review': review,