cloudmersive-nlp-api-client 3.0.2 → 3.0.3

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