コード例 #1
0
        /// <summary>
        /// The API returns a list of general named entities in a given document. For the list of supported entity types,
        /// check <see href="https://aka.ms/taner">Supported Entity Types in Text Analytics API</see>. See the
        /// <see href="https://aka.ms/talangs">Supported languages in Text Analytics API</see> for the list of enabled languages.
        /// </summary>
        /// <param name="body">The request body</param>
        /// <param name="modelVersion">
        /// This value indicates which model will be used for scoring. If a modelVersion is not specified,
        /// the API should default to the latest, non-preview version.
        /// </param>
        /// <param name="showStats">if set to true, response will contain input and document level statistics.</param>
        /// <param name="cancellationToken">A token to check for cancellation.</param>
        /// <returns>
        /// A task which represents the response of the operation.
        /// </returns>
        /// <remarks>
        /// The <see href="https://westus2.dev.cognitive.microsoft.com/docs/services/TextAnalytics-v3-0/operations/EntitiesRecognitionGeneral">
        /// REST API Documentation</see> has more information on the body of the request and the response.
        /// </remarks>
        public virtual async Task <DynamicResponse> GetEntitiesAsync(JsonData body, string modelVersion = null, bool?showStats = null, CancellationToken cancellationToken = default)
        {
            DynamicRequest req = GetEntitiesRequest();

            req.Content = DynamicContent.Create(body);
            return(await req.SendAsync(cancellationToken).ConfigureAwait(false));
        }
コード例 #2
0
        /// <summary>
        /// The API returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral
        /// for the document and each sentence within it. See the <see href="https://aka.ms/talangs">Supported languages in Text
        /// Analytics API</see> for the list of enabled languages.
        /// </summary>
        /// <param name="body">The request body</param>
        /// <param name="modelVersion">
        /// This value indicates which model will be used for scoring. If a modelVersion is not specified,
        /// the API should default to the latest, non-preview version.
        /// </param>
        /// <param name="showStats">if set to true, response will contain input and document level statistics.</param>
        /// <param name="cancellationToken">A token to check for cancellation.</param>
        /// <returns>
        /// The response of the operation.
        /// </returns>
        /// <remarks>
        /// The <see href="https://westus2.dev.cognitive.microsoft.com/docs/services/TextAnalytics-v3-0/operations/Sentiment">
        /// REST API Documentation</see> has more information on the body of the request and the response.
        /// </remarks>
        public virtual DynamicResponse GetSentiment(dynamic body, string modelVersion = null, bool?showStats = null, CancellationToken cancellationToken = default)
        {
            DynamicRequest req = GetSentimentRequest(modelVersion, showStats);

            req.Content = DynamicContent.Create(ToJsonData(body));

            return(req.Send(cancellationToken));
        }