├── .gitignore ├── README.md ├── docker-compose.yml └── images ├── admin_change_pwd.png ├── admin_login.png ├── apply_trial_license-1.png └── update_license-1.png /.gitignore: -------------------------------------------------------------------------------- 1 | data/* 2 | logs/* 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 小芭智能简历解析系统 2 | 3 | ### 运行环境 4 | - 硬盘:100G+ 5 | - 内存:16G+ 6 | - 操作系统:Ubuntu Server 16.04、18.04 或 20.04,centos 7.6, centos 7.9 推荐 Ubuntu Server 20.04 7 | - Miniconda3 Python3.8 * 8 | - JDK-8(oracle jdk-1.8) * 9 | - LibreOffice 7.2.7 * 10 | - HanLP 1.8 * 11 | - MongoDB 12 | - Docker 20.10 13 | - Docker-compose 2.10+ 14 | 15 | **说明**:* 无需下载,安装包中已经包含这些组件。 16 | 17 | 18 | ### 服务器配置要求 19 | - 推荐配置**4核16G内存**以上的服务器配置。 20 | 21 | 22 | --- 23 | ### Docker 安装 (推荐:需要安装docker和docker-compose) 24 | 1. 安装(linux环境)。 25 | 26 | ```bash 27 | $ mkdir cvparser 28 | $ cd cvparser 29 | $ wget https://raw.githubusercontent.com/changwu/cvparser/main/docker-compose.yml # 获取docker-compose.yml文件。 30 | # 可参考docker-compose.yml中注释修改参数, 启动之前确保挂载目录 volumes.source 所指向的路径存在。 31 | # volumes.source 路径如果不存在,使用 mkdir -p 创建目录 32 | $ sudo mkdir -p /home/mongodb/data/{db,log} 33 | $ sudo mkdir -p data logs 34 | # 启动值守服务 35 | $ docker-compose up -d # 插件方式安装的执行命令: docker compose up -d 36 | ``` 37 | 2. 更新 38 | 39 | 40 | ```bash 41 | $ cd cvparser 42 | $ docker-compose down # 插件方式安装的执行命令: docker compose down 43 | $ docker-compose pull # 插件方式安装的执行命令: docker compose pull 44 | $ docker-compose up -d # 插件方式安装的执行命令: docker compose up -d 45 | ``` 46 | 47 | **提示:** Windows下请先安装Docker Desktop,参考上述linux命令进行安装。 48 | 49 | 50 | --- 51 | ### 手动安装 52 | #### 下载 53 | 前往 [Release](https://github.com/changwu/cvparser/releases) 中下载安装包:cvparser-x.x.x.tar.gz 54 | 55 | #### 安装 56 | 57 | 解压后执行 scripts/install.sh 安装, 如: 58 | 59 | ```bash 60 | $ tar -zxvf cvparser-2.1.1.tar.gz 61 | $ cd cvparser-2.1.1 62 | $ ./scripts/install.sh 63 | ``` 64 | 65 | 最后如果出现了“dependence tools install finished ......”,但未看到 “智能简历解析工具安装成功” 的提示,说明conda 环境可能未正确初始化,请手动初化 conda 环境后再执行 `scripts/install.h` : 66 | 67 | ```bash 68 | $ source ~/.bashrc 69 | $ ./scripts/install.sh 70 | ``` 71 | #### 启动服务 72 | 73 | ```bash 74 | $ cd cvparser-2.1.1 75 | $ ./scripts/start.sh 76 | ``` 77 | 78 | 因服务启动时要加载 NLP 相关模块, 请耐心等待一会 79 | **特别提示:** 可以启动多个不同端口的服务,然后通过nginx针对多个服务端口来做负载均衡。 80 | 81 | --- 82 | ### 获取License 83 | 1. 获取试用版本License 84 | 启动 cvparser 服务之后,浏览器访问**用户许可页面**([http://127.0.0.1:5000/license](http://127.0.0.1:5000/license)), 点击**申请免费试用许可**按钮申请试用版本 License。 85 | 如果是云服务器,则将 127.0.0.1:5000 换成你的云服务器公网IP和端口。 86 | ![image](./images/apply_trial_license-1.png) 87 | 88 | 2. 获取正式版本License 89 | - 在上面的**用户许可页面**中,复制**机器码**,然后[联系我们](https://www.ibaguo.com/contact/)获取License。 90 | - 点击**用户许可页面**中的**更新用户许可**按钮,在更新用户许可页面中输入获取到的正式版 License,然后点击**更新**按钮。 91 | ![image](./images/update_license-1.png) 92 | 93 | 94 | --- 95 | ### 配置文件 96 | 可以通过修改配置文件:cvparser/config/config.json进行一些自定义的用户配置,如 API_TOKEN 等。 97 | ```json 98 | { 99 | "admin_enable": false, 100 | "mongodb": { 101 | "host": "localhost", 102 | "port": 27017, 103 | "dbname": "cvparser", 104 | "username": null, 105 | "password": null 106 | }, 107 | "api_token": null, 108 | "secret_key": "flasksecret+key解决办法: 146 | ``` 147 | $ sudo apt-get clean 148 | $ sudo apt-get update 149 | ``` 150 | 2. ERROR: File or directory already exists: '/opt/miniconda3' 151 | >解决办法: 152 | > 1) /opt/miniconda3 目录已经存在,说明你可能已经安装过了 miniconda, 请正确配置好 conda 环境然后重新运行安装脚本 153 | > 2) 如果没有安装miniconda,那么请确认/opt/miniconda3 目录是否可以改名或删除 154 | > 3) 如果没有安装miniconda, 且 /opt/miniconda3 目录有其他用处,则需要修改 miniconda3 的默认安装路径: 155 | > ``` 156 | > export CONDA_INSTALL_PREFIX=/opt/miniconda3_resume 157 | > ./scripts/install.sh 158 | > ``` 159 | 160 | 3. data/dictionary/***.txt: mismatching "local" filename (data/dictionary/custom/人名词典.txt) 等 161 | >解决办法: 162 | > `locale` 命令查看当前系统的 LANG 和 LC_* 环境变量,确保 LANG 和 LC_* 等环境变量的值是 C.UTF-8 或 zh_CN.UTF-8 或 en_US.UTF-8 163 | > 如果是 POSIX, 请按如下方法修改: 164 | > ``` 165 | > export LANG=C.UTF-8 166 | > export LC_ALL=C.UTF-8 167 | > locale 168 | > ``` 169 | > 修改之后重新执行安装脚本 170 | > ``` 171 | > ./scripts/install.sh 172 | > ``` 173 | 174 | 4. 安装 requirements 报 timeout 错误 175 | ``` 176 | socket.timeout: The read operation timed out 177 | 178 | pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. 179 | ``` 180 | > 解决办法: 181 | > 为 pip install 添加代理,可用代理有: 182 | > - 中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/ 183 | > - 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/ 184 | > ``` 185 | > $ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ -U -r requirements.txt 186 | > ``` 187 | > 如果中途还有报错的话,多试几次就好。 188 | 189 | 5. OSError: libcrypto.so.1.1: cannot open shared object file: No such file or directory 190 | 问题原因: 系统的 OpenSSL 版本太低,不是 1.1.1 的版本。 191 | 解决办法: 192 | - 方案1:升级 openssl 为 1.1.1 版本。 193 | - 方案2:设置环境变量`LD_LIBRARY_PATH`。 194 | ``` 195 | export LD_LIBRARY_PATH=${CONDA_EXE%/bin/conda}/lib:$LD_LIBRARY_PATH 196 | ``` 197 | - **如有其他安装问题,请联系开发人员协助解决** 198 | 199 | 200 | --- 201 | ### API 列表: 202 | |API | Methods | Desc | 203 | |----------------- |------- |----------------| 204 | |/api/resume_parser | POST | 解析简历 | 205 | 206 | **详细内容请查看[API文档](https://www.ibaguo.com/blog/post-2/)** 207 | 208 | --- 209 | ### API PYTHON 示例 210 | ```python 211 | import os 212 | import requests 213 | import base64 214 | import pprint 215 | 216 | api_url_base = 'http://127.0.0.1:5000/api' 217 | api_token = 'tk-1234567890' 218 | 219 | 220 | def resume_parser(filename: str): 221 | api_url = '{}/resume_parser'.format(api_url_base) 222 | with open(filename, 'rb') as fp: 223 | data = fp.read() 224 | enc_data = base64.b64encode(data).decode() 225 | req = requests.Session() 226 | payload = { 227 | 'file_name': os.path.basename(filename), 228 | 'file_mode': 1, 229 | 'file_cont': enc_data, 230 | 'token': api_token 231 | } 232 | res = req.post(api_url, json=payload) 233 | if res.ok: 234 | return res.json() 235 | return (res.status_code, res.reason) 236 | 237 | 238 | if __name__ == '__main__': 239 | result = resume_parser('test-resume.txt') 240 | pprint.pprint(result) 241 | 242 | ``` 243 | 244 | ### API JAVA 示例 245 | ```java 246 | import java.io.File; 247 | import org.apache.commons.io.FileUtils; 248 | import org.apache.commons.codec.binary.Base64; 249 | import org.apache.http.Consts; 250 | import org.apache.http.HttpResponse; 251 | import org.apache.http.client.HttpClient; 252 | import org.apache.http.client.methods.HttpPost; 253 | import org.apache.http.entity.StringEntity; 254 | import org.apache.http.impl.client.DefaultHttpClient; 255 | import org.apache.http.util.EntityUtils; 256 | import org.json.JSONObject; 257 | 258 | public class TestParseApi { 259 | 260 | public static void testResumeParser(String url, String fname, String token) throws Exception { 261 | // 设置头字段 262 | HttpPost httpPost = new HttpPost(url); 263 | httpPost.addHeader("content-type", "application/json"); 264 | 265 | // 读取简历内容 266 | byte[] bytes = FileUtils.readFileToByteArray(new File(fname)); 267 | String data = new String(Base64.encodeBase64(bytes), Consts.UTF_8); 268 | 269 | // 设置内容信息 270 | JSONObject json = new JSONObject(); 271 | json.put("token", token); // token 272 | json.put("file_mode", 1); // 解析模式 273 | json.put("file_name", fname); // 文件名 274 | json.put("file_cont", data); // 经base64编码过的文件内容 275 | StringEntity params = new StringEntity(json.toString(), Consts.UTF_8); 276 | httpPost.setEntity(params); 277 | 278 | // 发送请求 279 | HttpClient httpclient = new DefaultHttpClient(); 280 | HttpResponse response = httpclient.execute(httpPost); 281 | 282 | // 处理返回结果 283 | String resCont = EntityUtils.toString(response.getEntity(), Consts.UTF_8); 284 | System.out.println(resCont); 285 | 286 | JSONObject res = new JSONObject(resCont); 287 | JSONObject status = res.getJSONObject("status"); 288 | if(status.getInt("code") != 200) { 289 | System.out.println("request failed: code=<" + status.getInt("code") + ">, message=<" + status.getString("message") + ">"); 290 | } 291 | else { 292 | JSONObject result = res.getJSONObject("result"); 293 | System.out.println("result:\n" + result.toString(4)); 294 | System.out.println("request succeeded"); 295 | } 296 | } 297 | 298 | public static void main(String[] args) throws Exception { 299 | String url = "http://127.0.0.1:5000/api/resume_parser"; 300 | String fname = "./test-resume.txt"; // 替换为你的简历文件名,确保后缀名正确 301 | String token = "tk-1234567890"; // YOUR TOKEN 302 | 303 | testResumeParser(url, fname, token); 304 | } 305 | } 306 | ``` 307 | 308 | ### 购买须知 309 | 310 | 小芭智能简历解析系统根据服务目标不同分为三种版本:免费试用版、基础版和专业版。 311 | 价格和服务内容可以访问网页进行了解: 312 | 313 | 314 | ### 联系我们 315 | 316 | * 电话: +86 137 2088 1902 317 | * 邮箱:  318 | * 微信:wuxiaoba8085 319 | ![image](https://www.ibaguo.com/images/contact/wechat.jpg) 320 | 321 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | cvparser: 4 | image: changwu0917/cvparser:latest 5 | restart: always 6 | ports: 7 | - "5000:5000" # cvparser 服务端口号, 可根据实际情况修改冒号(:)前的端口供外部访问 8 | depends_on: 9 | - mongodb 10 | environment: # 配置环境变量,可传递到 docker container 中 11 | HANLP_JVM_XMS: 2g # JVM 内存分配参数 -Xms 12 | HANLP_JVM_XMX: 6g # JVM 内存分配参数 -Xmx, >= 6G 13 | CVPARSER_APP_SECRET_KEY: 6d6b4cdf74d9c03adc88e928f6140734 # Flask App Secret Key, 可根据需要修改 14 | CVPARSER_API_TOKEN: ${CVPARSER_API_TOKEN} # API_TOKEN, 可根据需要通过环境变量 CVPARSER_API_TOKEN 配置或直接设置, 默认未设置 15 | CVPARSER_ADMIN_ENABLE: true # 是否启用 admin 功能, true: 开启, false: 不开启, 默认true 16 | MONGO_PORT: "27017" # mongodb 端口, 如果 mongodb 通过配置文件修改了服务端口, 这里需要修改为对应的值。如未设置则用默认的端口27017, 默认未设置 17 | MONGO_USERNAME: ${MONGO_USERNAME} # mongodb 用户名, 可根据需要通过环境变量 MONGO_USERNAME 配置, 默认未设置 18 | MONGO_PASSWORD: ${MONGO_PASSWORD} # mongodb 用户密码, 可根据需要通过环境变量 MONGO_PASSWORD 配置, 默认未设置 19 | volumes: 20 | - type: bind 21 | source: ./data # 挂载简历数据目录, 可根据实际路径修改 22 | target: /cvparser/data 23 | - type: bind 24 | source: ./logs # 挂载日志目录, 可根据实际路径修改 25 | target: /cvparser/logs 26 | ulimits: 27 | nproc: 65535 28 | nofile: 29 | soft: 819200 30 | hard: 1048576 31 | 32 | mongodb: 33 | image: mongo:focal 34 | restart: always 35 | ports: 36 | - "127.0.0.1:27017:27017" # mongodb 服务端口 37 | environment: 38 | MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME} # mongodb 用户名, 可根据需要通过环境变量 MONGO_USERNAME 配置, 默认无 39 | MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD} # mongodb 用户密码, 可根据需要通过环境变量 MONGO_PASSWORD 配置, 默认无 40 | volumes: 41 | - type: bind 42 | source: /home/mongodb/data/db # 挂载数据文件目录, 可根据实际路径修改 43 | target: /data/db 44 | - type: bind 45 | source: /home/mongodb/data/log # 挂载日志文件目录, 可根据实际路径修改 46 | target: /var/log/mongodb 47 | -------------------------------------------------------------------------------- /images/admin_change_pwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/changwu/cvparser/7e97a03835539ac0fec22e71cd0f19a2cbc86231/images/admin_change_pwd.png -------------------------------------------------------------------------------- /images/admin_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/changwu/cvparser/7e97a03835539ac0fec22e71cd0f19a2cbc86231/images/admin_login.png -------------------------------------------------------------------------------- /images/apply_trial_license-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/changwu/cvparser/7e97a03835539ac0fec22e71cd0f19a2cbc86231/images/apply_trial_license-1.png -------------------------------------------------------------------------------- /images/update_license-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/changwu/cvparser/7e97a03835539ac0fec22e71cd0f19a2cbc86231/images/update_license-1.png --------------------------------------------------------------------------------