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

你可能感兴趣的文章
PgSQL · 特性分析 · PG主备流复制机制
查看>>
PGSQL主键序列
查看>>
PGSQL安装PostGIS扩展模块
查看>>
pg数据库中两个字段相除
查看>>
PhalApi:[1.23] 请求和响应:GET和POST两者皆可得及超越JSON格式返回
查看>>
Phalcon环境搭建与项目开发
查看>>
Phantom.js维护者退出,项目的未来成疑
查看>>
Pharmaceutical的同学们都看过来,关于补码运算的复习相关内容
查看>>
Phoenix 查看表信息及修改元数据
查看>>
phoenix_执行sql报错_Error: ERROR 504 (42703): Undefined column. columnName=(state=4270_大数据工作笔记0181
查看>>
phoenix启动失败_The history file `/root/.sqlline/history` may be an older history---记录024_大数据工作笔记0184
查看>>
Phoenix基础命令_视图映射和表映射_数字存储问题---大数据之Hbase工作笔记0036
查看>>
phoenix无法连接hbase shell创建表失败_报错_PleaseHoldException: Master is initializing---记录020_大数据工作笔记0180
查看>>
Phoenix简介_安装部署_以及连接使用---大数据之Hbase工作笔记0035
查看>>
phoenix连接hbase报错Can not resolve hadoop120, please check your network_记录026---大数据工作笔记0187
查看>>
Photoshop工作笔记001---Photoshop常用快捷键总结
查看>>
Reids配置文件redis.conf中文详解
查看>>
Photoshop脚本入门
查看>>
PHP
查看>>
Regular Expression Notes
查看>>