日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

事件抽取(英文)

說明

本服務由NLP自學習平臺提供,直接調用API即可使用。

事件抽取(英文)服務適用于對英文新聞事件抽取,包含如下事件類別:

‘Personnel.Nominate’

‘Contact.Phone-Write’

‘Business.Declare-Bankruptcy’

‘Justice.Release-Parole’

‘Justice.Extradite’

‘Personnel.Start-Position’

‘Justice.Fine’

‘Transaction.Transfer-Money’

‘Personnel.End-Position’

‘Justice.Acquit’

‘Life.Injure’

‘Conflict.Attack’

‘Justice.Arrest-Jail’

‘Justice.Pardon’

‘Justice.Charge-Indict’

‘Conflict.Demonstrate’

‘Contact.Meet’

‘Business.End-Org’

‘Life.Be-Born’

‘Personnel.Elect’

‘Justice.Trial-Hearing’

‘Life.Divorce’

‘Justice.Sue’

‘Justice.Appeal’

‘Business.Merge-Org’

‘Life.Die’

‘Business.Start-Org’

‘Justice.Convict’

‘Movement.Transport’

‘Life.Marry’

‘Justice.Sentence’

‘Justice.Execute’

‘Transaction.Transfer-Ownership’

服務開通與資源包購買

使用前,請確認是否已經開通服務,開通后可購買資源包。

服務調用與調試

模型調用文檔參考:模型調用

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系統。

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);
Map<String, Object> map = new HashMap<>();
String text = "As part of the 11-billion-dollar sale of USA Interactive's film and television operations to the French media company in December 2001, USA Interactive received 2.5 billion dollars in preferred shares in Vivendi Universal Entertainment.";
map.put("text", text);
RunPreTrainServiceRequest request = new RunPreTrainServiceRequest();
request.setServiceName("NLP-Event-Extraction-En");
request.setPredictContent(JSON.toJSONString(map));
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"
);
text = "As part of the 11-billion-dollar sale of USA Interactive's film and television operations to the French media company in December 2001, USA Interactive received 2.5 billion dollars in preferred shares in Vivendi Universal Entertainment."
content ={"text": text}
# Initialize a request and set parameters
request = RunPreTrainServiceRequest.RunPreTrainServiceRequest()
request.set_ServiceName('NLP-Event-Extraction-En')
request.set_PredictContent(json.dumps(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['predictions'])

PredictContent內容示例

{
  "messages":  "As part of the 11-billion-dollar sale of USA Interactive's film and television operations to the French media company in December 2001, USA Interactive received 2.5 billion dollars in preferred shares in Vivendi Universal Entertainment."
}

PredictResult內容示例

{
  "predictions":"As part of the 11-billion-dollar <event type = Transaction.Transfer-Ownership>sale<event> of USA Interactive's film and television operations to the French media company in December 2001, USA Interactive <event type = Transaction.Transfer-Money>received<event> 2.5 billion dollars in preferred shares in Vivendi Universal Entertainment ."
}

入參說明

參數

說明

text

待預測文本

出參說明

參數

說明

predictions

原文本上標注事件