nlpcloud 1.0.19 → 1.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nlpcloud.rb +78 -27
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1d7b588b8fb73939149515c74c2e5fb52d601071cbb2b2db48c1af6fdd21985
|
4
|
+
data.tar.gz: b22e7d05f89357357c563e9a9550d9a56f373425f7c69573f07b31b963384f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
33
|
+
def ad_generation(keywords)
|
31
34
|
payload = {
|
32
|
-
'
|
33
|
-
'searched_entity' => searched_entity
|
35
|
+
'keywords' => keywords
|
34
36
|
}
|
35
|
-
response = RestClient.post("#{@root_url}/
|
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
|
112
|
+
def gs_correction(text)
|
78
113
|
payload = {
|
79
114
|
'text' => text
|
80
115
|
}
|
81
|
-
response = RestClient.post("#{@root_url}/
|
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
|
120
|
+
def intent_classification(text)
|
86
121
|
payload = {
|
87
|
-
'
|
88
|
-
'context' => context
|
122
|
+
'text' => text
|
89
123
|
}
|
90
|
-
response = RestClient.post("#{@root_url}/
|
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
|
128
|
+
def kw_kp_extraction(text)
|
95
129
|
payload = {
|
96
130
|
'text' => text
|
97
131
|
}
|
98
|
-
response = RestClient.post("#{@root_url}/
|
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
|
136
|
+
def langdetection(text)
|
103
137
|
payload = {
|
104
138
|
'text' => text
|
105
139
|
}
|
106
|
-
response = RestClient.post("#{@root_url}/
|
140
|
+
response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
|
107
141
|
JSON.parse(response.body)
|
108
142
|
end
|
109
143
|
|
110
|
-
def
|
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}/
|
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
|
174
|
+
def sentence_dependencies(text)
|
127
175
|
payload = {
|
128
176
|
'text' => text
|
129
177
|
}
|
130
|
-
response = RestClient.post("#{@root_url}/
|
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
|
182
|
+
def sentiment(text)
|
135
183
|
payload = {
|
136
184
|
'text' => text
|
137
185
|
}
|
138
|
-
response = RestClient.post("#{@root_url}/
|
186
|
+
response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
|
139
187
|
JSON.parse(response.body)
|
140
188
|
end
|
141
189
|
|
142
|
-
def
|
190
|
+
def summarization(text)
|
143
191
|
payload = {
|
144
192
|
'text' => text
|
145
193
|
}
|
146
|
-
response = RestClient.post("#{@root_url}/
|
194
|
+
response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
|
147
195
|
JSON.parse(response.body)
|
148
196
|
end
|
149
197
|
|
150
|
-
def
|
198
|
+
def tokens(text)
|
151
199
|
payload = {
|
152
|
-
'
|
200
|
+
'text' => text
|
153
201
|
}
|
154
|
-
response = RestClient.post("#{@root_url}/
|
202
|
+
response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
|
155
203
|
JSON.parse(response.body)
|
156
204
|
end
|
157
205
|
|
158
|
-
def
|
159
|
-
|
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.
|
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-
|
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,
|
15
|
-
|
16
|
-
|
17
|
-
|
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.
|
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
|