nlpcloud 1.0.20 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nlpcloud.rb +70 -30
  3. metadata +9 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb4f92a6a1a8bd0bb34711c966b14e794ab58e5d2fd4d6971c12e80906fc511b
4
- data.tar.gz: 3834f4b08fafa823d89c64a375ad5dc5c6321dcb003dc481ea4c842878d14a2a
3
+ metadata.gz: daea21690d482c9ee35fad3cb642d9ee5ac7664382cc967ab72c0c028d7a97ec
4
+ data.tar.gz: 7e219ff198f0000cd94e8c56cae5ba72f0c8be5c74463fde980a9264f40f1a9f
5
5
  SHA512:
6
- metadata.gz: 060e2f7e75120e8c7efa4eb7a6b7412c0fff23cfab0adbe79e6b74d9a6faa289838a93f56d31349bee2b38909458528c5cc938a2c40b8fa971105e5b63ab849f
7
- data.tar.gz: aa01522b0580040c7aeaa7718a75c1d8f44a18a563424c725e478db97224a6fbbacda278ee155939714f2d7e51d1523b6ee9df16b0d9646222997c121b425e7b
6
+ metadata.gz: 8aa67c69f359eef5084f305e417670bd39735774c9c13a9c220488495ced061d298a4d31ad0f22f1e234d4405cd2ac9361610174e93f895af9b14723cf5b1909
7
+ data.tar.gz: d7d8b654c74b05b3abf2f5eb50e423c98f6c474fb896a2359125734c5f30d2b11311922fd682cdf46db8257016f9b826d0003e2f13452f8ec99ac6f65519b2c0
data/lib/nlpcloud.rb CHANGED
@@ -27,12 +27,19 @@ module NLPCloud
27
27
  end
28
28
  end
29
29
 
30
- def entities(text, searched_entity: nil)
30
+ def ad_generation(keywords)
31
31
  payload = {
32
- 'text' => text,
33
- 'searched_entity' => searched_entity
32
+ 'keywords' => keywords
34
33
  }
35
- response = RestClient.post("#{@root_url}/entities", payload.to_json, @headers)
34
+ response = RestClient.post("#{@root_url}/ad-generation", payload.to_json, @headers)
35
+ JSON.parse(response.body)
36
+ end
37
+
38
+ def chatbot(_text, history: nil)
39
+ payload = {
40
+ 'text' => history
41
+ }
42
+ response = RestClient.post("#{@root_url}/chatbot", payload.to_json, @headers)
36
43
  JSON.parse(response.body)
37
44
  end
38
45
 
@@ -46,6 +53,31 @@ module NLPCloud
46
53
  JSON.parse(response.body)
47
54
  end
48
55
 
56
+ def dependencies(text)
57
+ payload = {
58
+ 'text' => text
59
+ }
60
+ response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
61
+ JSON.parse(response.body)
62
+ end
63
+
64
+ def embeddings(sentences)
65
+ payload = {
66
+ 'sentences' => sentences
67
+ }
68
+ response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
69
+ JSON.parse(response.body)
70
+ end
71
+
72
+ def entities(text, searched_entity: nil)
73
+ payload = {
74
+ 'text' => text,
75
+ 'searched_entity' => searched_entity
76
+ }
77
+ response = RestClient.post("#{@root_url}/entities", payload.to_json, @headers)
78
+ JSON.parse(response.body)
79
+ end
80
+
49
81
  def generation(text, min_length: nil, max_length: nil, length_no_input: nil,
50
82
  end_sequence: nil, remove_input: nil, do_sample: nil, num_beams: nil, early_stopping: nil,
51
83
  no_repeat_ngram_size: nil, num_return_sequences: nil, top_k: nil, top_p: nil,
@@ -74,52 +106,57 @@ module NLPCloud
74
106
  JSON.parse(response.body)
75
107
  end
76
108
 
77
- def sentiment(text)
109
+ def gs_correction(text)
78
110
  payload = {
79
111
  'text' => text
80
112
  }
81
- response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
113
+ response = RestClient.post("#{@root_url}/gs-correction", payload.to_json, @headers)
82
114
  JSON.parse(response.body)
83
115
  end
84
116
 
85
- def question(question, context: nil)
117
+ def intent_classification(text)
86
118
  payload = {
87
- 'question' => question,
88
- 'context' => context
119
+ 'text' => text
89
120
  }
90
- response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
121
+ response = RestClient.post("#{@root_url}/intent-classification", payload.to_json, @headers)
91
122
  JSON.parse(response.body)
92
123
  end
93
124
 
94
- def summarization(text)
125
+ def kw_kp_extraction(text)
95
126
  payload = {
96
127
  'text' => text
97
128
  }
98
- response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
129
+ response = RestClient.post("#{@root_url}/kw-kp-extraction", payload.to_json, @headers)
99
130
  JSON.parse(response.body)
100
131
  end
101
132
 
102
- def paraphrasing(text)
133
+ def langdetection(text)
103
134
  payload = {
104
135
  'text' => text
105
136
  }
106
- response = RestClient.post("#{@root_url}/paraphrasing", payload.to_json, @headers)
137
+ response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
107
138
  JSON.parse(response.body)
108
139
  end
109
140
 
110
- def translation(text)
141
+ def lib_versions
142
+ response = RestClient.get("#{@root_url}/versions", @headers)
143
+ JSON.parse(response.body)
144
+ end
145
+
146
+ def paraphrasing(text)
111
147
  payload = {
112
148
  'text' => text
113
149
  }
114
- response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
150
+ response = RestClient.post("#{@root_url}/paraphrasing", payload.to_json, @headers)
115
151
  JSON.parse(response.body)
116
152
  end
117
153
 
118
- def langdetection(text)
154
+ def question(question, context: nil)
119
155
  payload = {
120
- 'text' => text
156
+ 'question' => question,
157
+ 'context' => context
121
158
  }
122
- response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
159
+ response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
123
160
  JSON.parse(response.body)
124
161
  end
125
162
 
@@ -131,40 +168,43 @@ module NLPCloud
131
168
  JSON.parse(response.body)
132
169
  end
133
170
 
134
- def tokens(text)
171
+ def sentence_dependencies(text)
135
172
  payload = {
136
173
  'text' => text
137
174
  }
138
- response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
175
+ response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
139
176
  JSON.parse(response.body)
140
177
  end
141
178
 
142
- def dependencies(text)
179
+ def sentiment(text)
143
180
  payload = {
144
181
  'text' => text
145
182
  }
146
- response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
183
+ response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
147
184
  JSON.parse(response.body)
148
185
  end
149
186
 
150
- def sentence_dependencies(text)
187
+ def summarization(text)
151
188
  payload = {
152
189
  'text' => text
153
190
  }
154
- response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
191
+ response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
155
192
  JSON.parse(response.body)
156
193
  end
157
194
 
158
- def embeddings(sentences)
195
+ def tokens(text)
159
196
  payload = {
160
- 'sentences' => sentences
197
+ 'text' => text
161
198
  }
162
- response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
199
+ response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
163
200
  JSON.parse(response.body)
164
201
  end
165
202
 
166
- def lib_versions
167
- response = RestClient.get("#{@root_url}/versions", @headers)
203
+ def translation(text)
204
+ payload = {
205
+ 'text' => text
206
+ }
207
+ response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
168
208
  JSON.parse(response.body)
169
209
  end
170
210
  end
metadata CHANGED
@@ -1,21 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nlpcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20
4
+ version: 1.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Salinas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-06 00:00:00.000000000 Z
11
+ date: 2022-03-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'NLP Cloud serves high performance pre-trained or custom models for NER,
14
- sentiment-analysis, classification, summarization, paraphrasing, text generation,
15
- question answering, machine translation, language detection, semantic similarity,
16
- tokenization, POS tagging, embeddings, and dependency parsing. It is ready for production,
17
- served through a REST API. This is the Ruby client for the API. More details here:
18
- https://nlpcloud.io. Documentation: https://docs.nlpcloud.io.'
14
+ sentiment-analysis, classification, summarization, paraphrasing, grammar and spelling
15
+ correction, keywords and keyphrases extraction, chatbot, product description and
16
+ ad generation, intent classification, text generation, question answering, machine
17
+ translation, language detection, semantic similarity, tokenization, POS tagging,
18
+ embeddings, and dependency parsing. It is ready for production, served through a
19
+ REST API. This is the Ruby client for the API. More details here: https://nlpcloud.io.
20
+ Documentation: https://docs.nlpcloud.io.'
19
21
  email: all@juliensalinas.com
20
22
  executables: []
21
23
  extensions: []