nlpcloud 1.0.19 → 1.0.22

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 +78 -27
  3. metadata +9 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80404a1148f86e8a328ec28580186d619a963ffe569ea03fc82c3d45fb330783
4
- data.tar.gz: bc04ed304e7c7d12dae401a5d0a7f28e2af8c4abd1fb733b51e2334a6a07aac9
3
+ metadata.gz: a1d7b588b8fb73939149515c74c2e5fb52d601071cbb2b2db48c1af6fdd21985
4
+ data.tar.gz: b22e7d05f89357357c563e9a9550d9a56f373425f7c69573f07b31b963384f3a
5
5
  SHA512:
6
- metadata.gz: 783b517b09f33721cfaad7cb7fa368b79249a7298ad2bf6338b3e6460c4bf089230b7d7fd95ceba1f05d1a54c5e701f8e4893c0930cbcd121f595f0f9be45608
7
- data.tar.gz: 064b44c006a680d81c777c3dd057757d56da7f6a2d709bddbf893f3430819ff3d1a10b21520c62c2fa759295636e96dee05dd1b4823cc0780a6ff57d237d39bd
6
+ metadata.gz: 9909e0444136ca0b75a7b49319d592698a9886ba86a61c9729821e2bcac565bffad9d816804841f71057e8805f8cb9a93f3e20649744d491a992f29e199440e0
7
+ data.tar.gz: 4d0ab4da026e6b515a5660889b871c351e6ef27ee21e3f33af7e08e7670611dca52e5ff0a3e03de294fadfc9e78144ec6a9a56211d58ab85618af39212e10cb4
data/lib/nlpcloud.rb CHANGED
@@ -16,6 +16,9 @@ module NLPCloud
16
16
  'User-Agent' => 'nlpcloud-ruby-client'
17
17
  }
18
18
 
19
+ if lang == 'en'
20
+ lang = ''
21
+
19
22
  @root_url = if gpu && (lang != '')
20
23
  "#{BASE_URL}/#{API_VERSION}/gpu/#{lang}/#{model}"
21
24
  elsif gpu && (lang == '')
@@ -27,12 +30,19 @@ module NLPCloud
27
30
  end
28
31
  end
29
32
 
30
- def entities(text, searched_entity: nil)
33
+ def ad_generation(keywords)
31
34
  payload = {
32
- 'text' => text,
33
- 'searched_entity' => searched_entity
35
+ 'keywords' => keywords
34
36
  }
35
- response = RestClient.post("#{@root_url}/entities", payload.to_json, @headers)
37
+ response = RestClient.post("#{@root_url}/ad-generation", payload.to_json, @headers)
38
+ JSON.parse(response.body)
39
+ end
40
+
41
+ def chatbot(_text, history: nil)
42
+ payload = {
43
+ 'text' => history
44
+ }
45
+ response = RestClient.post("#{@root_url}/chatbot", payload.to_json, @headers)
36
46
  JSON.parse(response.body)
37
47
  end
38
48
 
@@ -46,6 +56,31 @@ module NLPCloud
46
56
  JSON.parse(response.body)
47
57
  end
48
58
 
59
+ def dependencies(text)
60
+ payload = {
61
+ 'text' => text
62
+ }
63
+ response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
64
+ JSON.parse(response.body)
65
+ end
66
+
67
+ def embeddings(sentences)
68
+ payload = {
69
+ 'sentences' => sentences
70
+ }
71
+ response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
72
+ JSON.parse(response.body)
73
+ end
74
+
75
+ def entities(text, searched_entity: nil)
76
+ payload = {
77
+ 'text' => text,
78
+ 'searched_entity' => searched_entity
79
+ }
80
+ response = RestClient.post("#{@root_url}/entities", payload.to_json, @headers)
81
+ JSON.parse(response.body)
82
+ end
83
+
49
84
  def generation(text, min_length: nil, max_length: nil, length_no_input: nil,
50
85
  end_sequence: nil, remove_input: nil, do_sample: nil, num_beams: nil, early_stopping: nil,
51
86
  no_repeat_ngram_size: nil, num_return_sequences: nil, top_k: nil, top_p: nil,
@@ -74,44 +109,57 @@ module NLPCloud
74
109
  JSON.parse(response.body)
75
110
  end
76
111
 
77
- def sentiment(text)
112
+ def gs_correction(text)
78
113
  payload = {
79
114
  'text' => text
80
115
  }
81
- response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
116
+ response = RestClient.post("#{@root_url}/gs-correction", payload.to_json, @headers)
82
117
  JSON.parse(response.body)
83
118
  end
84
119
 
85
- def question(question, context: nil)
120
+ def intent_classification(text)
86
121
  payload = {
87
- 'question' => question,
88
- 'context' => context
122
+ 'text' => text
89
123
  }
90
- response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
124
+ response = RestClient.post("#{@root_url}/intent-classification", payload.to_json, @headers)
91
125
  JSON.parse(response.body)
92
126
  end
93
127
 
94
- def summarization(text)
128
+ def kw_kp_extraction(text)
95
129
  payload = {
96
130
  'text' => text
97
131
  }
98
- response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
132
+ response = RestClient.post("#{@root_url}/kw-kp-extraction", payload.to_json, @headers)
99
133
  JSON.parse(response.body)
100
134
  end
101
135
 
102
- def translation(text)
136
+ def langdetection(text)
103
137
  payload = {
104
138
  'text' => text
105
139
  }
106
- response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
140
+ response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
107
141
  JSON.parse(response.body)
108
142
  end
109
143
 
110
- def langdetection(text)
144
+ def lib_versions
145
+ response = RestClient.get("#{@root_url}/versions", @headers)
146
+ JSON.parse(response.body)
147
+ end
148
+
149
+ def paraphrasing(text)
111
150
  payload = {
112
151
  'text' => text
113
152
  }
114
- response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
153
+ response = RestClient.post("#{@root_url}/paraphrasing", payload.to_json, @headers)
154
+ JSON.parse(response.body)
155
+ end
156
+
157
+ def question(question, context: nil)
158
+ payload = {
159
+ 'question' => question,
160
+ 'context' => context
161
+ }
162
+ response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
115
163
  JSON.parse(response.body)
116
164
  end
117
165
 
@@ -123,40 +171,43 @@ module NLPCloud
123
171
  JSON.parse(response.body)
124
172
  end
125
173
 
126
- def tokens(text)
174
+ def sentence_dependencies(text)
127
175
  payload = {
128
176
  'text' => text
129
177
  }
130
- response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
178
+ response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
131
179
  JSON.parse(response.body)
132
180
  end
133
181
 
134
- def dependencies(text)
182
+ def sentiment(text)
135
183
  payload = {
136
184
  'text' => text
137
185
  }
138
- response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
186
+ response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
139
187
  JSON.parse(response.body)
140
188
  end
141
189
 
142
- def sentence_dependencies(text)
190
+ def summarization(text)
143
191
  payload = {
144
192
  'text' => text
145
193
  }
146
- response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
194
+ response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
147
195
  JSON.parse(response.body)
148
196
  end
149
197
 
150
- def embeddings(sentences)
198
+ def tokens(text)
151
199
  payload = {
152
- 'sentences' => sentences
200
+ 'text' => text
153
201
  }
154
- response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
202
+ response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
155
203
  JSON.parse(response.body)
156
204
  end
157
205
 
158
- def lib_versions
159
- response = RestClient.get("#{@root_url}/versions", @headers)
206
+ def translation(text)
207
+ payload = {
208
+ 'text' => text
209
+ }
210
+ response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
160
211
  JSON.parse(response.body)
161
212
  end
162
213
  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.19
4
+ version: 1.0.22
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-04 00:00:00.000000000 Z
11
+ date: 2022-05-17 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: []
@@ -44,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
46
  - !ruby/object:Gem::Version
45
47
  version: '0'
46
48
  requirements: []
47
- rubygems_version: 3.1.4
49
+ rubygems_version: 3.3.5
48
50
  signing_key:
49
51
  specification_version: 4
50
52
  summary: Ruby client for the NLP Cloud API