Class: Azure::CognitiveServices::TextAnalytics::V2_0::TextAnalyticsClient

Inherits:
MsRestAzure::AzureServiceClient
  • Object
show all
Includes:
MsRestAzure, MsRestAzure::Serialization
Defined in:
lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb

Overview

A service client - single point of access to the REST API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials = nil, options = nil) ⇒ TextAnalyticsClient

Creates initializes a new instance of the TextAnalyticsClient class.

Parameters:

  • credentials (MsRest::ServiceClientCredentials) (defaults to: nil)

    credentials to authorize HTTP requests made by the service client.

  • options (Array) (defaults to: nil)

    filters to be applied to the HTTP requests.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 45

def initialize(credentials = nil, options = nil)
  super(credentials, options)
  @base_url = '{Endpoint}/text/analytics/v2.0'

  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_languageString

Returns The preferred language for the response.

Returns:

  • (String)

    The preferred language for the response.



29
30
31
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 29

def accept_language
  @accept_language
end

#base_urlString (readonly)

Returns the base URI of the service.

Returns:

  • (String)

    the base URI of the service.



15
16
17
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 15

def base_url
  @base_url
end

#credentialsObject

subscription.

Returns:

  • Subscription credentials which uniquely identify client



26
27
28
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 26

def credentials
  @credentials
end

#credentials1Object (readonly)

Returns Credentials needed for the client to connect to Azure.

Returns:

  • Credentials needed for the client to connect to Azure.



18
19
20
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 18

def credentials1
  @credentials1
end

#endpointString

hostname, for example: westus.api.cognitive.microsoft.com).

Returns:

  • (String)

    Supported Cognitive Services endpoints (protocol and



22
23
24
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 22

def endpoint
  @endpoint
end

#generate_client_request_idBoolean

generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.

Returns:

  • (Boolean)

    Whether a unique x-ms-client-request-id should be



38
39
40
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 38

def generate_client_request_id
  @generate_client_request_id
end

#long_running_operation_retry_timeoutInteger

Operations. Default value is 30.

Returns:

  • (Integer)

    The retry timeout in seconds for Long Running



33
34
35
# File 'lib/v2.0/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(input, 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.

will be added to the HTTP request.

Parameters:

  • input (BatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (LanguageBatchResult)

    operation results.



242
243
244
245
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 242

def detect_language(input, custom_headers:nil)
  response = detect_language_async(input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#detect_language_async(input, 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.

to the HTTP request.

Parameters:

  • input (BatchInput)

    Collection of documents to analyze.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 275

def detect_language_async(input, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'input is nil' if input.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_0::Models::BatchInput.mapper()
  request_content = self.serialize(request_mapper,  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)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:post, path_template, options)

  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_0::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#detect_language_with_http_info(input, 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.

will be added to the HTTP request.

Parameters:

  • input (BatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



259
260
261
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 259

def detect_language_with_http_info(input, custom_headers:nil)
  detect_language_async(input, custom_headers:custom_headers).value!
end

#entities(input, 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.

will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (EntitiesBatchResult)

    operation results.



461
462
463
464
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 461

def entities(input, custom_headers:nil)
  response = entities_async(input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#entities_async(input, 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.

to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 500

def entities_async(input, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'input is nil' if input.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_0::Models::MultiLanguageBatchInput.mapper()
  request_content = self.serialize(request_mapper,  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)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:post, path_template, options)

  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_0::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#entities_with_http_info(input, 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.

will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



481
482
483
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 481

def entities_with_http_info(input, custom_headers:nil)
  entities_async(input, custom_headers:custom_headers).value!
end

#key_phrases(input, 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.

Documents can now contain a language field to indicate the text language will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (KeyPhraseBatchResult)

    operation results.



132
133
134
135
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 132

def key_phrases(input, custom_headers:nil)
  response = key_phrases_async(input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#key_phrases_async(input, 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.

Documents can now contain a language field to indicate the text language to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
226
227
228
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 173

def key_phrases_async(input, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'input is nil' if input.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_0::Models::MultiLanguageBatchInput.mapper()
  request_content = self.serialize(request_mapper,  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)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:post, path_template, options)

  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_0::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#key_phrases_with_http_info(input, 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.

Documents can now contain a language field to indicate the text language will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



153
154
155
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 153

def key_phrases_with_http_info(input, custom_headers:nil)
  key_phrases_async(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"
options = {
  body: request_content,
  query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, options)

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Hash{String=>String})

    containing the body of the response.



74
75
76
77
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 74

def make_request(method, path, options = {})
  result = make_request_with_http_info(method, path, options)
  result.body unless result.nil?
end

#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise

Makes a request asynchronously.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 99

def make_request_async(method, path, options = {})
  fail ArgumentError, 'method is nil' if method.nil?
  fail ArgumentError, 'path is nil' if path.nil?

  request_url = options[:base_url] || @base_url
  if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
    @request_headers['Content-Type'] = options[:headers]['Content-Type']
  end

  request_headers = @request_headers
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
  options.merge!({headers: request_headers.merge(options[:headers] || {})})
  options.merge!({credentials: @credentials}) unless @credentials.nil?

  super(request_url, method, path, options)
end

#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse

Makes a request and returns the operation response.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (MsRestAzure::AzureOperationResponse)

    Operation response containing the request, response and status.



86
87
88
89
90
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 86

def make_request_with_http_info(method, path, options = {})
  result = make_request_async(method, path, options).value!
  result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
  result
end

#sentiment(input, custom_headers: nil) ⇒ SentimentBatchResult

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.

will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (SentimentBatchResult)

    operation results.



348
349
350
351
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 348

def sentiment(input, custom_headers:nil)
  response = sentiment_async(input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#sentiment_async(input, 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.

to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
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
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 389

def sentiment_async(input, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'input is nil' if input.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_0::Models::MultiLanguageBatchInput.mapper()
  request_content = self.serialize(request_mapper,  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)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:post, path_template, options)

  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_0::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.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#sentiment_with_http_info(input, 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.

will be added to the HTTP request.

Parameters:

  • input (MultiLanguageBatchInput)

    Collection of documents to analyze.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



369
370
371
# File 'lib/v2.0/generated/azure_cognitiveservices_textanalytics/text_analytics_client.rb', line 369

def sentiment_with_http_info(input, custom_headers:nil)
  sentiment_async(input, custom_headers:custom_headers).value!
end