nlpcloud 1.0.20 → 1.0.23
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 +75 -30
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f076500f18c31ff51717007432a3d67c991803991a048af82086f94167442174
|
4
|
+
data.tar.gz: 3add87cd8b074c486dde61676376243c1bc4e08b8d2eb711ffdc65d292fa1844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02e26507bee02346f3ebd871ba2e0daaa3f1862a4a20ee03c97815841b0aa3604ae61ed512ba11adc2cd6f7adc14a0e932553fc8699bcb3ef66811508cf387a6
|
7
|
+
data.tar.gz: 9482ba800cd69ce7158d32dea7b6ff5689b2e776235d8ec790a329ef9cb1054fba16abbd8b9fe24a3886824d41da32e41af3d04752ea18b093d941bedd00fcd4
|
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,52 +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)
|
115
154
|
JSON.parse(response.body)
|
116
155
|
end
|
117
156
|
|
118
|
-
def
|
157
|
+
def question(question, context: nil)
|
119
158
|
payload = {
|
120
|
-
'
|
159
|
+
'question' => question,
|
160
|
+
'context' => context
|
121
161
|
}
|
122
|
-
response = RestClient.post("#{@root_url}/
|
162
|
+
response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
|
123
163
|
JSON.parse(response.body)
|
124
164
|
end
|
125
165
|
|
@@ -131,40 +171,45 @@ module NLPCloud
|
|
131
171
|
JSON.parse(response.body)
|
132
172
|
end
|
133
173
|
|
134
|
-
def
|
174
|
+
def sentence_dependencies(text)
|
135
175
|
payload = {
|
136
176
|
'text' => text
|
137
177
|
}
|
138
|
-
response = RestClient.post("#{@root_url}/
|
178
|
+
response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
|
139
179
|
JSON.parse(response.body)
|
140
180
|
end
|
141
181
|
|
142
|
-
def
|
182
|
+
def sentiment(text)
|
143
183
|
payload = {
|
144
184
|
'text' => text
|
145
185
|
}
|
146
|
-
response = RestClient.post("#{@root_url}/
|
186
|
+
response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
|
147
187
|
JSON.parse(response.body)
|
148
188
|
end
|
149
189
|
|
150
|
-
def
|
190
|
+
def summarization(text)
|
151
191
|
payload = {
|
152
192
|
'text' => text
|
153
193
|
}
|
154
|
-
response = RestClient.post("#{@root_url}/
|
194
|
+
response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
|
155
195
|
JSON.parse(response.body)
|
156
196
|
end
|
157
197
|
|
158
|
-
def
|
198
|
+
def tokens(text)
|
159
199
|
payload = {
|
160
|
-
'
|
200
|
+
'text' => text
|
161
201
|
}
|
162
|
-
response = RestClient.post("#{@root_url}/
|
202
|
+
response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
|
163
203
|
JSON.parse(response.body)
|
164
204
|
end
|
165
205
|
|
166
|
-
def
|
167
|
-
|
206
|
+
def translation(text, source, target)
|
207
|
+
payload = {
|
208
|
+
'text' => text,
|
209
|
+
'source' => source,
|
210
|
+
'target' => target
|
211
|
+
}
|
212
|
+
response = RestClient.post("#{@root_url}/translation", payload.to_json, @headers)
|
168
213
|
JSON.parse(response.body)
|
169
214
|
end
|
170
215
|
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.
|
4
|
+
version: 1.0.23
|
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-06-01 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,
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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: []
|
@@ -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
|