博客
关于我
一个薪资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/

你可能感兴趣的文章
nvm安装 出现 Error retrieving “http://xxxx/SHASUMS256.txt“: HTTP Status 404 解决方法
查看>>
nvm安装以后,node -v npm 等命令提示不是内部或外部命令 node多版本控制管理 node多版本随意切换
查看>>
NXLog采集windows日志配置conf文件
查看>>
ny540 奇怪的排序 简单题
查看>>
NYOJ -216 A problem is easy
查看>>
NYOJ 1066 CO-PRIME(数论)
查看>>
NYOJ 737:石子合并(一)(区间dp)
查看>>
nyoj 91 阶乘之和(贪心)
查看>>
nyoj------203三国志
查看>>
NYOJ-525 一道水题
查看>>
NYOJ127星际之门(一)
查看>>
nyoj58 最少步数
查看>>
N皇后问题
查看>>
N皇后问题
查看>>
n种方式教你用python读写excel等数据文件
查看>>
OAuth 2.0 MAC Tokens
查看>>
OAuth 及 移动端鉴权调研
查看>>
OAuth2 + Gateway统一认证一步步实现(公司项目能直接使用),密码模式&授权码模式
查看>>
OAuth2 Provider 项目常见问题解决方案
查看>>
OAuth2 vs JWT,到底怎么选?
查看>>