获取SDK

dotnet add package aliyun-net-sdk-nlp-automl

使用示例

using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Nlp_automl.Model.V20191111;

class Program
{
    static void Main(string[] args)
    {
        // 构建一个 Client,用于发起请求
        IClientProfile profile = DefaultProfile.GetProfile(
            "<your-region-id>",
            "<your-access-key-id>",
            "<your-access-key-secret>");
        DefaultAcsClient client = new DefaultAcsClient(profile);

        try
        {
            // 构造请求
            GetPredictResultRequest request = new GetPredictResultRequest();
            request.modelId = 1818;
            request.content = "中华人民共和国人民解放军";

            // 发起请求,并得到 Response
            GetPredictResultResponse response = client.GetAcsResponse(request);
            System.Console.WriteLine(response.content);
        }
        catch (ServerException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
        catch (ClientException ex)
        {
            System.Console.WriteLine(ex.ToString());
        }
    }
}