cloudmersive-nlp-api-client 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 472b8b5e390d99dc11041638db86957ea823d9ded3df7bca25e6ae8b8e00683b
4
- data.tar.gz: 65dec04e143972cc66c6a874388bda1e39c86d0cbe2baf47add69acf3e0f5360
3
+ metadata.gz: 7c8e2b872f0162f9be0edb73d8d5698f89bed94c68fc004568c9e8f9bfc8105f
4
+ data.tar.gz: a021b359dd6a834419c20b818c93383768ea1e9a51ec9f94003b567efb552290
5
5
  SHA512:
6
- metadata.gz: dcc590c78e866b975d66a25bf2f38a88b19ef8b7aa7e0602eeafd24b8ac5be43d3fa41c91f32c68193cde3e9cf94aac5eaa2e9fc23b50072d3e41d51d183d9ea
7
- data.tar.gz: 5f368075985441c467652a5e49ef92fd2c3f7d9078b0437b06a9bba8c7d78611694aa19835a86d903a6277280d3d884e2eaf53bd27a3daebd661fedd722489bd
6
+ metadata.gz: e3b5bd017e0c6b346c78e8a1382d1134663942a3560197e9b5ae7343285c78f499d8e4ce2d0fe97ab8846576d5996c99a976dce3c053f8037ad1bd13d959044b
7
+ data.tar.gz: ac5ae096258d34ca10839290c3d0e4b3866241988005baf2f5b2fac2b6fac804158359dfd9e3a5e08728006a7e512aee53f42207866bd6d1d1d55cf9c0beaf59
data/README.md CHANGED
@@ -7,7 +7,7 @@ The powerful Natural Language Processing APIs (v2) let you perform part of speec
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
9
  - API version: v1
10
- - Package version: 2.0.4
10
+ - Package version: 2.0.5
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -23,15 +23,15 @@ gem build cloudmersive-nlp-api-client.gemspec
23
23
  Then either install the gem locally:
24
24
 
25
25
  ```shell
26
- gem install ./cloudmersive-nlp-api-client-2.0.4.gem
26
+ gem install ./cloudmersive-nlp-api-client-2.0.5.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-nlp-api-client-2.0.4.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-nlp-api-client-2.0.5.gem` to install the development dependencies)
29
29
 
30
30
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
31
31
 
32
32
  Finally add this to the Gemfile:
33
33
 
34
- gem 'cloudmersive-nlp-api-client', '~> 2.0.4'
34
+ gem 'cloudmersive-nlp-api-client', '~> 2.0.5'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -62,17 +62,17 @@ CloudmersiveNlpApiClient.configure do |config|
62
62
  #config.api_key_prefix['Apikey'] = 'Bearer'
63
63
  end
64
64
 
65
- api_instance = CloudmersiveNlpApiClient::ExtractEntitiesApi.new
65
+ api_instance = CloudmersiveNlpApiClient::AnalyticsApi.new
66
66
 
67
- value = CloudmersiveNlpApiClient::ExtractEntitiesRequest.new # ExtractEntitiesRequest | Input string
67
+ input = CloudmersiveNlpApiClient::SentimentAnalysisRequest.new # SentimentAnalysisRequest | Input sentiment analysis request
68
68
 
69
69
 
70
70
  begin
71
- #Extract entities from string
72
- result = api_instance.extract_entities_post(value)
71
+ #Perform Sentiment Analysis and Classification on Text
72
+ result = api_instance.analytics_sentiment(input)
73
73
  p result
74
74
  rescue CloudmersiveNlpApiClient::ApiError => e
75
- puts "Exception when calling ExtractEntitiesApi->extract_entities_post: #{e}"
75
+ puts "Exception when calling AnalyticsApi->analytics_sentiment: #{e}"
76
76
  end
77
77
 
78
78
  ```
@@ -83,6 +83,7 @@ All URIs are relative to *https://api.cloudmersive.com*
83
83
 
84
84
  Class | Method | HTTP request | Description
85
85
  ------------ | ------------- | ------------- | -------------
86
+ *CloudmersiveNlpApiClient::AnalyticsApi* | [**analytics_sentiment**](docs/AnalyticsApi.md#analytics_sentiment) | **POST** /nlp-v2/analytics/sentiment | Perform Sentiment Analysis and Classification on Text
86
87
  *CloudmersiveNlpApiClient::ExtractEntitiesApi* | [**extract_entities_post**](docs/ExtractEntitiesApi.md#extract_entities_post) | **POST** /nlp-v2/extract-entities | Extract entities from string
87
88
  *CloudmersiveNlpApiClient::LanguageDetectionApi* | [**language_detection_get_language**](docs/LanguageDetectionApi.md#language_detection_get_language) | **POST** /nlp-v2/language/detect | Detect language of text
88
89
  *CloudmersiveNlpApiClient::LanguageTranslationApi* | [**language_translation_translate_deu_to_eng**](docs/LanguageTranslationApi.md#language_translation_translate_deu_to_eng) | **POST** /nlp-v2/translate/language/deu/to/eng | Translate German to English text with Deep Learning AI
@@ -131,6 +132,8 @@ Class | Method | HTTP request | Description
131
132
  - [CloudmersiveNlpApiClient::RephrasedSentenceOption](docs/RephrasedSentenceOption.md)
132
133
  - [CloudmersiveNlpApiClient::SentenceSegmentationRequest](docs/SentenceSegmentationRequest.md)
133
134
  - [CloudmersiveNlpApiClient::SentenceSegmentationResponse](docs/SentenceSegmentationResponse.md)
135
+ - [CloudmersiveNlpApiClient::SentimentAnalysisRequest](docs/SentimentAnalysisRequest.md)
136
+ - [CloudmersiveNlpApiClient::SentimentAnalysisResponse](docs/SentimentAnalysisResponse.md)
134
137
  - [CloudmersiveNlpApiClient::WordPosition](docs/WordPosition.md)
135
138
 
136
139
 
@@ -0,0 +1,63 @@
1
+ # CloudmersiveNlpApiClient::AnalyticsApi
2
+
3
+ All URIs are relative to *https://api.cloudmersive.com*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**analytics_sentiment**](AnalyticsApi.md#analytics_sentiment) | **POST** /nlp-v2/analytics/sentiment | Perform Sentiment Analysis and Classification on Text
8
+
9
+
10
+ # **analytics_sentiment**
11
+ > SentimentAnalysisResponse analytics_sentiment(input)
12
+
13
+ Perform Sentiment Analysis and Classification on Text
14
+
15
+ Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'cloudmersive-nlp-api-client'
21
+ # setup authorization
22
+ CloudmersiveNlpApiClient.configure do |config|
23
+ # Configure API key authorization: Apikey
24
+ config.api_key['Apikey'] = 'YOUR API KEY'
25
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
26
+ #config.api_key_prefix['Apikey'] = 'Bearer'
27
+ end
28
+
29
+ api_instance = CloudmersiveNlpApiClient::AnalyticsApi.new
30
+
31
+ input = CloudmersiveNlpApiClient::SentimentAnalysisRequest.new # SentimentAnalysisRequest | Input sentiment analysis request
32
+
33
+
34
+ begin
35
+ #Perform Sentiment Analysis and Classification on Text
36
+ result = api_instance.analytics_sentiment(input)
37
+ p result
38
+ rescue CloudmersiveNlpApiClient::ApiError => e
39
+ puts "Exception when calling AnalyticsApi->analytics_sentiment: #{e}"
40
+ end
41
+ ```
42
+
43
+ ### Parameters
44
+
45
+ Name | Type | Description | Notes
46
+ ------------- | ------------- | ------------- | -------------
47
+ **input** | [**SentimentAnalysisRequest**](SentimentAnalysisRequest.md)| Input sentiment analysis request |
48
+
49
+ ### Return type
50
+
51
+ [**SentimentAnalysisResponse**](SentimentAnalysisResponse.md)
52
+
53
+ ### Authorization
54
+
55
+ [Apikey](../README.md#Apikey)
56
+
57
+ ### HTTP request headers
58
+
59
+ - **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
60
+ - **Accept**: application/json, text/json, application/xml, text/xml
61
+
62
+
63
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveNlpApiClient::SentimentAnalysisRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **text_to_analyze** | **String** | Text to analyze | [optional]
7
+
8
+
@@ -0,0 +1,11 @@
1
+ # CloudmersiveNlpApiClient::SentimentAnalysisResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **successful** | **BOOLEAN** | True if the language detection operation was successful, false otherwise | [optional]
7
+ **sentiment_classification_result** | **String** | Classification of input text into a sentiment classification; possible values are \"Positive\", \"Negative\" or \"Neutral\" | [optional]
8
+ **sentiment_score_result** | **Float** | Sentiment classification score between -1.0 and +1.0 where scores less than 0 are negative sentiment, scores greater than 0 are positive sentiment and scores close to 0 are neutral. The greater the value deviates from 0.0 the stronger the sentiment, with +1.0 and -1.0 being maximum positive and negative sentiment, respectively. | [optional]
9
+ **sentence_count** | **Integer** | Number of sentences in input text | [optional]
10
+
11
+
@@ -43,9 +43,12 @@ require 'cloudmersive-nlp-api-client/models/rephrased_sentence'
43
43
  require 'cloudmersive-nlp-api-client/models/rephrased_sentence_option'
44
44
  require 'cloudmersive-nlp-api-client/models/sentence_segmentation_request'
45
45
  require 'cloudmersive-nlp-api-client/models/sentence_segmentation_response'
46
+ require 'cloudmersive-nlp-api-client/models/sentiment_analysis_request'
47
+ require 'cloudmersive-nlp-api-client/models/sentiment_analysis_response'
46
48
  require 'cloudmersive-nlp-api-client/models/word_position'
47
49
 
48
50
  # APIs
51
+ require 'cloudmersive-nlp-api-client/api/analytics_api'
49
52
  require 'cloudmersive-nlp-api-client/api/extract_entities_api'
50
53
  require 'cloudmersive-nlp-api-client/api/language_detection_api'
51
54
  require 'cloudmersive-nlp-api-client/api/language_translation_api'
@@ -0,0 +1,78 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module CloudmersiveNlpApiClient
16
+ class AnalyticsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Perform Sentiment Analysis and Classification on Text
24
+ # Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence.
25
+ # @param input Input sentiment analysis request
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [SentimentAnalysisResponse]
28
+ def analytics_sentiment(input, opts = {})
29
+ data, _status_code, _headers = analytics_sentiment_with_http_info(input, opts)
30
+ return data
31
+ end
32
+
33
+ # Perform Sentiment Analysis and Classification on Text
34
+ # Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence.
35
+ # @param input Input sentiment analysis request
36
+ # @param [Hash] opts the optional parameters
37
+ # @return [Array<(SentimentAnalysisResponse, Fixnum, Hash)>] SentimentAnalysisResponse data, response status code and response headers
38
+ def analytics_sentiment_with_http_info(input, opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug "Calling API: AnalyticsApi.analytics_sentiment ..."
41
+ end
42
+ # verify the required parameter 'input' is set
43
+ if @api_client.config.client_side_validation && input.nil?
44
+ fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_sentiment"
45
+ end
46
+ # resource path
47
+ local_var_path = "/nlp-v2/analytics/sentiment"
48
+
49
+ # query parameters
50
+ query_params = {}
51
+
52
+ # header parameters
53
+ header_params = {}
54
+ # HTTP header 'Accept' (if needed)
55
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
56
+ # HTTP header 'Content-Type'
57
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
58
+
59
+ # form parameters
60
+ form_params = {}
61
+
62
+ # http body (model)
63
+ post_body = @api_client.object_to_http_body(input)
64
+ auth_names = ['Apikey']
65
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
66
+ :header_params => header_params,
67
+ :query_params => query_params,
68
+ :form_params => form_params,
69
+ :body => post_body,
70
+ :auth_names => auth_names,
71
+ :return_type => 'SentimentAnalysisResponse')
72
+ if @api_client.config.debugging
73
+ @api_client.config.logger.debug "API called: AnalyticsApi#analytics_sentiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
74
+ end
75
+ return data, status_code, headers
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,189 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveNlpApiClient
16
+ # Input to a sentiment analysis operation
17
+ class SentimentAnalysisRequest
18
+ # Text to analyze
19
+ attr_accessor :text_to_analyze
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'text_to_analyze' => :'TextToAnalyze'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'text_to_analyze' => :'String'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'TextToAnalyze')
45
+ self.text_to_analyze = attributes[:'TextToAnalyze']
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properties with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ return invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return true
61
+ end
62
+
63
+ # Checks equality by comparing each attribute.
64
+ # @param [Object] Object to be compared
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ text_to_analyze == o.text_to_analyze
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [text_to_analyze].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.swagger_types.each_pair do |key, type|
89
+ if type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
93
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
98
+ end
99
+
100
+ self
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def _deserialize(type, value)
108
+ case type.to_sym
109
+ when :DateTime
110
+ DateTime.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :BOOLEAN
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ temp_model = CloudmersiveNlpApiClient.const_get(type).new
141
+ temp_model.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map{ |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ end
188
+
189
+ end
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveNlpApiClient
16
+ # Output of a sentiment analysis operation
17
+ class SentimentAnalysisResponse
18
+ # True if the language detection operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Classification of input text into a sentiment classification; possible values are \"Positive\", \"Negative\" or \"Neutral\"
22
+ attr_accessor :sentiment_classification_result
23
+
24
+ # Sentiment classification score between -1.0 and +1.0 where scores less than 0 are negative sentiment, scores greater than 0 are positive sentiment and scores close to 0 are neutral. The greater the value deviates from 0.0 the stronger the sentiment, with +1.0 and -1.0 being maximum positive and negative sentiment, respectively.
25
+ attr_accessor :sentiment_score_result
26
+
27
+ # Number of sentences in input text
28
+ attr_accessor :sentence_count
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'successful' => :'Successful',
35
+ :'sentiment_classification_result' => :'SentimentClassificationResult',
36
+ :'sentiment_score_result' => :'SentimentScoreResult',
37
+ :'sentence_count' => :'SentenceCount'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'successful' => :'BOOLEAN',
45
+ :'sentiment_classification_result' => :'String',
46
+ :'sentiment_score_result' => :'Float',
47
+ :'sentence_count' => :'Integer'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'Successful')
60
+ self.successful = attributes[:'Successful']
61
+ end
62
+
63
+ if attributes.has_key?(:'SentimentClassificationResult')
64
+ self.sentiment_classification_result = attributes[:'SentimentClassificationResult']
65
+ end
66
+
67
+ if attributes.has_key?(:'SentimentScoreResult')
68
+ self.sentiment_score_result = attributes[:'SentimentScoreResult']
69
+ end
70
+
71
+ if attributes.has_key?(:'SentenceCount')
72
+ self.sentence_count = attributes[:'SentenceCount']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ return invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ successful == o.successful &&
96
+ sentiment_classification_result == o.sentiment_classification_result &&
97
+ sentiment_score_result == o.sentiment_score_result &&
98
+ sentence_count == o.sentence_count
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [successful, sentiment_classification_result, sentiment_score_result, sentence_count].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = CloudmersiveNlpApiClient.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map{ |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.3.1
11
11
  =end
12
12
 
13
13
  module CloudmersiveNlpApiClient
14
- VERSION = "2.0.4"
14
+ VERSION = "2.0.5"
15
15
  end
@@ -0,0 +1,47 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for CloudmersiveNlpApiClient::AnalyticsApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'AnalyticsApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = CloudmersiveNlpApiClient::AnalyticsApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of AnalyticsApi' do
30
+ it 'should create an instance of AnalyticsApi' do
31
+ expect(@instance).to be_instance_of(CloudmersiveNlpApiClient::AnalyticsApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for analytics_sentiment
36
+ # Perform Sentiment Analysis and Classification on Text
37
+ # Analyze input text using advanced Sentiment Analysis to determine if the input is positive, negative, or neutral. Supports English language input. Consumes 1-2 API calls per sentence.
38
+ # @param input Input sentiment analysis request
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [SentimentAnalysisResponse]
41
+ describe 'analytics_sentiment test' do
42
+ it "should work" do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveNlpApiClient::SentimentAnalysisRequest
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'SentimentAnalysisRequest' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveNlpApiClient::SentimentAnalysisRequest.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of SentimentAnalysisRequest' do
31
+ it 'should create an instance of SentimentAnalysisRequest' do
32
+ expect(@instance).to be_instance_of(CloudmersiveNlpApiClient::SentimentAnalysisRequest)
33
+ end
34
+ end
35
+ describe 'test attribute "text_to_analyze"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ end
42
+
@@ -0,0 +1,60 @@
1
+ =begin
2
+ #nlpapiv2
3
+
4
+ #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveNlpApiClient::SentimentAnalysisResponse
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'SentimentAnalysisResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveNlpApiClient::SentimentAnalysisResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of SentimentAnalysisResponse' do
31
+ it 'should create an instance of SentimentAnalysisResponse' do
32
+ expect(@instance).to be_instance_of(CloudmersiveNlpApiClient::SentimentAnalysisResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "successful"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "sentiment_classification_result"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "sentiment_score_result"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "sentence_count"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ end
60
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudmersive-nlp-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloudmersive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-02 00:00:00.000000000 Z
11
+ date: 2020-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -203,6 +203,7 @@ files:
203
203
  - "./README.md"
204
204
  - "./Rakefile"
205
205
  - "./cloudmersive-nlp-api-client.gemspec"
206
+ - "./docs/AnalyticsApi.md"
206
207
  - "./docs/CheckSentenceRequest.md"
207
208
  - "./docs/CheckSentenceResponse.md"
208
209
  - "./docs/CheckWordRequest.md"
@@ -236,10 +237,13 @@ files:
236
237
  - "./docs/SegmentationApi.md"
237
238
  - "./docs/SentenceSegmentationRequest.md"
238
239
  - "./docs/SentenceSegmentationResponse.md"
240
+ - "./docs/SentimentAnalysisRequest.md"
241
+ - "./docs/SentimentAnalysisResponse.md"
239
242
  - "./docs/SpellcheckApi.md"
240
243
  - "./docs/WordPosition.md"
241
244
  - "./git_push.sh"
242
245
  - "./lib/cloudmersive-nlp-api-client.rb"
246
+ - "./lib/cloudmersive-nlp-api-client/api/analytics_api.rb"
243
247
  - "./lib/cloudmersive-nlp-api-client/api/extract_entities_api.rb"
244
248
  - "./lib/cloudmersive-nlp-api-client/api/language_detection_api.rb"
245
249
  - "./lib/cloudmersive-nlp-api-client/api/language_translation_api.rb"
@@ -277,8 +281,11 @@ files:
277
281
  - "./lib/cloudmersive-nlp-api-client/models/rephrased_sentence_option.rb"
278
282
  - "./lib/cloudmersive-nlp-api-client/models/sentence_segmentation_request.rb"
279
283
  - "./lib/cloudmersive-nlp-api-client/models/sentence_segmentation_response.rb"
284
+ - "./lib/cloudmersive-nlp-api-client/models/sentiment_analysis_request.rb"
285
+ - "./lib/cloudmersive-nlp-api-client/models/sentiment_analysis_response.rb"
280
286
  - "./lib/cloudmersive-nlp-api-client/models/word_position.rb"
281
287
  - "./lib/cloudmersive-nlp-api-client/version.rb"
288
+ - "./spec/api/analytics_api_spec.rb"
282
289
  - "./spec/api/extract_entities_api_spec.rb"
283
290
  - "./spec/api/language_detection_api_spec.rb"
284
291
  - "./spec/api/language_translation_api_spec.rb"
@@ -315,6 +322,8 @@ files:
315
322
  - "./spec/models/rephrased_sentence_spec.rb"
316
323
  - "./spec/models/sentence_segmentation_request_spec.rb"
317
324
  - "./spec/models/sentence_segmentation_response_spec.rb"
325
+ - "./spec/models/sentiment_analysis_request_spec.rb"
326
+ - "./spec/models/sentiment_analysis_response_spec.rb"
318
327
  - "./spec/models/word_position_spec.rb"
319
328
  - "./spec/spec_helper.rb"
320
329
  homepage: https://www.cloudmersive.com/nlp-api