Class: Azure::CognitiveServices::TextAnalytics::V2_1::TextAnalyticsClient
- Inherits:
-
MsRestAzure::AzureServiceClient
- Object
- MsRestAzure::AzureServiceClient
- Azure::CognitiveServices::TextAnalytics::V2_1::TextAnalyticsClient
- Includes:
- MsRestAzure, MsRestAzure::Serialization
- Defined in:
- lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb
Overview
A service client - single point of access to the REST API.
Instance Attribute Summary collapse
-
#accept_language ⇒ String
The preferred language for the response.
-
#base_url ⇒ String
readonly
The base URI of the service.
-
#credentials ⇒ Object
subscription.
-
#credentials1 ⇒ Object
readonly
Credentials needed for the client to connect to Azure.
-
#endpoint ⇒ String
hostname, for example: westus.api.cognitive.microsoft.com).
-
#generate_client_request_id ⇒ Boolean
generated.
-
#long_running_operation_retry_timeout ⇒ Integer
Operations.
Instance Method Summary collapse
-
#detect_language(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ LanguageBatchResult
The API returns the detected language and a numeric score between 0 and 1.
-
#detect_language_async(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns the detected language and a numeric score between 0 and 1.
-
#detect_language_with_http_info(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns the detected language and a numeric score between 0 and 1.
-
#entities(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ EntitiesBatchResult
The API returns a list of recognized entities in a given document.
-
#entities_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a list of recognized entities in a given document.
-
#entities_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a list of recognized entities in a given document.
-
#initialize(credentials = nil, options = nil) ⇒ TextAnalyticsClient
constructor
Creates initializes a new instance of the TextAnalyticsClient class.
-
#key_phrases(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ KeyPhraseBatchResult
The API returns a list of strings denoting the key talking points in the input text.
-
#key_phrases_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a list of strings denoting the key talking points in the input text.
-
#key_phrases_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a list of strings denoting the key talking points in the input text.
-
#make_request(method, path, options = {}) ⇒ Hash{String=>String}
Makes a request and returns the body of the response.
-
#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise
Makes a request asynchronously.
-
#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse
Makes a request and returns the operation response.
-
#sentiment(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Object
The API returns a numeric score between 0 and 1.
-
#sentiment_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a numeric score between 0 and 1.
-
#sentiment_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a numeric score between 0 and 1.
Constructor Details
#initialize(credentials = nil, options = nil) ⇒ TextAnalyticsClient
Creates initializes a new instance of the TextAnalyticsClient class.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 45 def initialize(credentials = nil, = nil) super(credentials, ) @base_url = '{Endpoint}/text/analytics/v2.1' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end |
Instance Attribute Details
#accept_language ⇒ String
Returns The preferred language for the response.
29 30 31 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 29 def accept_language @accept_language end |
#base_url ⇒ String (readonly)
Returns the base URI of the service.
15 16 17 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 15 def base_url @base_url end |
#credentials ⇒ Object
subscription.
26 27 28 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 26 def credentials @credentials end |
#credentials1 ⇒ Object (readonly)
Returns Credentials needed for the client to connect to Azure.
18 19 20 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 18 def credentials1 @credentials1 end |
#endpoint ⇒ String
hostname, for example: westus.api.cognitive.microsoft.com).
22 23 24 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 22 def endpoint @endpoint end |
#generate_client_request_id ⇒ Boolean
generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
38 39 40 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 38 def generate_client_request_id @generate_client_request_id end |
#long_running_operation_retry_timeout ⇒ Integer
Operations. Default value is 30.
33 34 35 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 33 def long_running_operation_retry_timeout @long_running_operation_retry_timeout end |
Instance Method Details
#detect_language(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ LanguageBatchResult
The API returns the detected language and a numeric score between 0 and 1.
Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.
input and document level statistics. analyze. will be added to the HTTP request.
131 132 133 134 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 131 def detect_language(show_stats:nil, language_batch_input:nil, custom_headers:nil) response = detect_language_async(show_stats:show_stats, language_batch_input:language_batch_input, custom_headers:custom_headers).value! response.body unless response.nil? end |
#detect_language_async(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns the detected language and a numeric score between 0 and 1.
Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.
input and document level statistics. analyze. to the HTTP request.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 170 def detect_language_async(show_stats:nil, language_batch_input:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::LanguageBatchInput.mapper() request_content = self.serialize(request_mapper, language_batch_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'languages' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'showStats' => show_stats}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::LanguageBatchResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#detect_language_with_http_info(show_stats: nil, language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns the detected language and a numeric score between 0 and 1.
Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.
input and document level statistics. analyze. will be added to the HTTP request.
151 152 153 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 151 def detect_language_with_http_info(show_stats:nil, language_batch_input:nil, custom_headers:nil) detect_language_async(show_stats:show_stats, language_batch_input:language_batch_input, custom_headers:custom_headers).value! end |
#entities(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ EntitiesBatchResult
The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages”>Supported languages in Text Analytics API</a> for the list of enabled languages.
input and document level statistics. documents to analyze. will be added to the HTTP request.
245 246 247 248 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 245 def entities(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) response = entities_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! response.body unless response.nil? end |
#entities_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages”>Supported languages in Text Analytics API</a> for the list of enabled languages.
input and document level statistics. documents to analyze. to the HTTP request.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 290 def entities_async(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::MultiLanguageBatchInput.mapper() request_content = self.serialize(request_mapper, multi_language_batch_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'entities' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'showStats' => show_stats}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::EntitiesBatchResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#entities_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages”>Supported languages in Text Analytics API</a> for the list of enabled languages.
input and document level statistics. documents to analyze. will be added to the HTTP request.
268 269 270 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 268 def entities_with_http_info(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) entities_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! end |
#key_phrases(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ KeyPhraseBatchResult
The API returns a list of strings denoting the key talking points in the input text.
See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.
input and document level statistics. documents to analyze. Documents can now contain a language field to indicate the text language will be added to the HTTP request.
366 367 368 369 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 366 def key_phrases(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) response = key_phrases_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! response.body unless response.nil? end |
#key_phrases_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a list of strings denoting the key talking points in the input text.
See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.
input and document level statistics. documents to analyze. Documents can now contain a language field to indicate the text language to the HTTP request.
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 413 def key_phrases_async(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::MultiLanguageBatchInput.mapper() request_content = self.serialize(request_mapper, multi_language_batch_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'keyPhrases' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'showStats' => show_stats}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::KeyPhraseBatchResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#key_phrases_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a list of strings denoting the key talking points in the input text.
See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.
input and document level statistics. documents to analyze. Documents can now contain a language field to indicate the text language will be added to the HTTP request.
390 391 392 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 390 def key_phrases_with_http_info(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) key_phrases_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! end |
#make_request(method, path, options = {}) ⇒ Hash{String=>String}
Makes a request and returns the body of the response. Example:
request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
path = "/path"
= {
body: request_content,
query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, )
74 75 76 77 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 74 def make_request(method, path, = {}) result = make_request_with_http_info(method, path, ) result.body unless result.nil? end |
#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise
Makes a request asynchronously.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 99 def make_request_async(method, path, = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = [:base_url] || @base_url if(![:headers].nil? && ![:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = [:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? .merge!({headers: request_headers.merge([:headers] || {})}) .merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, ) end |
#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse
Makes a request and returns the operation response.
86 87 88 89 90 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 86 def make_request_with_http_info(method, path, = {}) result = make_request_async(method, path, ).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end |
#sentiment(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Object
The API returns a numeric score between 0 and 1.
Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.
input and document level statistics. documents to analyze. will be added to the HTTP request.
489 490 491 492 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 489 def sentiment(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) response = sentiment_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! response.body unless response.nil? end |
#sentiment_async(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ Concurrent::Promise
The API returns a numeric score between 0 and 1.
Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.
input and document level statistics. documents to analyze. to the HTTP request.
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 536 def sentiment_async(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) fail ArgumentError, 'endpoint is nil' if endpoint.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::MultiLanguageBatchInput.mapper() request_content = self.serialize(request_mapper, multi_language_batch_input) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'sentiment' request_url = @base_url || self.base_url request_url = request_url.gsub('{Endpoint}', endpoint) = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'showStats' => show_stats}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:post, path_template, ) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 500 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::SentimentBatchResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end # Deserialize Response if status_code == 500 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::TextAnalytics::V2_1::Models::ErrorResponse.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#sentiment_with_http_info(show_stats: nil, multi_language_batch_input: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse
The API returns a numeric score between 0 and 1.
Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the <a href=“docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.
input and document level statistics. documents to analyze. will be added to the HTTP request.
513 514 515 |
# File 'lib/v2.1/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 513 def sentiment_with_http_info(show_stats:nil, multi_language_batch_input:nil, custom_headers:nil) sentiment_async(show_stats:show_stats, multi_language_batch_input:multi_language_batch_input, custom_headers:custom_headers).value! end |