This document provides examples of how to use the Resume Extraction service.
This service is provided by the Natural Language Processing (NLP) Self-Learning Platform. To use this service, call the API directly.
Service activation and resource plan purchase
You must activate the service before you can use it. After the service is activated, you can purchase a resource plan.
Activate service: Activation link
Purchase resource plan: Purchase link
Service invocation and debugging
For information about how to invoke the model, see Model invocation.
For software development kit (SDK) examples, see SDK examples.
Debug
Configure access credentials using environment variables
Notes:
The AccessKey pair of an Alibaba Cloud account provides full access to all APIs. This practice poses a high security risk. We recommend that you create and use a Resource Access Management (RAM) user for API calls or routine operations and maintenance (O&M). To create a RAM user, log on to the RAM console.
To prevent your AccessKey pair from being leaked, do not hard-code the AccessKey ID and AccessKey secret in your code. Instead, configure them as environment variables.
Configure on Linux and macOS
export NLP_AK_ENV=<access_key_id> export NLP_SK_ENV=<access_key_secret>Replace <access_key_id> with your AccessKey ID and <access_key_secret> with your AccessKey secret. For more information about how to obtain an AccessKey ID and AccessKey secret, see Step 2: Obtain the AccessKey pair for an account.
Configure on Windows
Create a file for the environment variables. In the file, add the
NLP_AK_ENVandNLP_SK_ENVenvironment variables, and set them to your AccessKey ID and AccessKey secret.Restart Windows.
To call the Resume Extraction (English) service, set the ServiceName parameter to ResumeExtractorEN.
Java code example
/**
* An AccessKey pair of an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat.
* Create and use a Resource Access Management (RAM) user for API calls or routine O&M. To create a RAM user, log on to the RAM console.
* This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
* To prevent key leakage, do not hard-code the AccessKey ID and AccessKey secret in your code.
*/
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 code example
# Install dependencies
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
/**
* An AccessKey pair of an Alibaba Cloud account has permissions to access all APIs. This poses a high security threat.
* Create and use a Resource Access Management (RAM) user for API calls or routine O&M. To create a RAM user, log on to the RAM console.
* This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
* To prevent key leakage, do not hard-code the AccessKey ID and AccessKey secret in your code.
*/
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 example
The PredictContent parameter specifies the resume text.
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 StudiesPredictResult example
The PredictResult parameter returns a JSON string that you must deserialize and parse. The following example shows the data structure.
{
"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
}The `result` response parameter is a JSON string. The following example shows the structure of the parsed string.
{
"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"
}]
}List of supported fields
Field name | Description |
Name | Name |
Phone | Contact information |
Address | Address |
School | School |
Degree | Degree |
SchoolDuration | Enrollment period |
Company | Company |
Position | Position |
CompanyDuration | Employment period |