This document provides examples of how to use the Resume Extraction service.
This service is provided by the NLP Self-learning Platform. To use this service, you must call the API directly.
Service activation and resource plan purchase
Before you begin, confirm that the service is activated. After the service is activated, you can purchase a resource plan.
Activate the service: Activation page
Purchase a resource plan: Purchase page
Service invocation and debugging
For more information about model invocation, see Model Invocation.
For software development kit (SDK) examples, see SDK Examples.
Debug
Configure access credentials using environment variables
Notes:
An AccessKey pair of an Alibaba Cloud account has full access permissions to all APIs. This poses a high security risk. We strongly recommend that you create and use a Resource Access Management (RAM) user for API calls and routine Operations and Maintenance (O&M). To create a RAM user, log on to the RAM console.
To prevent security risks associated with key leakage, do not hardcode your AccessKey ID and AccessKey secret into your code. Instead, configure environment variables to store and access your AccessKey pair.
Configure the environment variables 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 an AccessKey secret, see Step 2: Obtain an AccessKey pair.
Configuration method for a Windows system
Create a file for the environment variables. In the file, add the
NLP_AK_ENVandNLP_SK_ENVenvironment variables and set their values to your AccessKey ID and AccessKey secret.Restart Windows.
To call the Resume Extraction (Chinese) service, set the ServiceName parameter to ResumeExtractorZH.
Java code example
/**
* An AccessKey pair of an Alibaba Cloud account has full access permissions to all APIs. This poses a high security risk. We strongly recommend that you create and use a RAM user for API calls and 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 security risks associated with key leakage, do not hardcode your AccessKey ID and AccessKey secret into 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("ResumeExtractorZH");
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 full access permissions to all APIs. This poses a high security risk. We strongly recommend that you create and use a RAM user for API calls and 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 security risks associated with key leakage, do not hardcode your AccessKey ID and AccessKey secret into 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('ResumeExtractorZH')
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 Doe ID:6111****
1390000****
j****@example.com
Male|29 years old (1990/07/27)|Currently living in Nanjing-** District|8 years of work experience
Position: Software Test EngineerPredictResult example
The PredictResult is a JSON string that you must deserialize and parse. The following example shows the structure of the string. The `result` response parameter is a JSON string in a JSONArray structure.
{
"ret_code": 0,
"result": [{
"id": 0,
"tags": [{
"class": "Name",
"source": "rule",
"span": "John Doe"
}],
"sentence": "John Doe ID:6111****",
"sent_offsets": 0
}, {
"id": 0,
"tags": [{
"conf": 0,
"class": "Mobile Number",
"span": "1390000****",
"start": 0,
"source": "model",
"end": 11
}],
"sentence": "1390000****",
"sent_offsets": 2
}, {
"id": 0,
"tags": [{
"class": "Email",
"source": "rule",
"span": "j****@example.com"
}],
"sentence": "j****@example.com",
"sent_offsets": 3
}, {
"id": 0,
"tags": [{
"conf": 0,
"class": "Date of Birth",
"span": "1990/07/27",
"start": 8,
"source": "model",
"end": 18
}, {
"class": "Gender",
"source": "rule",
"span": "Male"
}],
"sentence": "Male|29 years old (1990/07/27)|Currently living in Nanjing-** District|8 years of work experience",
"sent_offsets": 4
}, {
"id": 0,
"tags": [{
"conf": 0,
"class": "Position Name",
"span": "Software Test Engineer",
"start": 4,
"source": "model",
"end": 11
}],
"sentence": "Position: Software Test Engineer",
"sent_offsets": 6
}],
"message": "",
"time": 143
}List of supported fields
Field name | Description |
Name | |
Gender | |
Ethnicity | |
Date of Birth | Directly extracted, not normalized. |
Native Place | |
Current Residence | |
Political Status | |
Mobile Number | |
Highest Education Level | |
Highest Degree | |
Mailing Address | |
Home Address | |
Expected Work Location | |
Expected Position | |
Current Annual Salary | |
Expected Annual Salary | |
Graduating Institution | |
Enrollment Date | Directly extracted, not normalized. |
Graduation Date | Directly extracted, not normalized. |
Education Level | |
Degree | |
Employer | |
Start time | Directly extracted, not normalized. |
End Time | Directly extracted, not normalized. |
Position Name | |
Job Description | |
Height | |
Weight | |
Self-assessment | |
Hobbies | |
English Test Type | |
English Test Score |