Browse Source

modified: resume_parse.py

sprivacy 3 years ago
parent
commit
aef841b4ee
1 changed files with 16 additions and 0 deletions
  1. 16 0
      tools/resume_parse.py

+ 16 - 0
tools/resume_parse.py

@@ -102,6 +102,22 @@ def get_base_info(lines):
     logging.info(lines)
     data = " ".join(lines)
     rst = base_info_ie(data)[0]
+    if rst.get("出生日期"):
+        dates = re.findall(r'\d+' ,rst["出生日期"][0]["text"])
+        if len(dates) == 1:
+            rst["出生日期"][0]["text"] = "{:4d}年01月".format(int(dates[0]))
+        elif len(dates) == 2:
+            rst["出生日期"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+        elif len(dates) == 3:
+            rst["出生日期"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+    if rst.get("参加工作时间"):
+        dates = re.findall(r'\d+' ,rst["参加工作时间"][0]["text"])
+        if len(dates) == 1:
+            rst["参加工作时间"][0]["text"] = "{:4d}年01月".format(int(dates[0]))
+        elif len(dates) == 2:
+            rst["参加工作时间"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+        elif len(dates) == 3:
+            rst["参加工作时间"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
     return {key:rst[key][0]["text"] for key in rst.keys()}