共用方式為


TextAnalysisClient.AnalyzeTextSubmitOperationAsync Method

Definition

Overloads

AnalyzeTextSubmitOperationAsync(WaitUntil, RequestContent, RequestContext)

[Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

AnalyzeTextSubmitOperationAsync(WaitUntil, MultiLanguageTextInput, IEnumerable<AnalyzeTextOperationAction>, String, String, CancellationToken)

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

AnalyzeTextSubmitOperationAsync(WaitUntil, RequestContent, RequestContext)

Source:
TextAnalysisClient.cs

[Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

public virtual System.Threading.Tasks.Task<Azure.Operation> AnalyzeTextSubmitOperationAsync (Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
override this.AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Operation>
Public Overridable Function AnalyzeTextSubmitOperationAsync (waitUntil As WaitUntil, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Operation)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The Operation representing an asynchronous operation on the service.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    analysisInput = new object(),
    tasks = new object[]
    {
        new
        {
            kind = "CustomEntityRecognition",
        }
    },
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

This sample shows how to call AnalyzeTextSubmitOperationAsync with all parameters and request content.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    displayName = "<displayName>",
    analysisInput = new
    {
        documents = new object[]
        {
            new
            {
                id = "<id>",
                text = "<text>",
                language = "<language>",
            }
        },
    },
    tasks = new object[]
    {
        new
        {
            kind = "CustomEntityRecognition",
            parameters = new
            {
                loggingOptOut = true,
                projectName = "<projectName>",
                deploymentName = "<deploymentName>",
                stringIndexType = "TextElements_v8",
            },
            taskName = "<taskName>",
        }
    },
    defaultLanguage = "<defaultLanguage>",
});
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content);

Applies to

AnalyzeTextSubmitOperationAsync(WaitUntil, MultiLanguageTextInput, IEnumerable<AnalyzeTextOperationAction>, String, String, CancellationToken)

Source:
TextAnalysisClient.cs

Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation.

public virtual System.Threading.Tasks.Task<Azure.Operation> AnalyzeTextSubmitOperationAsync (Azure.WaitUntil waitUntil, Azure.AI.Language.Text.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable<Azure.AI.Language.Text.AnalyzeTextOperationAction> actions, string displayName = default, string defaultLanguage = default, System.Threading.CancellationToken cancellationToken = default);
abstract member AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.AI.Language.Text.MultiLanguageTextInput * seq<Azure.AI.Language.Text.AnalyzeTextOperationAction> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Operation>
override this.AnalyzeTextSubmitOperationAsync : Azure.WaitUntil * Azure.AI.Language.Text.MultiLanguageTextInput * seq<Azure.AI.Language.Text.AnalyzeTextOperationAction> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Operation>
Public Overridable Function AnalyzeTextSubmitOperationAsync (waitUntil As WaitUntil, textInput As MultiLanguageTextInput, actions As IEnumerable(Of AnalyzeTextOperationAction), Optional displayName As String = Nothing, Optional defaultLanguage As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Operation)

Parameters

waitUntil
WaitUntil

Completed if the method should wait to return until the long-running operation has completed on the service; Started if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.

textInput
MultiLanguageTextInput

Contains the input to be analyzed.

actions
IEnumerable<AnalyzeTextOperationAction>

List of tasks to be performed as part of the LRO.

displayName
String

Name for the task.

defaultLanguage
String

Default language to use for records requesting automatic language detection.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

textInput or actions is null.

Examples

This sample shows how to call AnalyzeTextSubmitOperationAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput();
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new CustomEntitiesOperationAction()
});

This sample shows how to call AnalyzeTextSubmitOperationAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
TextAnalysisClient client = new TextAnalysisClient(endpoint, credential);

MultiLanguageTextInput textInput = new MultiLanguageTextInput
{
    MultiLanguageInputs = {new MultiLanguageInput("<id>", "<text>")
    {
        Language = "<language>",
    }},
};
Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[]
{
    new CustomEntitiesOperationAction
    {
        ActionContent = new CustomEntitiesActionContent("<projectName>", "<deploymentName>")
        {
            LoggingOptOut = true,
            StringIndexType = StringIndexType.TextElementsV8,
        },
        Name = "<taskName>",
    }
}, displayName: "<displayName>", defaultLanguage: "<defaultLanguage>");

Applies to