cloudmersive-nlp-api-client 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/docs/AnalyticsApi.md +58 -3
- data/docs/ExtractEntitiesApi.md +1 -1
- data/docs/LanguageDetectionApi.md +1 -1
- data/docs/LanguageTranslationApi.md +4 -4
- data/docs/ParseApi.md +1 -1
- data/docs/PosTaggerApi.md +6 -6
- data/docs/RephraseApi.md +1 -1
- data/docs/SegmentationApi.md +2 -2
- data/docs/SimilarityAnalysisRequest.md +9 -0
- data/docs/SimilarityAnalysisResponse.md +10 -0
- data/docs/SpellcheckApi.md +2 -2
- data/lib/cloudmersive-nlp-api-client.rb +2 -0
- data/lib/cloudmersive-nlp-api-client/api/analytics_api.rb +58 -3
- data/lib/cloudmersive-nlp-api-client/api/extract_entities_api.rb +1 -1
- data/lib/cloudmersive-nlp-api-client/api/language_detection_api.rb +1 -1
- data/lib/cloudmersive-nlp-api-client/api/language_translation_api.rb +4 -4
- data/lib/cloudmersive-nlp-api-client/api/parse_api.rb +1 -1
- data/lib/cloudmersive-nlp-api-client/api/pos_tagger_api.rb +6 -6
- data/lib/cloudmersive-nlp-api-client/api/rephrase_api.rb +1 -1
- data/lib/cloudmersive-nlp-api-client/api/segmentation_api.rb +2 -2
- data/lib/cloudmersive-nlp-api-client/api/spellcheck_api.rb +2 -2
- data/lib/cloudmersive-nlp-api-client/models/similarity_analysis_request.rb +199 -0
- data/lib/cloudmersive-nlp-api-client/models/similarity_analysis_response.rb +209 -0
- data/lib/cloudmersive-nlp-api-client/version.rb +1 -1
- data/spec/api/analytics_api_spec.rb +12 -0
- data/spec/models/similarity_analysis_request_spec.rb +48 -0
- data/spec/models/similarity_analysis_response_spec.rb +54 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 130ee598481da126130a95d2b3ebf003f6403a5464153bbc4664393143a5ce2a
|
4
|
+
data.tar.gz: c95c68a34173db8e71c5d6e01370d52a823e7905420bebe90e807b16e40f69a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c3ca5e58482ac85c58d8381e7a1ed1512a90bf546ed1db45c7054843d9eef5a5f9958570e38bbe7acd9079f4a03969a3d0ad77ea88f86bf2b226e70f6939f7
|
7
|
+
data.tar.gz: 1c87d3200c1efd8b653a4cf0407e14de0e1e094ef1bdf3369bf6f8fe70cf7986127ef13511348e1bcee4cd25adaf2cf29841879938414cc492e9429e91442879
|
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.
|
10
|
+
- Package version: 2.0.8
|
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.
|
26
|
+
gem install ./cloudmersive-nlp-api-client-2.0.8.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-nlp-api-client-2.0.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-nlp-api-client-2.0.8.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.
|
34
|
+
gem 'cloudmersive-nlp-api-client', '~> 2.0.8'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -85,6 +85,7 @@ Class | Method | HTTP request | Description
|
|
85
85
|
------------ | ------------- | ------------- | -------------
|
86
86
|
*CloudmersiveNlpApiClient::AnalyticsApi* | [**analytics_profanity**](docs/AnalyticsApi.md#analytics_profanity) | **POST** /nlp-v2/analytics/profanity | Perform Profanity and Obscene Language Analysis and Detection on Text
|
87
87
|
*CloudmersiveNlpApiClient::AnalyticsApi* | [**analytics_sentiment**](docs/AnalyticsApi.md#analytics_sentiment) | **POST** /nlp-v2/analytics/sentiment | Perform Sentiment Analysis and Classification on Text
|
88
|
+
*CloudmersiveNlpApiClient::AnalyticsApi* | [**analytics_similarity**](docs/AnalyticsApi.md#analytics_similarity) | **POST** /nlp-v2/analytics/similarity | Perform Semantic Similarity Comparison of Two Strings
|
88
89
|
*CloudmersiveNlpApiClient::AnalyticsApi* | [**analytics_subjectivity**](docs/AnalyticsApi.md#analytics_subjectivity) | **POST** /nlp-v2/analytics/subjectivity | Perform Subjectivity and Objectivity Analysis on Text
|
89
90
|
*CloudmersiveNlpApiClient::ExtractEntitiesApi* | [**extract_entities_post**](docs/ExtractEntitiesApi.md#extract_entities_post) | **POST** /nlp-v2/extract-entities | Extract entities from string
|
90
91
|
*CloudmersiveNlpApiClient::LanguageDetectionApi* | [**language_detection_get_language**](docs/LanguageDetectionApi.md#language_detection_get_language) | **POST** /nlp-v2/language/detect | Detect language of text
|
@@ -138,6 +139,8 @@ Class | Method | HTTP request | Description
|
|
138
139
|
- [CloudmersiveNlpApiClient::SentenceSegmentationResponse](docs/SentenceSegmentationResponse.md)
|
139
140
|
- [CloudmersiveNlpApiClient::SentimentAnalysisRequest](docs/SentimentAnalysisRequest.md)
|
140
141
|
- [CloudmersiveNlpApiClient::SentimentAnalysisResponse](docs/SentimentAnalysisResponse.md)
|
142
|
+
- [CloudmersiveNlpApiClient::SimilarityAnalysisRequest](docs/SimilarityAnalysisRequest.md)
|
143
|
+
- [CloudmersiveNlpApiClient::SimilarityAnalysisResponse](docs/SimilarityAnalysisResponse.md)
|
141
144
|
- [CloudmersiveNlpApiClient::SubjectivityAnalysisRequest](docs/SubjectivityAnalysisRequest.md)
|
142
145
|
- [CloudmersiveNlpApiClient::SubjectivityAnalysisResponse](docs/SubjectivityAnalysisResponse.md)
|
143
146
|
- [CloudmersiveNlpApiClient::WordPosition](docs/WordPosition.md)
|
data/docs/AnalyticsApi.md
CHANGED
@@ -6,6 +6,7 @@ Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
7
7
|
[**analytics_profanity**](AnalyticsApi.md#analytics_profanity) | **POST** /nlp-v2/analytics/profanity | Perform Profanity and Obscene Language Analysis and Detection on Text
|
8
8
|
[**analytics_sentiment**](AnalyticsApi.md#analytics_sentiment) | **POST** /nlp-v2/analytics/sentiment | Perform Sentiment Analysis and Classification on Text
|
9
|
+
[**analytics_similarity**](AnalyticsApi.md#analytics_similarity) | **POST** /nlp-v2/analytics/similarity | Perform Semantic Similarity Comparison of Two Strings
|
9
10
|
[**analytics_subjectivity**](AnalyticsApi.md#analytics_subjectivity) | **POST** /nlp-v2/analytics/subjectivity | Perform Subjectivity and Objectivity Analysis on Text
|
10
11
|
|
11
12
|
|
@@ -59,7 +60,7 @@ Name | Type | Description | Notes
|
|
59
60
|
### HTTP request headers
|
60
61
|
|
61
62
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
62
|
-
- **Accept**: application/json
|
63
|
+
- **Accept**: application/json
|
63
64
|
|
64
65
|
|
65
66
|
|
@@ -113,7 +114,61 @@ Name | Type | Description | Notes
|
|
113
114
|
### HTTP request headers
|
114
115
|
|
115
116
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
116
|
-
- **Accept**: application/json
|
117
|
+
- **Accept**: application/json
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
# **analytics_similarity**
|
122
|
+
> SimilarityAnalysisResponse analytics_similarity(input)
|
123
|
+
|
124
|
+
Perform Semantic Similarity Comparison of Two Strings
|
125
|
+
|
126
|
+
Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence.
|
127
|
+
|
128
|
+
### Example
|
129
|
+
```ruby
|
130
|
+
# load the gem
|
131
|
+
require 'cloudmersive-nlp-api-client'
|
132
|
+
# setup authorization
|
133
|
+
CloudmersiveNlpApiClient.configure do |config|
|
134
|
+
# Configure API key authorization: Apikey
|
135
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
136
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
137
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
138
|
+
end
|
139
|
+
|
140
|
+
api_instance = CloudmersiveNlpApiClient::AnalyticsApi.new
|
141
|
+
|
142
|
+
input = CloudmersiveNlpApiClient::SimilarityAnalysisRequest.new # SimilarityAnalysisRequest | Input similarity analysis request
|
143
|
+
|
144
|
+
|
145
|
+
begin
|
146
|
+
#Perform Semantic Similarity Comparison of Two Strings
|
147
|
+
result = api_instance.analytics_similarity(input)
|
148
|
+
p result
|
149
|
+
rescue CloudmersiveNlpApiClient::ApiError => e
|
150
|
+
puts "Exception when calling AnalyticsApi->analytics_similarity: #{e}"
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
154
|
+
### Parameters
|
155
|
+
|
156
|
+
Name | Type | Description | Notes
|
157
|
+
------------- | ------------- | ------------- | -------------
|
158
|
+
**input** | [**SimilarityAnalysisRequest**](SimilarityAnalysisRequest.md)| Input similarity analysis request |
|
159
|
+
|
160
|
+
### Return type
|
161
|
+
|
162
|
+
[**SimilarityAnalysisResponse**](SimilarityAnalysisResponse.md)
|
163
|
+
|
164
|
+
### Authorization
|
165
|
+
|
166
|
+
[Apikey](../README.md#Apikey)
|
167
|
+
|
168
|
+
### HTTP request headers
|
169
|
+
|
170
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
171
|
+
- **Accept**: application/json
|
117
172
|
|
118
173
|
|
119
174
|
|
@@ -167,7 +222,7 @@ Name | Type | Description | Notes
|
|
167
222
|
### HTTP request headers
|
168
223
|
|
169
224
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
170
|
-
- **Accept**: application/json
|
225
|
+
- **Accept**: application/json
|
171
226
|
|
172
227
|
|
173
228
|
|
data/docs/ExtractEntitiesApi.md
CHANGED
@@ -57,7 +57,7 @@ Name | Type | Description | Notes
|
|
57
57
|
### HTTP request headers
|
58
58
|
|
59
59
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
60
|
-
- **Accept**: application/json
|
60
|
+
- **Accept**: application/json
|
61
61
|
|
62
62
|
|
63
63
|
|
@@ -57,7 +57,7 @@ Name | Type | Description | Notes
|
|
57
57
|
### HTTP request headers
|
58
58
|
|
59
59
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
60
|
-
- **Accept**: application/json
|
60
|
+
- **Accept**: application/json
|
61
61
|
|
62
62
|
|
63
63
|
|
@@ -60,7 +60,7 @@ Name | Type | Description | Notes
|
|
60
60
|
### HTTP request headers
|
61
61
|
|
62
62
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
63
|
-
- **Accept**: application/json
|
63
|
+
- **Accept**: application/json
|
64
64
|
|
65
65
|
|
66
66
|
|
@@ -114,7 +114,7 @@ Name | Type | Description | Notes
|
|
114
114
|
### HTTP request headers
|
115
115
|
|
116
116
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
117
|
-
- **Accept**: application/json
|
117
|
+
- **Accept**: application/json
|
118
118
|
|
119
119
|
|
120
120
|
|
@@ -168,7 +168,7 @@ Name | Type | Description | Notes
|
|
168
168
|
### HTTP request headers
|
169
169
|
|
170
170
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
171
|
-
- **Accept**: application/json
|
171
|
+
- **Accept**: application/json
|
172
172
|
|
173
173
|
|
174
174
|
|
@@ -222,7 +222,7 @@ Name | Type | Description | Notes
|
|
222
222
|
### HTTP request headers
|
223
223
|
|
224
224
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
225
|
-
- **Accept**: application/json
|
225
|
+
- **Accept**: application/json
|
226
226
|
|
227
227
|
|
228
228
|
|
data/docs/ParseApi.md
CHANGED
@@ -57,7 +57,7 @@ Name | Type | Description | Notes
|
|
57
57
|
### HTTP request headers
|
58
58
|
|
59
59
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
60
|
-
- **Accept**: application/json
|
60
|
+
- **Accept**: application/json
|
61
61
|
|
62
62
|
|
63
63
|
|
data/docs/PosTaggerApi.md
CHANGED
@@ -62,7 +62,7 @@ Name | Type | Description | Notes
|
|
62
62
|
### HTTP request headers
|
63
63
|
|
64
64
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
65
|
-
- **Accept**: application/json
|
65
|
+
- **Accept**: application/json
|
66
66
|
|
67
67
|
|
68
68
|
|
@@ -116,7 +116,7 @@ Name | Type | Description | Notes
|
|
116
116
|
### HTTP request headers
|
117
117
|
|
118
118
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
119
|
-
- **Accept**: application/json
|
119
|
+
- **Accept**: application/json
|
120
120
|
|
121
121
|
|
122
122
|
|
@@ -170,7 +170,7 @@ Name | Type | Description | Notes
|
|
170
170
|
### HTTP request headers
|
171
171
|
|
172
172
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
173
|
-
- **Accept**: application/json
|
173
|
+
- **Accept**: application/json
|
174
174
|
|
175
175
|
|
176
176
|
|
@@ -224,7 +224,7 @@ Name | Type | Description | Notes
|
|
224
224
|
### HTTP request headers
|
225
225
|
|
226
226
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
227
|
-
- **Accept**: application/json
|
227
|
+
- **Accept**: application/json
|
228
228
|
|
229
229
|
|
230
230
|
|
@@ -278,7 +278,7 @@ Name | Type | Description | Notes
|
|
278
278
|
### HTTP request headers
|
279
279
|
|
280
280
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
281
|
-
- **Accept**: application/json
|
281
|
+
- **Accept**: application/json
|
282
282
|
|
283
283
|
|
284
284
|
|
@@ -332,7 +332,7 @@ Name | Type | Description | Notes
|
|
332
332
|
### HTTP request headers
|
333
333
|
|
334
334
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
335
|
-
- **Accept**: application/json
|
335
|
+
- **Accept**: application/json
|
336
336
|
|
337
337
|
|
338
338
|
|
data/docs/RephraseApi.md
CHANGED
@@ -57,7 +57,7 @@ Name | Type | Description | Notes
|
|
57
57
|
### HTTP request headers
|
58
58
|
|
59
59
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
60
|
-
- **Accept**: application/json
|
60
|
+
- **Accept**: application/json
|
61
61
|
|
62
62
|
|
63
63
|
|
data/docs/SegmentationApi.md
CHANGED
@@ -58,7 +58,7 @@ Name | Type | Description | Notes
|
|
58
58
|
### HTTP request headers
|
59
59
|
|
60
60
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
61
|
-
- **Accept**: application/json
|
61
|
+
- **Accept**: application/json
|
62
62
|
|
63
63
|
|
64
64
|
|
@@ -112,7 +112,7 @@ Name | Type | Description | Notes
|
|
112
112
|
### HTTP request headers
|
113
113
|
|
114
114
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
115
|
-
- **Accept**: application/json
|
115
|
+
- **Accept**: application/json
|
116
116
|
|
117
117
|
|
118
118
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveNlpApiClient::SimilarityAnalysisRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**text_to_analyze1** | **String** | First text to analyze | [optional]
|
7
|
+
**text_to_analyze2** | **String** | Second text to analyze | [optional]
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveNlpApiClient::SimilarityAnalysisResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the similarity analysis operation was successful, false otherwise | [optional]
|
7
|
+
**similarity_score_result** | **Float** | Similarity score between 0.0 and 1.0 where scores closer to zero have a low probability of semantic similarity, while scores close to 1.0 have a high probability of semantic similarity. | [optional]
|
8
|
+
**sentence_count** | **Integer** | Number of sentences in input text | [optional]
|
9
|
+
|
10
|
+
|
data/docs/SpellcheckApi.md
CHANGED
@@ -58,7 +58,7 @@ Name | Type | Description | Notes
|
|
58
58
|
### HTTP request headers
|
59
59
|
|
60
60
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
61
|
-
- **Accept**: application/json
|
61
|
+
- **Accept**: application/json
|
62
62
|
|
63
63
|
|
64
64
|
|
@@ -112,7 +112,7 @@ Name | Type | Description | Notes
|
|
112
112
|
### HTTP request headers
|
113
113
|
|
114
114
|
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
115
|
-
- **Accept**: application/json
|
115
|
+
- **Accept**: application/json
|
116
116
|
|
117
117
|
|
118
118
|
|
@@ -47,6 +47,8 @@ require 'cloudmersive-nlp-api-client/models/sentence_segmentation_request'
|
|
47
47
|
require 'cloudmersive-nlp-api-client/models/sentence_segmentation_response'
|
48
48
|
require 'cloudmersive-nlp-api-client/models/sentiment_analysis_request'
|
49
49
|
require 'cloudmersive-nlp-api-client/models/sentiment_analysis_response'
|
50
|
+
require 'cloudmersive-nlp-api-client/models/similarity_analysis_request'
|
51
|
+
require 'cloudmersive-nlp-api-client/models/similarity_analysis_response'
|
50
52
|
require 'cloudmersive-nlp-api-client/models/subjectivity_analysis_request'
|
51
53
|
require 'cloudmersive-nlp-api-client/models/subjectivity_analysis_response'
|
52
54
|
require 'cloudmersive-nlp-api-client/models/word_position'
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -107,7 +107,7 @@ module CloudmersiveNlpApiClient
|
|
107
107
|
# header parameters
|
108
108
|
header_params = {}
|
109
109
|
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
111
|
# HTTP header 'Content-Type'
|
112
112
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
113
113
|
|
@@ -130,6 +130,61 @@ module CloudmersiveNlpApiClient
|
|
130
130
|
return data, status_code, headers
|
131
131
|
end
|
132
132
|
|
133
|
+
# Perform Semantic Similarity Comparison of Two Strings
|
134
|
+
# Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence.
|
135
|
+
# @param input Input similarity analysis request
|
136
|
+
# @param [Hash] opts the optional parameters
|
137
|
+
# @return [SimilarityAnalysisResponse]
|
138
|
+
def analytics_similarity(input, opts = {})
|
139
|
+
data, _status_code, _headers = analytics_similarity_with_http_info(input, opts)
|
140
|
+
return data
|
141
|
+
end
|
142
|
+
|
143
|
+
# Perform Semantic Similarity Comparison of Two Strings
|
144
|
+
# Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence.
|
145
|
+
# @param input Input similarity analysis request
|
146
|
+
# @param [Hash] opts the optional parameters
|
147
|
+
# @return [Array<(SimilarityAnalysisResponse, Fixnum, Hash)>] SimilarityAnalysisResponse data, response status code and response headers
|
148
|
+
def analytics_similarity_with_http_info(input, opts = {})
|
149
|
+
if @api_client.config.debugging
|
150
|
+
@api_client.config.logger.debug "Calling API: AnalyticsApi.analytics_similarity ..."
|
151
|
+
end
|
152
|
+
# verify the required parameter 'input' is set
|
153
|
+
if @api_client.config.client_side_validation && input.nil?
|
154
|
+
fail ArgumentError, "Missing the required parameter 'input' when calling AnalyticsApi.analytics_similarity"
|
155
|
+
end
|
156
|
+
# resource path
|
157
|
+
local_var_path = "/nlp-v2/analytics/similarity"
|
158
|
+
|
159
|
+
# query parameters
|
160
|
+
query_params = {}
|
161
|
+
|
162
|
+
# header parameters
|
163
|
+
header_params = {}
|
164
|
+
# HTTP header 'Accept' (if needed)
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
166
|
+
# HTTP header 'Content-Type'
|
167
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
168
|
+
|
169
|
+
# form parameters
|
170
|
+
form_params = {}
|
171
|
+
|
172
|
+
# http body (model)
|
173
|
+
post_body = @api_client.object_to_http_body(input)
|
174
|
+
auth_names = ['Apikey']
|
175
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
176
|
+
:header_params => header_params,
|
177
|
+
:query_params => query_params,
|
178
|
+
:form_params => form_params,
|
179
|
+
:body => post_body,
|
180
|
+
:auth_names => auth_names,
|
181
|
+
:return_type => 'SimilarityAnalysisResponse')
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: AnalyticsApi#analytics_similarity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
|
133
188
|
# Perform Subjectivity and Objectivity Analysis on Text
|
134
189
|
# Analyze input text using advanced Subjectivity and Objectivity Language Analysis to determine if the input text is objective or subjective, and how much. Supports English language input. Consumes 1-2 API calls per sentence.
|
135
190
|
# @param input Input subjectivity analysis request
|
@@ -162,7 +217,7 @@ module CloudmersiveNlpApiClient
|
|
162
217
|
# header parameters
|
163
218
|
header_params = {}
|
164
219
|
# HTTP header 'Accept' (if needed)
|
165
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
220
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
166
221
|
# HTTP header 'Content-Type'
|
167
222
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
168
223
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -107,7 +107,7 @@ module CloudmersiveNlpApiClient
|
|
107
107
|
# header parameters
|
108
108
|
header_params = {}
|
109
109
|
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
111
|
# HTTP header 'Content-Type'
|
112
112
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
113
113
|
|
@@ -162,7 +162,7 @@ module CloudmersiveNlpApiClient
|
|
162
162
|
# header parameters
|
163
163
|
header_params = {}
|
164
164
|
# HTTP header 'Accept' (if needed)
|
165
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
166
166
|
# HTTP header 'Content-Type'
|
167
167
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
168
168
|
|
@@ -217,7 +217,7 @@ module CloudmersiveNlpApiClient
|
|
217
217
|
# header parameters
|
218
218
|
header_params = {}
|
219
219
|
# HTTP header 'Accept' (if needed)
|
220
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
220
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
221
221
|
# HTTP header 'Content-Type'
|
222
222
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
223
223
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -107,7 +107,7 @@ module CloudmersiveNlpApiClient
|
|
107
107
|
# header parameters
|
108
108
|
header_params = {}
|
109
109
|
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
111
|
# HTTP header 'Content-Type'
|
112
112
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
113
113
|
|
@@ -162,7 +162,7 @@ module CloudmersiveNlpApiClient
|
|
162
162
|
# header parameters
|
163
163
|
header_params = {}
|
164
164
|
# HTTP header 'Accept' (if needed)
|
165
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
166
166
|
# HTTP header 'Content-Type'
|
167
167
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
168
168
|
|
@@ -217,7 +217,7 @@ module CloudmersiveNlpApiClient
|
|
217
217
|
# header parameters
|
218
218
|
header_params = {}
|
219
219
|
# HTTP header 'Accept' (if needed)
|
220
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
220
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
221
221
|
# HTTP header 'Content-Type'
|
222
222
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
223
223
|
|
@@ -272,7 +272,7 @@ module CloudmersiveNlpApiClient
|
|
272
272
|
# header parameters
|
273
273
|
header_params = {}
|
274
274
|
# HTTP header 'Accept' (if needed)
|
275
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
275
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
276
276
|
# HTTP header 'Content-Type'
|
277
277
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
278
278
|
|
@@ -327,7 +327,7 @@ module CloudmersiveNlpApiClient
|
|
327
327
|
# header parameters
|
328
328
|
header_params = {}
|
329
329
|
# HTTP header 'Accept' (if needed)
|
330
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
330
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
331
331
|
# HTTP header 'Content-Type'
|
332
332
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
333
333
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -107,7 +107,7 @@ module CloudmersiveNlpApiClient
|
|
107
107
|
# header parameters
|
108
108
|
header_params = {}
|
109
109
|
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
111
|
# HTTP header 'Content-Type'
|
112
112
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
113
113
|
|
@@ -52,7 +52,7 @@ module CloudmersiveNlpApiClient
|
|
52
52
|
# header parameters
|
53
53
|
header_params = {}
|
54
54
|
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
56
|
# HTTP header 'Content-Type'
|
57
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
58
|
|
@@ -107,7 +107,7 @@ module CloudmersiveNlpApiClient
|
|
107
107
|
# header parameters
|
108
108
|
header_params = {}
|
109
109
|
# HTTP header 'Accept' (if needed)
|
110
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'
|
110
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
111
111
|
# HTTP header 'Content-Type'
|
112
112
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
113
113
|
|
@@ -0,0 +1,199 @@
|
|
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 similarity analysis operation
|
17
|
+
class SimilarityAnalysisRequest
|
18
|
+
# First text to analyze
|
19
|
+
attr_accessor :text_to_analyze1
|
20
|
+
|
21
|
+
# Second text to analyze
|
22
|
+
attr_accessor :text_to_analyze2
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'text_to_analyze1' => :'TextToAnalyze1',
|
29
|
+
:'text_to_analyze2' => :'TextToAnalyze2'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'text_to_analyze1' => :'String',
|
37
|
+
:'text_to_analyze2' => :'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?(:'TextToAnalyze1')
|
50
|
+
self.text_to_analyze1 = attributes[:'TextToAnalyze1']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'TextToAnalyze2')
|
54
|
+
self.text_to_analyze2 = attributes[:'TextToAnalyze2']
|
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
|
+
text_to_analyze1 == o.text_to_analyze1 &&
|
78
|
+
text_to_analyze2 == o.text_to_analyze2
|
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
|
+
[text_to_analyze1, text_to_analyze2].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
|
@@ -0,0 +1,209 @@
|
|
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 similarity analysis operation
|
17
|
+
class SimilarityAnalysisResponse
|
18
|
+
# True if the similarity analysis operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# Similarity score between 0.0 and 1.0 where scores closer to zero have a low probability of semantic similarity, while scores close to 1.0 have a high probability of semantic similarity.
|
22
|
+
attr_accessor :similarity_score_result
|
23
|
+
|
24
|
+
# Number of sentences in input text
|
25
|
+
attr_accessor :sentence_count
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'successful' => :'Successful',
|
32
|
+
:'similarity_score_result' => :'SimilarityScoreResult',
|
33
|
+
:'sentence_count' => :'SentenceCount'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'successful' => :'BOOLEAN',
|
41
|
+
:'similarity_score_result' => :'Float',
|
42
|
+
:'sentence_count' => :'Integer'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
|
+
|
54
|
+
if attributes.has_key?(:'Successful')
|
55
|
+
self.successful = attributes[:'Successful']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'SimilarityScoreResult')
|
59
|
+
self.similarity_score_result = attributes[:'SimilarityScoreResult']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'SentenceCount')
|
63
|
+
self.sentence_count = attributes[:'SentenceCount']
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
return invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
successful == o.successful &&
|
87
|
+
similarity_score_result == o.similarity_score_result &&
|
88
|
+
sentence_count == o.sentence_count
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Fixnum] Hash code
|
99
|
+
def hash
|
100
|
+
[successful, similarity_score_result, sentence_count].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def build_from_hash(attributes)
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
108
|
+
self.class.swagger_types.each_pair do |key, type|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :DateTime
|
130
|
+
DateTime.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :BOOLEAN
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
temp_model = CloudmersiveNlpApiClient.const_get(type).new
|
161
|
+
temp_model.build_from_hash(value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the string representation of the object
|
166
|
+
# @return [String] String presentation of the object
|
167
|
+
def to_s
|
168
|
+
to_hash.to_s
|
169
|
+
end
|
170
|
+
|
171
|
+
# to_body is an alias to to_hash (backward compatibility)
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_body
|
174
|
+
to_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the object in the form of hash
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_hash
|
180
|
+
hash = {}
|
181
|
+
self.class.attribute_map.each_pair do |attr, param|
|
182
|
+
value = self.send(attr)
|
183
|
+
next if value.nil?
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map{ |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
@@ -56,6 +56,18 @@ describe 'AnalyticsApi' do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
# unit tests for analytics_similarity
|
60
|
+
# Perform Semantic Similarity Comparison of Two Strings
|
61
|
+
# Analyze two input text strings, typically sentences, and determine the semantic similarity of each. Semantic similarity refers to the degree to which two sentences mean the same thing semantically. Uses advanced Deep Learning to perform the semantic similarity comparison. Consumes 1-2 API calls per sentence.
|
62
|
+
# @param input Input similarity analysis request
|
63
|
+
# @param [Hash] opts the optional parameters
|
64
|
+
# @return [SimilarityAnalysisResponse]
|
65
|
+
describe 'analytics_similarity test' do
|
66
|
+
it "should work" do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
59
71
|
# unit tests for analytics_subjectivity
|
60
72
|
# Perform Subjectivity and Objectivity Analysis on Text
|
61
73
|
# Analyze input text using advanced Subjectivity and Objectivity Language Analysis to determine if the input text is objective or subjective, and how much. Supports English language input. Consumes 1-2 API calls per sentence.
|
@@ -0,0 +1,48 @@
|
|
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::SimilarityAnalysisRequest
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'SimilarityAnalysisRequest' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveNlpApiClient::SimilarityAnalysisRequest.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of SimilarityAnalysisRequest' do
|
31
|
+
it 'should create an instance of SimilarityAnalysisRequest' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveNlpApiClient::SimilarityAnalysisRequest)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "text_to_analyze1"' 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 "text_to_analyze2"' 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
|
48
|
+
|
@@ -0,0 +1,54 @@
|
|
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::SimilarityAnalysisResponse
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'SimilarityAnalysisResponse' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveNlpApiClient::SimilarityAnalysisResponse.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of SimilarityAnalysisResponse' do
|
31
|
+
it 'should create an instance of SimilarityAnalysisResponse' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveNlpApiClient::SimilarityAnalysisResponse)
|
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 "similarity_score_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 "sentence_count"' 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
|
+
end
|
54
|
+
|
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
|
+
version: 2.0.8
|
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-
|
11
|
+
date: 2020-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -241,6 +241,8 @@ files:
|
|
241
241
|
- "./docs/SentenceSegmentationResponse.md"
|
242
242
|
- "./docs/SentimentAnalysisRequest.md"
|
243
243
|
- "./docs/SentimentAnalysisResponse.md"
|
244
|
+
- "./docs/SimilarityAnalysisRequest.md"
|
245
|
+
- "./docs/SimilarityAnalysisResponse.md"
|
244
246
|
- "./docs/SpellcheckApi.md"
|
245
247
|
- "./docs/SubjectivityAnalysisRequest.md"
|
246
248
|
- "./docs/SubjectivityAnalysisResponse.md"
|
@@ -289,6 +291,8 @@ files:
|
|
289
291
|
- "./lib/cloudmersive-nlp-api-client/models/sentence_segmentation_response.rb"
|
290
292
|
- "./lib/cloudmersive-nlp-api-client/models/sentiment_analysis_request.rb"
|
291
293
|
- "./lib/cloudmersive-nlp-api-client/models/sentiment_analysis_response.rb"
|
294
|
+
- "./lib/cloudmersive-nlp-api-client/models/similarity_analysis_request.rb"
|
295
|
+
- "./lib/cloudmersive-nlp-api-client/models/similarity_analysis_response.rb"
|
292
296
|
- "./lib/cloudmersive-nlp-api-client/models/subjectivity_analysis_request.rb"
|
293
297
|
- "./lib/cloudmersive-nlp-api-client/models/subjectivity_analysis_response.rb"
|
294
298
|
- "./lib/cloudmersive-nlp-api-client/models/word_position.rb"
|
@@ -334,6 +338,8 @@ files:
|
|
334
338
|
- "./spec/models/sentence_segmentation_response_spec.rb"
|
335
339
|
- "./spec/models/sentiment_analysis_request_spec.rb"
|
336
340
|
- "./spec/models/sentiment_analysis_response_spec.rb"
|
341
|
+
- "./spec/models/similarity_analysis_request_spec.rb"
|
342
|
+
- "./spec/models/similarity_analysis_response_spec.rb"
|
337
343
|
- "./spec/models/subjectivity_analysis_request_spec.rb"
|
338
344
|
- "./spec/models/subjectivity_analysis_response_spec.rb"
|
339
345
|
- "./spec/models/word_position_spec.rb"
|