全部产品

简历抽取(英文)服务

更新时间:2020-08-26 14:23

简历抽取服务使用示例。

Java代码示例

  1. DefaultProfile defaultProfile = DefaultProfile.getProfile("cn-hangzhou","your-access-key-id","your-access-key-secret");
  2. IAcsClient client = new DefaultAcsClient(defaultProfile);
  3. String content = "Resume Text";
  4. RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
  5. request.setServiceName("ResumeExtractorEN");
  6. request.setPredictContent(content);
  7. RunPreTrainServiceResponse response = client.getAcsResponse(request);
  8. System.out.println(response.getPredictResult());

Python代码示例

  1. # 安装依赖
  2. pip install aliyun-python-sdk-core
  3. pip install aliyun-python-sdk-nlp-automl
  1. # -*- coding: utf8 -*-
  2. import json
  3. from aliyunsdkcore.client import AcsClient
  4. from aliyunsdkcore.acs_exception.exceptions import ClientException
  5. from aliyunsdkcore.acs_exception.exceptions import ServerException
  6. from aliyunsdknlp_automl.request.v20191111 import RunPreTrainServiceRequest
  7. # Initialize AcsClient instance
  8. client = AcsClient(
  9. "<your-access-key-id>",
  10. "<your-access-key-secret>",
  11. "cn-hangzhou"
  12. );
  13. content = 'Resume Text'
  14. # Initialize a request and set parameters
  15. request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
  16. request.set_ServiceName('ResumeExtractorEN')
  17. request.set_PredictContent(content)
  18. # Print response
  19. response = client.do_action_with_exception(request)
  20. resp_obj = json.loads(response)
  21. predict_result = json.loads(resp_obj['PredictResult'])
  22. print(predict_result['result'])
说明 调用简历抽取(英文)服务,ServiceName需要传入:ResumeExtractorEN

PredictContent内容示例

说明 PredictContent参数为简历文本参数。

PredictResult内容示例

说明 PredictResult是JSON字符串,需要反序列化之后进行解析,具体结构如下示例。
  1. {
  2. "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.smith@gmail.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\"}]}",
  3. "time": 128,
  4. "message": "",
  5. "ret_code": 0
  6. }

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

  1. {
  2. "Schools": [{
  3. "School": "The Hong Kong Polytechnic University",
  4. "StartDate": "2002-1-1",
  5. "EndDate": "2004-1-1",
  6. "SchoolDuration": "2002 - 2004"
  7. }, {
  8. "School": "University of British Columbia",
  9. "Degree": "Masters",
  10. "StartDate": "2000-3-1",
  11. "DegreeCode": "master",
  12. "SchoolDuration": ", Mar"
  13. }, {
  14. "School": "University of British Columbia",
  15. "Degree": "Masters",
  16. "StartDate": "2000-3-1",
  17. "DegreeCode": "master",
  18. "SchoolDuration": ", Mar"
  19. }],
  20. "Name": "John Smith",
  21. "Lang": "en",
  22. "Phone": "+852 1111 1234",
  23. "CountryCode": "852",
  24. "RegionalPhone": "11111234",
  25. "FamilyName": "Smith",
  26. "GivenName": "John",
  27. "City": "Hong Kong",
  28. "Email": "john.smith@gmail.com",
  29. "Companies": [{
  30. "Position": null,
  31. "EndDate": "2012-12-1",
  32. "Company": "Aurostyle Limited",
  33. "StartDate": "2010-6-1",
  34. "CompanyDuration": "June 2010 \u2013 December 2012"
  35. }, {
  36. "Position": null,
  37. "EndDate": "2010-6-1",
  38. "Company": "Waddy Jewellery Group Limited",
  39. "StartDate": "2007-6-1",
  40. "CompanyDuration": "June 2007 \u2013 June 2010"
  41. }]
  42. }