nlpcloud 1.0.18 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nlpcloud.rb +75 -26
  3. metadata +8 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ce2d6801c7755ddca5273e89a899ab4fc5980f59046b29e48f2b5fbcdd2c735
4
- data.tar.gz: c4f466132c5378e2009d3fe5f16abd4d5fb50b7d60ae3993f1bc8986417e88f0
3
+ metadata.gz: daea21690d482c9ee35fad3cb642d9ee5ac7664382cc967ab72c0c028d7a97ec
4
+ data.tar.gz: 7e219ff198f0000cd94e8c56cae5ba72f0c8be5c74463fde980a9264f40f1a9f
5
5
  SHA512:
6
- metadata.gz: e174bf062d7e069ae5a51dc264b7fff737e10ef49a25047221659e18baa75301fb60e8b28ca5fc63d4dcf6db9fd64368a2e7c8b20bee5e0e1912e2fbbd36ac9d
7
- data.tar.gz: 6d84bd69c13b9fa22a4f2f7fb5dbf0f76efb067a477f5546b126b5f825d655dae64b351ff8424b68bcd2f38c567335e15e4268b87b7ea2fbb95b37735d4d8070
6
+ metadata.gz: 8aa67c69f359eef5084f305e417670bd39735774c9c13a9c220488495ced061d298a4d31ad0f22f1e234d4405cd2ac9361610174e93f895af9b14723cf5b1909
7
+ data.tar.gz: d7d8b654c74b05b3abf2f5eb50e423c98f6c474fb896a2359125734c5f30d2b11311922fd682cdf46db8257016f9b826d0003e2f13452f8ec99ac6f65519b2c0
data/lib/nlpcloud.rb CHANGED
@@ -27,11 +27,19 @@ module NLPCloud
27
27
  end
28
28
  end
29
29
 
30
- def entities(text)
30
+ def ad_generation(keywords)
31
31
  payload = {
32
- 'text' => text
32
+ 'keywords' => keywords
33
33
  }
34
- 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)
35
43
  JSON.parse(response.body)
36
44
  end
37
45
 
@@ -45,6 +53,31 @@ module NLPCloud
45
53
  JSON.parse(response.body)
46
54
  end
47
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
+
48
81
  def generation(text, min_length: nil, max_length: nil, length_no_input: nil,
49
82
  end_sequence: nil, remove_input: nil, do_sample: nil, num_beams: nil, early_stopping: nil,
50
83
  no_repeat_ngram_size: nil, num_return_sequences: nil, top_k: nil, top_p: nil,
@@ -73,44 +106,57 @@ module NLPCloud
73
106
  JSON.parse(response.body)
74
107
  end
75
108
 
76
- def sentiment(text)
109
+ def gs_correction(text)
77
110
  payload = {
78
111
  'text' => text
79
112
  }
80
- response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
113
+ response = RestClient.post("#{@root_url}/gs-correction", payload.to_json, @headers)
81
114
  JSON.parse(response.body)
82
115
  end
83
116
 
84
- def question(question, context: nil)
117
+ def intent_classification(text)
85
118
  payload = {
86
- 'question' => question,
87
- 'context' => context
119
+ 'text' => text
88
120
  }
89
- response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
121
+ response = RestClient.post("#{@root_url}/intent-classification", payload.to_json, @headers)
90
122
  JSON.parse(response.body)
91
123
  end
92
124
 
93
- def summarization(text)
125
+ def kw_kp_extraction(text)
94
126
  payload = {
95
127
  'text' => text
96
128
  }
97
- response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
129
+ response = RestClient.post("#{@root_url}/kw-kp-extraction", payload.to_json, @headers)
98
130
  JSON.parse(response.body)
99
131
  end
100
132
 
101
- def translation(text)
133
+ def langdetection(text)
102
134
  payload = {
103
135
  'text' => text
104
136
  }
105
- response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
137
+ response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
106
138
  JSON.parse(response.body)
107
139
  end
108
140
 
109
- def langdetection(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)
110
147
  payload = {
111
148
  'text' => text
112
149
  }
113
- response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
150
+ response = RestClient.post("#{@root_url}/paraphrasing", payload.to_json, @headers)
151
+ JSON.parse(response.body)
152
+ end
153
+
154
+ def question(question, context: nil)
155
+ payload = {
156
+ 'question' => question,
157
+ 'context' => context
158
+ }
159
+ response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
114
160
  JSON.parse(response.body)
115
161
  end
116
162
 
@@ -122,40 +168,43 @@ module NLPCloud
122
168
  JSON.parse(response.body)
123
169
  end
124
170
 
125
- def tokens(text)
171
+ def sentence_dependencies(text)
126
172
  payload = {
127
173
  'text' => text
128
174
  }
129
- response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
175
+ response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
130
176
  JSON.parse(response.body)
131
177
  end
132
178
 
133
- def dependencies(text)
179
+ def sentiment(text)
134
180
  payload = {
135
181
  'text' => text
136
182
  }
137
- response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
183
+ response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
138
184
  JSON.parse(response.body)
139
185
  end
140
186
 
141
- def sentence_dependencies(text)
187
+ def summarization(text)
142
188
  payload = {
143
189
  'text' => text
144
190
  }
145
- response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
191
+ response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
146
192
  JSON.parse(response.body)
147
193
  end
148
194
 
149
- def embeddings(sentences)
195
+ def tokens(text)
150
196
  payload = {
151
- 'sentences' => sentences
197
+ 'text' => text
152
198
  }
153
- response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
199
+ response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
154
200
  JSON.parse(response.body)
155
201
  end
156
202
 
157
- def lib_versions
158
- 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)
159
208
  JSON.parse(response.body)
160
209
  end
161
210
  end
metadata CHANGED
@@ -1,20 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nlpcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
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-03 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, text generation, question answering,
15
- machine translation, language detection, semantic similarity, tokenization, POS
16
- tagging, embeddings, and dependency parsing. It is ready for production, served
17
- through a REST API. This is the Ruby client for the API. More details here: https://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.
18
20
  Documentation: https://docs.nlpcloud.io.'
19
21
  email: all@juliensalinas.com
20
22
  executables: []