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

你可能感兴趣的文章
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node-RED中使用JSON数据建立web网站
查看>>
Node-RED中使用json节点解析JSON数据
查看>>
Node-RED中使用node-red-browser-utils节点实现选择Windows操作系统中的文件并实现图片预览
查看>>
Node-RED中使用Notification元件显示警告讯息框(温度过高提示)
查看>>
Node-RED中实现HTML表单提交和获取提交的内容
查看>>
Node.js 函数是什么样的?
查看>>