cloudmersive-nlp-api-client 2.0.5 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -130
  3. data/Gemfile +0 -7
  4. data/README.md +0 -148
  5. data/Rakefile +0 -8
  6. data/cloudmersive-nlp-api-client.gemspec +0 -45
  7. data/docs/AnalyticsApi.md +0 -63
  8. data/docs/CheckSentenceRequest.md +0 -8
  9. data/docs/CheckSentenceResponse.md +0 -9
  10. data/docs/CheckWordRequest.md +0 -8
  11. data/docs/CheckWordResponse.md +0 -9
  12. data/docs/CorrectWordInSentence.md +0 -10
  13. data/docs/Entity.md +0 -9
  14. data/docs/ExtractEntitiesApi.md +0 -63
  15. data/docs/ExtractEntitiesRequest.md +0 -8
  16. data/docs/ExtractEntitiesResponse.md +0 -9
  17. data/docs/GetWordsRequest.md +0 -8
  18. data/docs/GetWordsResponse.md +0 -8
  19. data/docs/LanguageDetectionApi.md +0 -63
  20. data/docs/LanguageDetectionRequest.md +0 -8
  21. data/docs/LanguageDetectionResponse.md +0 -10
  22. data/docs/LanguageTranslationApi.md +0 -228
  23. data/docs/LanguageTranslationRequest.md +0 -8
  24. data/docs/LanguageTranslationResponse.md +0 -10
  25. data/docs/ParseApi.md +0 -63
  26. data/docs/ParseRequest.md +0 -8
  27. data/docs/ParseResponse.md +0 -8
  28. data/docs/PosRequest.md +0 -8
  29. data/docs/PosResponse.md +0 -8
  30. data/docs/PosSentence.md +0 -8
  31. data/docs/PosTaggedWord.md +0 -9
  32. data/docs/PosTaggerApi.md +0 -338
  33. data/docs/RephraseApi.md +0 -63
  34. data/docs/RephraseRequest.md +0 -9
  35. data/docs/RephraseResponse.md +0 -10
  36. data/docs/RephrasedSentence.md +0 -10
  37. data/docs/RephrasedSentenceOption.md +0 -9
  38. data/docs/SegmentationApi.md +0 -118
  39. data/docs/SentenceSegmentationRequest.md +0 -8
  40. data/docs/SentenceSegmentationResponse.md +0 -10
  41. data/docs/SentimentAnalysisRequest.md +0 -8
  42. data/docs/SentimentAnalysisResponse.md +0 -11
  43. data/docs/SpellcheckApi.md +0 -118
  44. data/docs/WordPosition.md +0 -11
  45. data/git_push.sh +0 -55
  46. data/lib/cloudmersive-nlp-api-client.rb +0 -77
  47. data/lib/cloudmersive-nlp-api-client/api/analytics_api.rb +0 -78
  48. data/lib/cloudmersive-nlp-api-client/api/extract_entities_api.rb +0 -78
  49. data/lib/cloudmersive-nlp-api-client/api/language_detection_api.rb +0 -78
  50. data/lib/cloudmersive-nlp-api-client/api/language_translation_api.rb +0 -243
  51. data/lib/cloudmersive-nlp-api-client/api/parse_api.rb +0 -78
  52. data/lib/cloudmersive-nlp-api-client/api/pos_tagger_api.rb +0 -353
  53. data/lib/cloudmersive-nlp-api-client/api/rephrase_api.rb +0 -78
  54. data/lib/cloudmersive-nlp-api-client/api/segmentation_api.rb +0 -133
  55. data/lib/cloudmersive-nlp-api-client/api/spellcheck_api.rb +0 -133
  56. data/lib/cloudmersive-nlp-api-client/api_client.rb +0 -389
  57. data/lib/cloudmersive-nlp-api-client/api_error.rb +0 -38
  58. data/lib/cloudmersive-nlp-api-client/configuration.rb +0 -209
  59. data/lib/cloudmersive-nlp-api-client/models/check_sentence_request.rb +0 -189
  60. data/lib/cloudmersive-nlp-api-client/models/check_sentence_response.rb +0 -201
  61. data/lib/cloudmersive-nlp-api-client/models/check_word_request.rb +0 -188
  62. data/lib/cloudmersive-nlp-api-client/models/check_word_response.rb +0 -201
  63. data/lib/cloudmersive-nlp-api-client/models/correct_word_in_sentence.rb +0 -211
  64. data/lib/cloudmersive-nlp-api-client/models/entity.rb +0 -197
  65. data/lib/cloudmersive-nlp-api-client/models/extract_entities_request.rb +0 -189
  66. data/lib/cloudmersive-nlp-api-client/models/extract_entities_response.rb +0 -200
  67. data/lib/cloudmersive-nlp-api-client/models/get_words_request.rb +0 -188
  68. data/lib/cloudmersive-nlp-api-client/models/get_words_response.rb +0 -191
  69. data/lib/cloudmersive-nlp-api-client/models/language_detection_request.rb +0 -189
  70. data/lib/cloudmersive-nlp-api-client/models/language_detection_response.rb +0 -209
  71. data/lib/cloudmersive-nlp-api-client/models/language_translation_request.rb +0 -189
  72. data/lib/cloudmersive-nlp-api-client/models/language_translation_response.rb +0 -209
  73. data/lib/cloudmersive-nlp-api-client/models/parse_request.rb +0 -189
  74. data/lib/cloudmersive-nlp-api-client/models/parse_response.rb +0 -189
  75. data/lib/cloudmersive-nlp-api-client/models/pos_request.rb +0 -189
  76. data/lib/cloudmersive-nlp-api-client/models/pos_response.rb +0 -191
  77. data/lib/cloudmersive-nlp-api-client/models/pos_sentence.rb +0 -191
  78. data/lib/cloudmersive-nlp-api-client/models/pos_tagged_word.rb +0 -199
  79. data/lib/cloudmersive-nlp-api-client/models/rephrase_request.rb +0 -199
  80. data/lib/cloudmersive-nlp-api-client/models/rephrase_response.rb +0 -211
  81. data/lib/cloudmersive-nlp-api-client/models/rephrased_sentence.rb +0 -211
  82. data/lib/cloudmersive-nlp-api-client/models/rephrased_sentence_option.rb +0 -199
  83. data/lib/cloudmersive-nlp-api-client/models/sentence_segmentation_request.rb +0 -188
  84. data/lib/cloudmersive-nlp-api-client/models/sentence_segmentation_response.rb +0 -208
  85. data/lib/cloudmersive-nlp-api-client/models/sentiment_analysis_request.rb +0 -189
  86. data/lib/cloudmersive-nlp-api-client/models/sentiment_analysis_response.rb +0 -219
  87. data/lib/cloudmersive-nlp-api-client/models/word_position.rb +0 -219
  88. data/lib/cloudmersive-nlp-api-client/version.rb +0 -15
  89. data/spec/api/analytics_api_spec.rb +0 -47
  90. data/spec/api/extract_entities_api_spec.rb +0 -47
  91. data/spec/api/language_detection_api_spec.rb +0 -47
  92. data/spec/api/language_translation_api_spec.rb +0 -83
  93. data/spec/api/parse_api_spec.rb +0 -47
  94. data/spec/api/pos_tagger_api_spec.rb +0 -107
  95. data/spec/api/rephrase_api_spec.rb +0 -47
  96. data/spec/api/segmentation_api_spec.rb +0 -59
  97. data/spec/api/spellcheck_api_spec.rb +0 -59
  98. data/spec/api_client_spec.rb +0 -226
  99. data/spec/configuration_spec.rb +0 -42
  100. data/spec/models/check_sentence_request_spec.rb +0 -42
  101. data/spec/models/check_sentence_response_spec.rb +0 -48
  102. data/spec/models/check_word_request_spec.rb +0 -42
  103. data/spec/models/check_word_response_spec.rb +0 -48
  104. data/spec/models/correct_word_in_sentence_spec.rb +0 -54
  105. data/spec/models/entity_spec.rb +0 -48
  106. data/spec/models/extract_entities_request_spec.rb +0 -42
  107. data/spec/models/extract_entities_response_spec.rb +0 -48
  108. data/spec/models/get_words_request_spec.rb +0 -42
  109. data/spec/models/get_words_response_spec.rb +0 -42
  110. data/spec/models/language_detection_request_spec.rb +0 -42
  111. data/spec/models/language_detection_response_spec.rb +0 -54
  112. data/spec/models/language_translation_request_spec.rb +0 -42
  113. data/spec/models/language_translation_response_spec.rb +0 -54
  114. data/spec/models/parse_request_spec.rb +0 -42
  115. data/spec/models/parse_response_spec.rb +0 -42
  116. data/spec/models/pos_request_spec.rb +0 -42
  117. data/spec/models/pos_response_spec.rb +0 -42
  118. data/spec/models/pos_sentence_spec.rb +0 -42
  119. data/spec/models/pos_tagged_word_spec.rb +0 -48
  120. data/spec/models/rephrase_request_spec.rb +0 -48
  121. data/spec/models/rephrase_response_spec.rb +0 -54
  122. data/spec/models/rephrased_sentence_option_spec.rb +0 -48
  123. data/spec/models/rephrased_sentence_spec.rb +0 -54
  124. data/spec/models/sentence_segmentation_request_spec.rb +0 -42
  125. data/spec/models/sentence_segmentation_response_spec.rb +0 -54
  126. data/spec/models/sentiment_analysis_request_spec.rb +0 -42
  127. data/spec/models/sentiment_analysis_response_spec.rb +0 -60
  128. data/spec/models/word_position_spec.rb +0 -60
  129. data/spec/spec_helper.rb +0 -111
@@ -1,199 +0,0 @@
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
- # One rephrasing of an original input sentence
17
- class RephrasedSentenceOption
18
- # Ordered index of the rephrasing option, 1-based, with 1 being the best option
19
- attr_accessor :rephrased_option_index
20
-
21
- # One sentence of output rephrased text of original input sentence
22
- attr_accessor :rephrased_sentence_text
23
-
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'rephrased_option_index' => :'RephrasedOptionIndex',
29
- :'rephrased_sentence_text' => :'RephrasedSentenceText'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.swagger_types
35
- {
36
- :'rephrased_option_index' => :'Integer',
37
- :'rephrased_sentence_text' => :'String'
38
- }
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- return unless attributes.is_a?(Hash)
45
-
46
- # convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
-
49
- if attributes.has_key?(:'RephrasedOptionIndex')
50
- self.rephrased_option_index = attributes[:'RephrasedOptionIndex']
51
- end
52
-
53
- if attributes.has_key?(:'RephrasedSentenceText')
54
- self.rephrased_sentence_text = attributes[:'RephrasedSentenceText']
55
- end
56
-
57
- end
58
-
59
- # Show invalid properties with the reasons. Usually used together with valid?
60
- # @return Array for valid properties with the reasons
61
- def list_invalid_properties
62
- invalid_properties = Array.new
63
- return invalid_properties
64
- end
65
-
66
- # Check to see if the all the properties in the model are valid
67
- # @return true if the model is valid
68
- def valid?
69
- return true
70
- end
71
-
72
- # Checks equality by comparing each attribute.
73
- # @param [Object] Object to be compared
74
- def ==(o)
75
- return true if self.equal?(o)
76
- self.class == o.class &&
77
- rephrased_option_index == o.rephrased_option_index &&
78
- rephrased_sentence_text == o.rephrased_sentence_text
79
- end
80
-
81
- # @see the `==` method
82
- # @param [Object] Object to be compared
83
- def eql?(o)
84
- self == o
85
- end
86
-
87
- # Calculates hash code according to all attributes.
88
- # @return [Fixnum] Hash code
89
- def hash
90
- [rephrased_option_index, rephrased_sentence_text].hash
91
- end
92
-
93
- # Builds the object from hash
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- # @return [Object] Returns the model itself
96
- def build_from_hash(attributes)
97
- return nil unless attributes.is_a?(Hash)
98
- self.class.swagger_types.each_pair do |key, type|
99
- if type =~ /\AArray<(.*)>/i
100
- # check to ensure the input is an array given that the the attribute
101
- # is documented as an array but the input is not
102
- if attributes[self.class.attribute_map[key]].is_a?(Array)
103
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
- end
105
- elsif !attributes[self.class.attribute_map[key]].nil?
106
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
- end # or else data not found in attributes(hash), not an issue as the data can be optional
108
- end
109
-
110
- self
111
- end
112
-
113
- # Deserializes the data based on type
114
- # @param string type Data type
115
- # @param string value Value to be deserialized
116
- # @return [Object] Deserialized data
117
- def _deserialize(type, value)
118
- case type.to_sym
119
- when :DateTime
120
- DateTime.parse(value)
121
- when :Date
122
- Date.parse(value)
123
- when :String
124
- value.to_s
125
- when :Integer
126
- value.to_i
127
- when :Float
128
- value.to_f
129
- when :BOOLEAN
130
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
- true
132
- else
133
- false
134
- end
135
- when :Object
136
- # generic object (usually a Hash), return directly
137
- value
138
- when /\AArray<(?<inner_type>.+)>\z/
139
- inner_type = Regexp.last_match[:inner_type]
140
- value.map { |v| _deserialize(inner_type, v) }
141
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
- k_type = Regexp.last_match[:k_type]
143
- v_type = Regexp.last_match[:v_type]
144
- {}.tap do |hash|
145
- value.each do |k, v|
146
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
- end
148
- end
149
- else # model
150
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
151
- temp_model.build_from_hash(value)
152
- end
153
- end
154
-
155
- # Returns the string representation of the object
156
- # @return [String] String presentation of the object
157
- def to_s
158
- to_hash.to_s
159
- end
160
-
161
- # to_body is an alias to to_hash (backward compatibility)
162
- # @return [Hash] Returns the object in the form of hash
163
- def to_body
164
- to_hash
165
- end
166
-
167
- # Returns the object in the form of hash
168
- # @return [Hash] Returns the object in the form of hash
169
- def to_hash
170
- hash = {}
171
- self.class.attribute_map.each_pair do |attr, param|
172
- value = self.send(attr)
173
- next if value.nil?
174
- hash[param] = _to_hash(value)
175
- end
176
- hash
177
- end
178
-
179
- # Outputs non-array value in the form of hash
180
- # For object, use to_hash. Otherwise, just return the value
181
- # @param [Object] value Any valid value
182
- # @return [Hash] Returns the value in the form of hash
183
- def _to_hash(value)
184
- if value.is_a?(Array)
185
- value.compact.map{ |v| _to_hash(v) }
186
- elsif value.is_a?(Hash)
187
- {}.tap do |hash|
188
- value.each { |k, v| hash[k] = _to_hash(v) }
189
- end
190
- elsif value.respond_to? :to_hash
191
- value.to_hash
192
- else
193
- value
194
- end
195
- end
196
-
197
- end
198
-
199
- end
@@ -1,188 +0,0 @@
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
-
17
- class SentenceSegmentationRequest
18
- attr_accessor :input_string
19
-
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'input_string' => :'InputString'
25
- }
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.swagger_types
30
- {
31
- :'input_string' => :'String'
32
- }
33
- end
34
-
35
- # Initializes the object
36
- # @param [Hash] attributes Model attributes in the form of hash
37
- def initialize(attributes = {})
38
- return unless attributes.is_a?(Hash)
39
-
40
- # convert string to symbol for hash key
41
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
-
43
- if attributes.has_key?(:'InputString')
44
- self.input_string = attributes[:'InputString']
45
- end
46
-
47
- end
48
-
49
- # Show invalid properties with the reasons. Usually used together with valid?
50
- # @return Array for valid properties with the reasons
51
- def list_invalid_properties
52
- invalid_properties = Array.new
53
- return invalid_properties
54
- end
55
-
56
- # Check to see if the all the properties in the model are valid
57
- # @return true if the model is valid
58
- def valid?
59
- return true
60
- end
61
-
62
- # Checks equality by comparing each attribute.
63
- # @param [Object] Object to be compared
64
- def ==(o)
65
- return true if self.equal?(o)
66
- self.class == o.class &&
67
- input_string == o.input_string
68
- end
69
-
70
- # @see the `==` method
71
- # @param [Object] Object to be compared
72
- def eql?(o)
73
- self == o
74
- end
75
-
76
- # Calculates hash code according to all attributes.
77
- # @return [Fixnum] Hash code
78
- def hash
79
- [input_string].hash
80
- end
81
-
82
- # Builds the object from hash
83
- # @param [Hash] attributes Model attributes in the form of hash
84
- # @return [Object] Returns the model itself
85
- def build_from_hash(attributes)
86
- return nil unless attributes.is_a?(Hash)
87
- self.class.swagger_types.each_pair do |key, type|
88
- if type =~ /\AArray<(.*)>/i
89
- # check to ensure the input is an array given that the the attribute
90
- # is documented as an array but the input is not
91
- if attributes[self.class.attribute_map[key]].is_a?(Array)
92
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
- end
94
- elsif !attributes[self.class.attribute_map[key]].nil?
95
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
- end # or else data not found in attributes(hash), not an issue as the data can be optional
97
- end
98
-
99
- self
100
- end
101
-
102
- # Deserializes the data based on type
103
- # @param string type Data type
104
- # @param string value Value to be deserialized
105
- # @return [Object] Deserialized data
106
- def _deserialize(type, value)
107
- case type.to_sym
108
- when :DateTime
109
- DateTime.parse(value)
110
- when :Date
111
- Date.parse(value)
112
- when :String
113
- value.to_s
114
- when :Integer
115
- value.to_i
116
- when :Float
117
- value.to_f
118
- when :BOOLEAN
119
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
- true
121
- else
122
- false
123
- end
124
- when :Object
125
- # generic object (usually a Hash), return directly
126
- value
127
- when /\AArray<(?<inner_type>.+)>\z/
128
- inner_type = Regexp.last_match[:inner_type]
129
- value.map { |v| _deserialize(inner_type, v) }
130
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
- k_type = Regexp.last_match[:k_type]
132
- v_type = Regexp.last_match[:v_type]
133
- {}.tap do |hash|
134
- value.each do |k, v|
135
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
- end
137
- end
138
- else # model
139
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
140
- temp_model.build_from_hash(value)
141
- end
142
- end
143
-
144
- # Returns the string representation of the object
145
- # @return [String] String presentation of the object
146
- def to_s
147
- to_hash.to_s
148
- end
149
-
150
- # to_body is an alias to to_hash (backward compatibility)
151
- # @return [Hash] Returns the object in the form of hash
152
- def to_body
153
- to_hash
154
- end
155
-
156
- # Returns the object in the form of hash
157
- # @return [Hash] Returns the object in the form of hash
158
- def to_hash
159
- hash = {}
160
- self.class.attribute_map.each_pair do |attr, param|
161
- value = self.send(attr)
162
- next if value.nil?
163
- hash[param] = _to_hash(value)
164
- end
165
- hash
166
- end
167
-
168
- # Outputs non-array value in the form of hash
169
- # For object, use to_hash. Otherwise, just return the value
170
- # @param [Object] value Any valid value
171
- # @return [Hash] Returns the value in the form of hash
172
- def _to_hash(value)
173
- if value.is_a?(Array)
174
- value.compact.map{ |v| _to_hash(v) }
175
- elsif value.is_a?(Hash)
176
- {}.tap do |hash|
177
- value.each { |k, v| hash[k] = _to_hash(v) }
178
- end
179
- elsif value.respond_to? :to_hash
180
- value.to_hash
181
- else
182
- value
183
- end
184
- end
185
-
186
- end
187
-
188
- end
@@ -1,208 +0,0 @@
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
-
17
- class SentenceSegmentationResponse
18
- attr_accessor :successful
19
-
20
- attr_accessor :sentences
21
-
22
- attr_accessor :sentence_count
23
-
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'successful' => :'Successful',
29
- :'sentences' => :'Sentences',
30
- :'sentence_count' => :'SentenceCount'
31
- }
32
- end
33
-
34
- # Attribute type mapping.
35
- def self.swagger_types
36
- {
37
- :'successful' => :'BOOLEAN',
38
- :'sentences' => :'Array<String>',
39
- :'sentence_count' => :'Integer'
40
- }
41
- end
42
-
43
- # Initializes the object
44
- # @param [Hash] attributes Model attributes in the form of hash
45
- def initialize(attributes = {})
46
- return unless attributes.is_a?(Hash)
47
-
48
- # convert string to symbol for hash key
49
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
-
51
- if attributes.has_key?(:'Successful')
52
- self.successful = attributes[:'Successful']
53
- end
54
-
55
- if attributes.has_key?(:'Sentences')
56
- if (value = attributes[:'Sentences']).is_a?(Array)
57
- self.sentences = value
58
- end
59
- end
60
-
61
- if attributes.has_key?(:'SentenceCount')
62
- self.sentence_count = attributes[:'SentenceCount']
63
- end
64
-
65
- end
66
-
67
- # Show invalid properties with the reasons. Usually used together with valid?
68
- # @return Array for valid properties with the reasons
69
- def list_invalid_properties
70
- invalid_properties = Array.new
71
- return invalid_properties
72
- end
73
-
74
- # Check to see if the all the properties in the model are valid
75
- # @return true if the model is valid
76
- def valid?
77
- return true
78
- end
79
-
80
- # Checks equality by comparing each attribute.
81
- # @param [Object] Object to be compared
82
- def ==(o)
83
- return true if self.equal?(o)
84
- self.class == o.class &&
85
- successful == o.successful &&
86
- sentences == o.sentences &&
87
- sentence_count == o.sentence_count
88
- end
89
-
90
- # @see the `==` method
91
- # @param [Object] Object to be compared
92
- def eql?(o)
93
- self == o
94
- end
95
-
96
- # Calculates hash code according to all attributes.
97
- # @return [Fixnum] Hash code
98
- def hash
99
- [successful, sentences, sentence_count].hash
100
- end
101
-
102
- # Builds the object from hash
103
- # @param [Hash] attributes Model attributes in the form of hash
104
- # @return [Object] Returns the model itself
105
- def build_from_hash(attributes)
106
- return nil unless attributes.is_a?(Hash)
107
- self.class.swagger_types.each_pair do |key, type|
108
- if type =~ /\AArray<(.*)>/i
109
- # check to ensure the input is an array given that the the attribute
110
- # is documented as an array but the input is not
111
- if attributes[self.class.attribute_map[key]].is_a?(Array)
112
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
- end
114
- elsif !attributes[self.class.attribute_map[key]].nil?
115
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
- end # or else data not found in attributes(hash), not an issue as the data can be optional
117
- end
118
-
119
- self
120
- end
121
-
122
- # Deserializes the data based on type
123
- # @param string type Data type
124
- # @param string value Value to be deserialized
125
- # @return [Object] Deserialized data
126
- def _deserialize(type, value)
127
- case type.to_sym
128
- when :DateTime
129
- DateTime.parse(value)
130
- when :Date
131
- Date.parse(value)
132
- when :String
133
- value.to_s
134
- when :Integer
135
- value.to_i
136
- when :Float
137
- value.to_f
138
- when :BOOLEAN
139
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
- true
141
- else
142
- false
143
- end
144
- when :Object
145
- # generic object (usually a Hash), return directly
146
- value
147
- when /\AArray<(?<inner_type>.+)>\z/
148
- inner_type = Regexp.last_match[:inner_type]
149
- value.map { |v| _deserialize(inner_type, v) }
150
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
- k_type = Regexp.last_match[:k_type]
152
- v_type = Regexp.last_match[:v_type]
153
- {}.tap do |hash|
154
- value.each do |k, v|
155
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
- end
157
- end
158
- else # model
159
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
160
- temp_model.build_from_hash(value)
161
- end
162
- end
163
-
164
- # Returns the string representation of the object
165
- # @return [String] String presentation of the object
166
- def to_s
167
- to_hash.to_s
168
- end
169
-
170
- # to_body is an alias to to_hash (backward compatibility)
171
- # @return [Hash] Returns the object in the form of hash
172
- def to_body
173
- to_hash
174
- end
175
-
176
- # Returns the object in the form of hash
177
- # @return [Hash] Returns the object in the form of hash
178
- def to_hash
179
- hash = {}
180
- self.class.attribute_map.each_pair do |attr, param|
181
- value = self.send(attr)
182
- next if value.nil?
183
- hash[param] = _to_hash(value)
184
- end
185
- hash
186
- end
187
-
188
- # Outputs non-array value in the form of hash
189
- # For object, use to_hash. Otherwise, just return the value
190
- # @param [Object] value Any valid value
191
- # @return [Hash] Returns the value in the form of hash
192
- def _to_hash(value)
193
- if value.is_a?(Array)
194
- value.compact.map{ |v| _to_hash(v) }
195
- elsif value.is_a?(Hash)
196
- {}.tap do |hash|
197
- value.each { |k, v| hash[k] = _to_hash(v) }
198
- end
199
- elsif value.respond_to? :to_hash
200
- value.to_hash
201
- else
202
- value
203
- end
204
- end
205
-
206
- end
207
-
208
- end