Skip to main content

简历批量解析工具,支持PDF、DOC、DOCX格式简历的文本提取和信息解析

Project description

resume-oneclick

简历批量解析工具 —— 一键提取 PDF / DOC / DOCX 简历中的结构化信息

PyPI version Python Version License: MIT Downloads


核心特性

  • 多格式支持:PDF、DOC、DOCX 三种常见简历格式全覆盖
  • 批量处理:一次处理整个目录下的所有简历文件
  • 智能信息提取:基于正则表达式与关键词匹配,自动提取姓名、联系方式、学历、学校、专业、技术方向、公司等结构化信息
  • Excel 报告生成:解析结果一键汇总为带格式的 Excel 报告,支持状态颜色标记
  • TXT 文本转换:将简历文件批量转换为纯文本,方便后续处理
  • 现代化 CLI:基于 Typer 框架,提供进度条、彩色输出等友好交互
  • 模块化设计:Extractor / Parser / CLI 三层架构,易于扩展

快速安装

通过 pip 安装(推荐)

pip install resume-oneclick

从源码安装

git clone https://github.com/your-username/resume-oneclick.git
cd resume-oneclick
pip install -e ".[dev]"

使用教程

安装完成后,即可使用 resume-parser 命令:

resume-parser --help

输出:

 Usage: resume-parser [OPTIONS] COMMAND [ARGS]...

 简历解析工具 - 支持PDF、DOC、DOCX格式简历的批量处理

╭─ Commands ───────────────────────────────────────────╮
│ to-txt  将简历文件转换为TXT文本文件                  │
│ parse   批量解析简历并生成Excel汇总报告              │
╰──────────────────────────────────────────────────────╯

命令一:to-txt — 批量转换为 TXT

将指定目录下的简历文件(PDF / DOC / DOCX)批量转换为纯文本文件。

参数说明:

参数 缩写 说明 必填
--input -i 简历文件所在目录
--output -o TXT 文件保存目录

示例:

resume-parser to-txt -i ./resumes -o ./txt_output

执行后会在 ./txt_output 目录下为每份简历生成对应的 .txt 文件。

命令二:parse — 批量解析并生成 Excel 报告

批量解析简历文件,提取结构化信息,并生成 Excel 汇总报告。

参数说明:

参数 缩写 说明 必填 默认值
--input -i 简历文件所在目录
--output -o Excel 报告保存目录
--name -n Excel 报告文件名 简历信息汇总.xlsx

示例:

resume-parser parse -i ./resumes -o ./reports -n 2026春招汇总.xlsx

执行后会在 ./reports 目录下生成带格式的 Excel 报告,包含所有简历的解析结果。

Python API 调用

除了 CLI 命令,你也可以在 Python 代码中直接使用:

from resume_oneclick import extract_file, extract_resume_info

# 提取简历文本
text, method = extract_file("张三@清华大学.pdf")
print(f"提取方法: {method}")
print(f"文本内容:\n{text[:200]}")

# 解析结构化信息
info = extract_resume_info(text, filename="张三@清华大学.pdf")
print(f"姓名: {info['姓名']}")
print(f"学校: {info['最高学历毕业学校']}")
print(f"专业: {info['最高学历专业']}")
print(f"技术方向: {info['当前投入方向']}")

技术架构

项目目录结构

resume-oneclick/
├── resume_oneclick/          # 核心包
│   ├── __init__.py           # 包初始化与公共 API 导出
│   ├── extractor.py          # 文件提取器模块
│   ├── parser.py             # 信息解析器模块
│   └── cli.py                # 命令行接口模块
├── setup.py                  # 传统安装配置
├── pyproject.toml            # 现代项目配置
├── requirements.txt          # 依赖清单
├── README.md                 # 项目说明
└── .gitignore                # Git 忽略配置

模块架构

┌─────────────────────────────────────────────────────┐
│                CLI Layer (cli.py)                    │
│             命令行接口层 (Typer 框架)                │
└─────────────────────────────────────────────────────┘
                          │
              ┌───────────┴───────────┐
              ▼                       ▼
┌──────────────────────┐    ┌──────────────────────┐
│  Extractor Module    │    │   Parser Module      │
│  (extractor.py)      │    │   (parser.py)        │
│  文件提取器           │    │   信息解析器          │
└──────────────────────┘    └──────────────────────┘

数据流向

输入文件 (PDF/DOC/DOCX)
        │
        ▼
  ┌─────────────┐
  │  Extractor   │  extract_file() — 提取纯文本
  └─────────────┘
        │
        ▼
    纯文本内容
        │
        ├────────────────┐
        ▼                ▼
  ┌───────────┐  ┌─────────────┐
  │ TXT 输出   │  │   Parser    │  extract_resume_info() — 结构化解析
  └───────────┘  └─────────────┘
                        │
                        ▼
                 结构化信息字典
                        │
                        ▼
                 Excel 报告 / CLI 输出

设计模式

模式 应用位置 说明
策略模式 extract_file() 根据文件扩展名动态选择提取方法
备用模式 PDF / DOC 提取 PDF: pdfplumber → PyPDF2;DOC: python-docx → win32com
模板方法模式 extract_resume_info() 统一提取流程:初始化 → 姓名 → 联系方式 → 学历 → 技术方向 → 公司

核心依赖

用途
typer 命令行框架
pdfplumber PDF 文本提取(主要方法)
PyPDF2 PDF 文本提取(备用方法)
python-docx DOCX / DOC 文件解析
openpyxl Excel 报告生成

支持的简历格式与提取字段

文件格式

格式 扩展名 提取引擎
PDF .pdf pdfplumber(主)/ PyPDF2(备)
DOCX .docx python-docx(段落 + 表格)
DOC .doc python-docx(主)/ win32com(备,仅 Windows)

可提取字段

字段 说明 提取方式
姓名 候选人姓名 文件名模式匹配 + 文本首行识别
电话号码 手机号 / 座机号 正则表达式(支持 +86 等多种格式)
邮箱 电子邮箱地址 正则表达式匹配
最高学历 博士 / 硕士 / 本科等 关键词优先级匹配
最高学历毕业学校 毕业院校 180+ 所国内外知名高校匹配
最高学历专业 所学专业 100+ 个常见专业匹配
当前投入方向 技术方向 / 研究领域 60+ 个技术关键词从经历段落提取
所在公司 当前或历史任职公司 80+ 家国内外知名企业匹配

开发指南

搭建开发环境

推荐使用 conda 创建独立的开发环境:

# 创建 conda 环境
conda create -n pypi python=3.11 -y
conda activate pypi

# 克隆项目
git clone https://github.com/your-username/resume-oneclick.git
cd resume-oneclick

# 以可编辑模式安装(含开发依赖)
pip install -e ".[dev]"

或使用 venv

python -m venv venv
source venv/bin/activate  # macOS/Linux
pip install -e ".[dev]"

运行测试

pytest tests/ -v --cov=resume_oneclick

构建与发布

# 构建分发包
python -m build

# 上传到 PyPI
twine upload dist/*

贡献代码

  1. Fork 本仓库
  2. 创建功能分支:git checkout -b feature/your-feature
  3. 提交变更:git commit -m "feat: add your feature"
  4. 推送分支:git push origin feature/your-feature
  5. 创建 Pull Request

免责声明

  • 本工具 resume-oneclick 仅用于合法合规的简历处理场景(如企业招聘、猎头服务等),不得用于任何非法目的。
  • 使用者在处理简历数据时,必须遵守相关数据隐私法律法规,包括但不限于《中华人民共和国个人信息保护法》、《数据安全法》以及适用的国际隐私法规(如 GDPR)。
  • 工具的解析结果基于规则匹配与关键词识别,仅供参考,不对准确性、完整性做任何保证
  • 作者不对因使用本工具产生的任何直接、间接或附带的损失、法律责任或数据泄露问题负责。
  • 使用者应确保已获得简历所有人的合法授权后再进行数据处理。

License

本项目基于 MIT License 开源。

MIT License

Copyright (c) 2026 resume-oneclick contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resume_oneclick-0.1.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

resume_oneclick-0.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file resume_oneclick-0.1.1.tar.gz.

File metadata

  • Download URL: resume_oneclick-0.1.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for resume_oneclick-0.1.1.tar.gz
Algorithm Hash digest
SHA256 af93742ad0fab5821221407191907eb5a6f3e2320f9574cfe16dfa3c1623e4bb
MD5 f1f8555c866416e788a2eafd7e20458f
BLAKE2b-256 308fd65faaf583dc893a5da52a1c0ec4076b7b8c8b756563b2a91b47c4b62050

See more details on using hashes here.

File details

Details for the file resume_oneclick-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for resume_oneclick-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b70250e161e939b6fa6774afdd2976092e360550d576577be6731d5120a75b00
MD5 2657b328d21e8bd75fa920242cfbc631
BLAKE2b-256 fb0c2302f1c8819248bd79a10347c7145fb339971cd360aa1cd088ca74e86d6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page