文档

简历抽取(英文)服务

更新时间:

简历抽取服务使用示例。

说明

本服务由NLP自学习平台提供,直接调用API即可使用。

服务开通与资源包购买

使用前,请确认是否已经开通服务,开通后可购买资源包。

服务调用与调试

模型调用文档参考:模型调用

SDK示例文档参考:SDK示例

调试

您可以在OpenAPI开发者门户中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI开发者门户可以自动生成SDK代码示例。

通过环境变量配置访问凭证(AKSK)

  1. 说明:

    1. 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。

    2. 强烈建议不要把AccessKey和AccessKeySecret保存到代码里,会存在密钥泄漏风险,在此提供通过配置环境变量的方式来保存和访问aksk

  2. Linux和macOS系统配置方法

    export NLP_AK_ENV=<access_key_id>
    export NLP_SK_ENV=<access_key_secret>

    其中<access_key_id>替换为已准备好的AccessKey ID,<access_key_secret>替换为AccessKey Secret,AccessKey ID和AccessKey Secret的获取方式见步骤二:获取账号的AccessKey

  3. Windows系统配置方法

    1. 新建环境变量文件,添加环境变量NLP_AK_ENVNLP_SK_ENV,并写入已准备好的AccessKey ID和AccessKey Secret。

    2. 重启Windows系统。

说明

调用简历抽取(英文)服务,ServiceName需要传入:ResumeExtractorEN

Java代码示例

/**
 * 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
 * 此处以把AccessKey和AccessKeySecret保存在环境变量为例说明。您也可以根据业务需要,保存到配置文件里。
 * 强烈建议不要把AccessKey和AccessKeySecret保存到代码里,会存在密钥泄漏风险
 */
String accessKeyId = System.getenv("NLP_AK_ENV");
String accessKeySecret = System.getenv("NLP_SK_ENV");
DefaultProfile defaultProfile = DefaultProfile.getProfile("cn-hangzhou",accessKeyId,accessKeySecret);
IAcsClient client = new DefaultAcsClient(defaultProfile);
String content = "Resume Text";
RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
request.setServiceName("ResumeExtractorEN");
request.setPredictContent(content);
RunPreTrainServiceResponse response = client.getAcsResponse(request);
System.out.println(response.getPredictResult());

Python代码示例

# 安装依赖
pip install aliyun-python-sdk-core
pip install aliyun-python-sdk-nlp-automl
# -*- coding: utf8 -*-
import json
import os

from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdknlp_automl.request.v20191111 import RunPreTrainServiceRequest

/**
 * 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
 * 此处以把AccessKey和AccessKeySecret保存在环境变量为例说明。您也可以根据业务需要,保存到配置文件里。
 * 强烈建议不要把AccessKey和AccessKeySecret保存到代码里,会存在密钥泄漏风险
 */
access_key_id = os.environ['NLP_AK_ENV']
access_key_secret = os.environ['NLP_SK_ENV']

# Initialize AcsClient instance
client = AcsClient(
  access_key_id,
  access_key_secret,
  "cn-hangzhou"
);

content = 'Resume Text'

# Initialize a request and set parameters
request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
request.set_ServiceName('ResumeExtractorEN')
request.set_PredictContent(content)

# Print response
response = client.do_action_with_exception(request)
resp_obj = json.loads(response)
predict_result = json.loads(resp_obj['PredictResult'])
print(predict_result['result'])

PredictContent内容示例

PredictContent参数为简历文本参数。

John Smith

    john.*****@example.com / +852 1111 1234

    Unit 111, Tower 6A, Century Link, 6 Nanking Street, Tung Chung, Lantau Island, Hong Kong

    EMPLOYMENT HISTORY

    Aurostyle Limited (International Division, Christian Bernard Group), Hong Kong

    June 2010 - December 2012

    Marketing Manager

    o Oversaw marketing activities in the International office of a French jewellery group.

    o Worked closely with global marketing team and regional sales team to ensure qualitative

    marketing collaterals, trade marketing tools and premiums can be delivered or localized

    for POS promotions in international regions including China, Middle East and North

    America.

    o Drove and contributed to the launch of the jewellery line by French fashion houses, Guy

    Laroche and Cacharel, in international regions by leading POS activations, localizing trade

    marketing materials and conducting frontline staff trainings.

    Waddy Jewellery Group Limited

    June 2007 - June 2010

    Marketing Executive

    Marketing Manager

    o Oversaw marketing activities in a fine jewellery manufacturer.

    o Responsible for the development and maintenance of marketing collaterals, visual

    merchandising tools, corporate website and company newsletters

    o Successfully facilitated company’s participation in over 50 international tradeshows.

    EDUCATION

    The Hong Kong Polytechnic University, Hong Kong

    2002 - 2004

    Masters of Science, Marketing Management

    University of British Columbia, Canada

    1996 - 2000

    Honours Bachelor of Arts, African Studies

PredictResult内容示例

PredictResult是JSON字符串,需要反序列化之后进行解析,具体结构如下示例。

{
    "result": "{\"Schools\": [{\"School\": \"The Hong Kong Polytechnic University\", \"Degree\": null, \"StartDate\": \"2002-1-1\", \"EndDate\": \"2004-1-1\", \"DegreeCode\": null, \"SchoolDuration\": \"2002 - 2004\"}, {\"School\": \"University of British Columbia\", \"Degree\": \"Masters\", \"StartDate\": \"2000-3-1\", \"EndDate\": null, \"DegreeCode\": \"master\", \"SchoolDuration\": \", Mar\"}, {\"School\": \"University of British Columbia\", \"Degree\": \"Masters\", \"StartDate\": \"2000-3-1\", \"EndDate\": null, \"DegreeCode\": \"master\", \"SchoolDuration\": \", Mar\"}], \"Name\": \"John Smith\", \"Lang\": \"en\", \"Phone\": \"+852 1111 1234\", \"CountryCode\": \"852\", \"RegionalPhone\": \"11111234\", \"FamilyName\": \"Smith\", \"GivenName\": \"John\", \"City\": \"Hong Kong\", \"Email\": \"john.*****@example.com\", \"Companies\": [{\"Position\": null, \"EndDate\": \"2012-12-1\", \"Company\": \"Aurostyle Limited\", \"StartDate\": \"2010-6-1\", \"CompanyDuration\": \"June 2010 \u2013 December 2012\"}, {\"Position\": null, \"EndDate\": \"2010-6-1\", \"Company\": \"Waddy Jewellery Group Limited\", \"StartDate\": \"2007-6-1\", \"CompanyDuration\": \"June 2007 \u2013 June 2010\"}]}",
    "time": 128,
    "message": "",
    "ret_code": 0
}

出参result是一个JSON字符串,是一个JsonArray结构,具体结构如下所示。

{
    "Schools": [{
        "School": "The Hong Kong Polytechnic University",
        "StartDate": "2002-1-1",
        "EndDate": "2004-1-1",
        "SchoolDuration": "2002 - 2004"
    }, {
        "School": "University of British Columbia",
        "Degree": "Masters",
        "StartDate": "2000-3-1",
        "DegreeCode": "master",
        "SchoolDuration": ", Mar"
    }, {
        "School": "University of British Columbia",
        "Degree": "Masters",
        "StartDate": "2000-3-1",
        "DegreeCode": "master",
        "SchoolDuration": ", Mar"
    }],
    "Name": "John Smith",
    "Lang": "en",
    "Phone": "+852 1111 1234",
    "CountryCode": "852",
    "RegionalPhone": "11111234",
    "FamilyName": "Smith",
    "GivenName": "John",
    "City": "Hong Kong",
    "Email": "john.*****@example.com",
    "Companies": [{
        "Position": null,
        "EndDate": "2012-12-1",
        "Company": "Aurostyle Limited",
        "StartDate": "2010-6-1",
        "CompanyDuration": "June 2010 \u2013 December 2012"
    }, {
        "Position": null,
        "EndDate": "2010-6-1",
        "Company": "Waddy Jewellery Group Limited",
        "StartDate": "2007-6-1",
        "CompanyDuration": "June 2007 \u2013 June 2010"
    }]
}

支持字段列表

字段名

描述

Name

姓名

Email

邮箱

Phone

联系方式

Address

地址

School

学校

Degree

学位

SchoolDuration

入学就读时间范围

Company

公司

Position

职位

CompanyDuration

公司就职时间范围

  • 本页导读 (0)
文档反馈