一个薪资double的捷径:自动化简历内推工具

简介: 一个薪资double的捷径:自动化简历内推工具

正文


最近,小编在处理简历时,发现大量简历需要一个个打开文件,复制姓名、邮箱、电话号码、学历等关键信息,效率特别低且部分文件无法直接复制。于是,小编便写了文件阅读工具的脚本,支持文件格式有:doc,docx,pdf。


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


ps. 上月战绩,内推400+人,内推成功8人,入职5人,收米8000*2+5000*3=31000。


{'感谢您的投递': 331, '简历处理中': 19, '简历初筛': 5, '本轮通过': 6, 'Offer已发放': 1, '进行中': 2, '拒绝Offer': 3, '接受Offer': 5}



脚本功能:提取简历文本


输入:要解析的文件路径


输出:解析的内容,包括不限于姓名、邮箱、电话号码、学历等信息。


环境:python 3.6 、mac(doc转docx是mac写法,windows更简单,导入win32的包即可)


第一步:需要导入的包


# encoding: utf-8
import os, sys
import docx
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.layout import LAParams
from pdfminer.converter import PDFPageAggregator


第二步:读文件


def get_files(path):
    res = []
    for i in os.listdir(path):
        # 去掉临时文件
        if os.path.isfile(path+i) and '~$' not in i and '.DS' not in i:
            # 去重 1.doc 和 1.docx
            if (path+i).split(".")[0] not in str(res):
                res.append(path+i)
    return res


第三步:读PDF,得到res文本后,可以通过正则,匹配出邮箱,手机号,学历等


def pdf_reader(file):
    fp = open(file, "rb")
    # 创建一个与文档相关联的解释器
    parser = PDFParser(fp)
    # PDF文档对象
    doc = PDFDocument(parser)
    # 链接解释器和文档对象
    parser.set_document(doc)
    # doc.set_paeser(parser)
    # 初始化文档
    # doc.initialize("")
    # 创建PDF资源管理器
    resource = PDFResourceManager()
    # 参数分析器
    laparam = LAParams()
    # 创建一个聚合器
    device = PDFPageAggregator(resource, laparams=laparam)
    # 创建PDF页面解释器
    interpreter = PDFPageInterpreter(resource, device)
    # 使用文档对象得到页面集合
    res = ''
    for page in PDFPage.create_pages(doc):
        # 使用页面解释器来读取
        interpreter.process_page(page)
        # 使用聚合器来获取内容
        layout = device.get_result()
        for out in layout:
            if hasattr(out, "get_text"):
                res = res + '' + out.get_text()
    return res


第四步:读word格式文件。待优化:word中如果包含execl,暂时读不出来。


def word_reader(file):
    try:
        # docx 直接读
        if 'docx' in file:
            res = ''
            f = docx.Document(file)
            for para in f.paragraphs:
                res = res + '\n' +para.text
        else:
            # 先转格式doc>docx
            os.system("textutil -convert docx '%s'"%file)
            word_reader(file+'x')
            res = ''
            f = docx.Document(file+'x')
            for para in f.paragraphs:
                res = res + '\n' +para.text
        return res
    except:
        # print(file, 'read failed')
        return ''


完整代码


# encoding: utf-8
import os, sys
import docx
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.layout import LAParams
from pdfminer.converter import PDFPageAggregator
def get_files(path):
    res = []
    for i in os.listdir(path):
        # 去掉临时文件
        if os.path.isfile(path+i) and '~$' not in i and '.DS' not in i:
            # 去重 1.doc 和 1.docx
            if (path+i).split(".")[0] not in str(res):
                res.append(path+i)
    return res
def pdf_reader(file):
    fp = open(file, "rb")
    # 创建一个与文档相关联的解释器
    parser = PDFParser(fp)
    # PDF文档对象
    doc = PDFDocument(parser)
    # 链接解释器和文档对象
    parser.set_document(doc)
    # doc.set_paeser(parser)
    # 初始化文档
    # doc.initialize("")
    # 创建PDF资源管理器
    resource = PDFResourceManager()
    # 参数分析器
    laparam = LAParams()
    # 创建一个聚合器
    device = PDFPageAggregator(resource, laparams=laparam)
    # 创建PDF页面解释器
    interpreter = PDFPageInterpreter(resource, device)
    # 使用文档对象得到页面集合
    res = ''
    for page in PDFPage.create_pages(doc):
        # 使用页面解释器来读取
        interpreter.process_page(page)
        # 使用聚合器来获取内容
        layout = device.get_result()
        for out in layout:
            if hasattr(out, "get_text"):
                res = res + '' + out.get_text()
    return res
def word_reader(file):
    try:
        # docx 直接读
        if 'docx' in file:
            res = ''
            f = docx.Document(file)
            for para in f.paragraphs:
                res = res + '\n' +para.text
        else:
            # 先转格式doc>docx
            os.system("textutil -convert docx '%s'"%file)
            word_reader(file+'x')
            res = ''
            f = docx.Document(file+'x')
            for para in f.paragraphs:
                res = res + '\n' +para.text
        return res
    except:
        # print(file, 'read failed')
        return ''
def file_reader(file):
    if 'doc' in file:
        res = word_reader(file)
    elif 'pdf' in file:
        res = pdf_reader(file)
    else:
        res = '不是doc,也不是pdf,文件格式不支持!'
    return res
if __name__ == '__main__':
    path = "/Users/XXXXX/Mine/XXXXX/"
    abs_files = get_files(path)
    print(abs_files)
    for file in abs_files:
        file_text = file_reader(file)
        print(file_text)


本期实现:任何格式的简历,解析成文本,便于后续筛选优质简历。

相关文章
一键自动化博客发布工具,用过的人都说好(infoq篇)
使用一键自动化博客发布工具blog-auto-publishing-tools把博客发布到infoq上。
一键自动化博客发布工具,用过的人都说好(infoq篇)
一键自动化博客发布工具,用过的人都说好(cnblogs篇)
使用一键自动化博客发布工具blog-auto-publishing-tools把博客发布到cnblogs上。
|
4天前
|
开发者
一键自动化博客发布工具,用过的人都说好(阿里云篇)
使用一键自动化博客发布工具blog-auto-publishing-tools把博客发布到阿里云上。
一键自动化博客发布工具,用过的人都说好(阿里云篇)
一键自动化博客发布工具,用过的人都说好(oschina篇)
使用一键自动化博客发布工具blog-auto-publishing-tools把博客发布到oschina上。
一键自动化博客发布工具,用过的人都说好(oschina篇)
|
5天前
|
运维 关系型数据库 MySQL
Ansible自动化运维工具主机清单配置
Ansible自动化运维工具主机清单配置
一键自动化博客发布工具,用过的人都说好(segmentfault篇)
使用一键自动化博客发布工具blog-auto-publishing-tools把博客发布到segmentfault上。
|
6天前
|
测试技术 API
探索软件测试中的自动化工具与挑战
本文探讨了软件测试领域中自动化工具的应用与挑战。通过分析目前主流的自动化测试工具,探讨了其在提高测试效率、减少人工成本、增强测试覆盖率等方面的优势。然而,自动化测试也面临着诸如脆弱性、维护成本高等挑战。最后,提出了一些应对挑战的建议,以期为软件测试领域的自动化工作提供一些启示。
13 1
|
8天前
|
Web App开发 JSON 数据格式
一键自动化博客发布工具,chrome和firfox详细配置
blog-auto-publishing-tools博客自动发布工具现在已经可以同时支持chrome和firefox了.
一键自动化博客发布工具,chrome和firfox详细配置
|
11天前
|
敏捷开发 监控 测试技术
探索自动化测试工具Selenium Grid的高效集成策略
【4月更文挑战第30天】在现代Web应用的快速迭代和持续部署中,测试自动化已成为确保产品质量的关键。Selenium Grid作为一款支持多种浏览器和操作系统的测试工具,提供了并行执行测试用例的能力,极大地提升了测试效率。本文将深入探讨如何高效地将Selenium Grid集成到现有的测试框架中,以及实施过程中的最佳实践,帮助团队最大化测试覆盖率,同时降低资源消耗。
|
12天前
|
中间件 测试技术 API
探索自动化测试工具的新边界:Selenium与Appium的集成实践
【4月更文挑战第30天】 随着移动应用和Web应用的不断融合,传统的自动化测试工具需要适应新的测试环境。本文将详细分析Selenium和Appium这两款流行的自动化测试工具的集成实践,探讨如何构建一个能够同时支持Web和移动端应用的自动化测试框架。通过对比两者的技术架构、功能特性以及在实际项目中的集成过程,我们旨在为读者提供一个清晰的指导,帮助他们在复杂的应用环境中实现高效、稳定的自动化测试流程。

热门文章

最新文章