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

你可能感兴趣的文章
OfficeWeb365 SaveDraw 文件上传漏洞复现
查看>>
office中的所有content type
查看>>
office之Excel 你会用 Ctrl + E 吗?
查看>>
OGG初始化之使用数据库实用程序加载数据
查看>>
ogg参数解析
查看>>
ognl详解
查看>>
Oil Deposits
查看>>
OJ中处理超大数据的方法
查看>>
OJ中常见的一种presentation error解决方法
查看>>
OK335xS UART device registe hacking
查看>>
ok6410内存初始化
查看>>
Okhttp3添加拦截器后,报错,java.io.IOException: unexpected end of stream on okhttp3.Address
查看>>
OKR为什么到今天才突然火了?
查看>>
ol3 Demo2 ----地图搜索功能
查看>>
OLAP、OLTP的介绍和比较
查看>>
OLAP在大数据时代的挑战
查看>>
oldboy.16课
查看>>
OLEDB IMEX行数限制的问题
查看>>
ollama 如何删除本地模型文件?
查看>>
ollama-python-Python快速部署Llama 3等大型语言模型最简单方法
查看>>