博客
关于我
一个薪资double的捷径:自动化简历内推工具
阅读量:557 次
发布时间:2019-03-09

本文共 2686 字,大约阅读时间需要 8 分钟。

最近,我在处理简历时遇到了一个问题:大量简历需要手动打开文件并复制姓名、邮箱、电话号码、学历等关键信息,效率极低且部分文件无法直接复制。这促使我开发了一个文件阅读工具脚本,支持文件格式包括docdocxpdf

通过脚本,我们可以自动匹配各种简历文件格式并解析出用户名、邮箱、电话号码、学历等关键信息。随后,可以调用企业微信,使用正则过滤简历并通过request一键内推到企微。

目前实现的功能包括:

  • 提取简历文本:将目标文件路径传入脚本并输出解析结果。
  • 支持多种文件格式:自动识别并处理docdocxpdf文件。

环境要求:

  • Python 3.6+,在mac环境下开发(docdocx采用mac格式,windows用户只需导入win32包即可)。

具体实现步骤如下:

1. 导入所需包

import os, sys  from docx import Document  from pdfminer.pdfparser import PDFParser  from pdfminer.pdfdocument import PDFDocument  from pdfminer.pdfpage import PDFPage  from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter  from pdfminer.layout import LAParams  from pdfminer.converter import PDFPageAggregator

2. 读取文件

def get_files(path):      files = []      for filename in os.listdir(path):          # 去除临时文件和重复文件          if os.path.isfile(os.path.join(path, filename)) and '~$' not in filename and '.DS' not in filename:              # 去重(例如1.doc和1.docx)              base_name = os.path.splitext(filename)[0]              if base_name not in [f.name for f in files]:                  files.append(filename)      return files

3. 处理PDF文件

def pdf_reader(file):      with open(file, 'rb') as fp:          parser = PDFParser(fp)          doc = PDFDocument(parser)          resource = PDFResourceManager()          laparam = LAParams()          device = PDFPageAggregator(resource, laparams=laparam)          interpreter = PDFPageInterpreter(resource, device)          content = ''          for page in PDFPage.create_pages(doc):              interpreter.process_page(page)              layout = device.get_result()              for element in layout:                  if hasattr(element, 'get_text'):                      content += element.get_text()          return content

4. 处理Word文件

def word_reader(file):      try:          if 'docx' in file:              text = ''              document = Document(file)              for para in document.paragraphs:                  text += '\n' + para.text          else:              # 保存为docx格式              os.system(f"textutil -convert docx '{file}'")              text = word_reader(file + 'x')          return text      except Exception as e:          print(f"文件{file}无法打开,原因:{str(e)}")          return ''

5. 综合处理

def file_reader(file):      if 'doc' in file:          return word_reader(file)      elif 'pdf' in file:          return pdf_reader(file)      else:          return f"文件格式不支持:{file}"  if __name__ == '__main__':      path = "/Users/example/Mine/example/"      files = get_files(path)      for file in files:          print(f"处理文件:{file}")          content = file_reader(file)          print(f"解析结果:{content}")

下一步计划包括:

  • 简历过滤功能(如学历、稳定性、年龄、工作经验与职级匹配度等)
  • 全自动化内推代码

转载地址:http://eodpz.baihongyu.com/

你可能感兴趣的文章
ollama本地部署DeepSeek(Window图文说明)
查看>>
ollama运行多模态模型如何进行api测试?
查看>>
OMG,此神器可一次定一周的外卖
查看>>
Omi 多端开发之 - omip 适配 h5 原理揭秘
查看>>
On Error GOTO的好处
查看>>
onclick事件的基本操作
查看>>
oncopy和onpaste
查看>>
onCreate中的savedInstanceState作用
查看>>
onCreate()方法中的参数Bundle savedInstanceState 的意义用法
查看>>
One good websit for c#
查看>>
One-Shot学习/一次学习(One-shot learning)
查看>>
OneASP 安全公开课,深圳站, Come Here, Feel Safe!
查看>>
OneBlog Shiro 反序列化漏洞复现
查看>>
oneM2M
查看>>
Oneplus5重装攻略
查看>>
one_day_one--mkdir
查看>>
ONI文件生成与读取
查看>>
Vue 项目中实现高效的消息提示与确认对话框功能(模版)
查看>>
Online PDF to PNG、JPEG、WEBP、 TXT - toolfk
查看>>
onlstm时间复杂度_CRF和LSTM 模型在序列标注上的优劣?
查看>>