簡歷抽取服務使用示例。
本服務由NLP自學習平臺提供,直接調用API即可使用。
服務開通與資源包購買
使用前,請確認是否已經開通服務,開通后可購買資源包。
服務調用與調試
模型調用文檔參考:模型調用
SDK示例文檔參考:SDK示例
調試
您可以在OpenAPI開發者門戶中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI開發者門戶可以自動生成SDK代碼示例。
通過環境變量配置訪問憑證(AKSK)
說明:
阿里云賬號AccessKey擁有所有API的訪問權限,風險很高。強烈建議您創建并使用RAM用戶進行API訪問或日常運維,請登錄RAM控制臺創建RAM用戶。
強烈建議不要把AccessKey和AccessKeySecret保存到代碼里,會存在密鑰泄漏風險,在此提供通過配置環境變量的方式來保存和訪問aksk
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
Windows系統配置方法
新建環境變量文件,添加環境變量
NLP_AK_ENV
和NLP_SK_ENV
,并寫入已準備好的AccessKey ID和AccessKey Secret。重啟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 | 姓名 |
郵箱 | |
Phone | 聯系方式 |
Address | 地址 |
School | 學校 |
Degree | 學位 |
SchoolDuration | 入學就讀時間范圍 |
Company | 公司 |
Position | 職位 |
CompanyDuration | 公司就職時間范圍 |