简历解析兼容

This commit is contained in:
Àî×ÚÕñ 2022-10-09 15:14:28 +08:00
parent bd8d5d3953
commit 14c6136567

View File

@ -617,42 +617,76 @@ def fmt_txt(chk_str):
index2 = -1 index2 = -1
name2 = '' name2 = ''
new_str_list1 = [] new_str_list1 = []
for index, i in enumerate(project_list): if '-至今' in project_undergo2:
if index <= index2: for index, i in enumerate(project_list):
continue if index <= index2:
if not i: continue
continue if not i:
if i.strip() in ['-', '', '', '']: continue
index2 = index + 2 if i.strip().startswith('-'):
if not name2: if i.strip() == '-':
name3 = project_list[index + 2].split('\n')[-1] index2 = index + 2
new_str = project_list[index - 2] + project_list[index - 1] + i + project_list[ name3 = project_list[index + 2].split('\n')[-1]
index + 1] + \ if not name2:
project_list[index + 2].split(name3)[0] new_str = project_list[index - 2] + project_list[index - 1] + i + project_list[
name2 = name3 index + 1] + \
else: project_list[index + 2].split(name3)[0]
name3 = project_list[index + 2].split('\n')[-1] name2 = name3
if name2: else:
new_str = name2 + project_list[index - 1] + i + project_list[index + 1] + \ new_str = name2 + project_list[index - 1] + i + project_list[index + 1] + \
project_list[index + 2].split(name3)[0] project_list[index + 2]
name2 = name3
new_str_list1.append(new_str)
else: else:
new_str = name2 + project_list[index - 1] + i + project_list[index + 1] + \ name3 = i.split('\n')[-1]
project_list[index + 2] if not name2:
name2 = name3 index2 = index
new_str_list1.append(new_str) new_str = project_list[index - 2] + project_list[index - 1] + i.split(name3)[0]
continue name2 = name3
if i.strip() not in ['-', '', '', ''] and ('-' in i or '' in i or '' in i or '' in i): else:
index2 = index new_str = name2 + project_list[index - 1] + i.split(name3)[0]
if not name2: name2 = name3
name3 = i.split('\n')[-1] new_str_list1.append(new_str)
new_str = str_2[index - 2] + str_2[index - 1] + i.split(name3)[0] else:
name2 = name3 for index, i in enumerate(project_list):
else: if index <= index2:
name3 = i.split('\n')[-1] continue
new_str = str_2[index - 2] + str_2[index - 1] + i.split(name3)[0] if not i:
name2 = name3 continue
new_str_list1.append(new_str) if i.strip() in ['-', '', '', '']:
continue index2 = index + 2
if not name2:
name3 = project_list[index + 2].split('\n')[-1]
new_str = project_list[index - 2] + project_list[index - 1] + i + project_list[
index + 1] + \
project_list[index + 2].split(name3)[0]
name2 = name3
else:
name3 = project_list[index + 2].split('\n')[-1]
if name2:
new_str = name2 + project_list[index - 1] + i + project_list[index + 1] + \
project_list[index + 2].split(name3)[0]
else:
new_str = name2 + project_list[index - 1] + i + project_list[index + 1] + \
project_list[index + 2]
name2 = name3
new_str_list1.append(new_str)
continue
if i.strip() not in ['-', '', '', ''] and ('-' in i or '' in i or '' in i or '' in i):
index2 = index
if not name2:
name3 = i.split('\n')[-1]
new_str = str_2[index - 2] + str_2[index - 1] + i.split(name3)[0]
name2 = name3
else:
name3 = i.split('\n')[-1]
if (index - 1) >= len(str_2):
new_str = str_2[index - 2] + i.split(name3)[0]
else:
new_str = str_2[index - 2] + str_2[index - 1] + i.split(name3)[0]
name2 = name3
new_str_list1.append(new_str)
continue
if new_str_list1: if new_str_list1:
for project_str in new_str_list1: for project_str in new_str_list1:
project_name_time_str = project_str.split('\n')[0] project_name_time_str = project_str.split('\n')[0]
@ -675,9 +709,13 @@ def fmt_txt(chk_str):
dict_project['work'] = project_name_time_str2[index + 1].split(' ')[-1] dict_project['work'] = project_name_time_str2[index + 1].split(' ')[-1]
break break
else: else:
dict_project['time'] = ( if index + 2 >= len(project_name_time_str2):
p_str + project_name_time_str2[index + 1] + project_name_time_str2[ dict_project['time'] = (
index + 2]).replace('.', '/') p_str + project_name_time_str2[index + 1]).replace('.', '/')
else:
dict_project['time'] = (p_str + project_name_time_str2[index + 1] +
project_name_time_str2[index + 2]).replace('.',
'/')
dict_project['name'] = project_name_time_str2[index - 1] dict_project['name'] = project_name_time_str2[index - 1]
if index + 3 <= len(project_name_time_str2): if index + 3 <= len(project_name_time_str2):
dict_project['work'] = project_name_time_str2[index + 3] dict_project['work'] = project_name_time_str2[index + 3]
@ -835,6 +873,8 @@ def fmt_txt(chk_str):
name1 = str_2[index + 2].strip().strip('\n').split('\n')[-1] name1 = str_2[index + 2].strip().strip('\n').split('\n')[-1]
if str_2[index + 2].strip().endswith('') or str_2[index + 2].strip().endswith(':'): if str_2[index + 2].strip().endswith('') or str_2[index + 2].strip().endswith(':'):
name1 = str_2[index + 2].split('\n')[-2] name1 = str_2[index + 2].split('\n')[-2]
if not name1:
name1 = str_2[index + 2].split(' ')[0]
new_str = str_2[index - 2] + str_2[index - 1] + i + str_2[index + 1] + \ new_str = str_2[index - 2] + str_2[index - 1] + i + str_2[index + 1] + \
str_2[index + 2].split(name1)[0] str_2[index + 2].split(name1)[0]
name = name1 name = name1
@ -2508,4 +2548,4 @@ egreat海尔MeleA20MeleA31LG1154极米杰科亿典等机顶
""" """
fmt_txt(chk_str3) fmt_txt(chk_str12)