nlpcloud 1.0.9 → 1.0.10
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.
- checksums.yaml +4 -4
- data/lib/nlpcloud.rb +25 -3
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a4b97770d4b1a6f6daf5c3365f5dbe266e82113ab54b4219cf414458aa7907
|
4
|
+
data.tar.gz: ec629fbc99105b49cb4f90b90b42b2ad812d509c808d28b77859b61dc7c2b4e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a618257dc0d197126b16698d51957209989b533bbcaf731c6ac4a7987c25ad83b712688d14ea5b3bccdf61c5c8a7675bd0786f30ca5ddb8dca6a6a69f1307f7c
|
7
|
+
data.tar.gz: db964aa4c66127a60c64e19b21c8377969f83eec024b1dab3dd3d85ed47d31ece8458ee7cebca7c664b3bb993eae69d028bdfe04c3f5fa2afc965f92c827e49a
|
data/lib/nlpcloud.rb
CHANGED
@@ -9,11 +9,17 @@ module NLPCloud
|
|
9
9
|
|
10
10
|
# Client requests the API.
|
11
11
|
class Client
|
12
|
-
def initialize(model, token)
|
12
|
+
def initialize(model, token, gpu: false)
|
13
13
|
@headers = {
|
14
|
-
'Authorization' => "Token #{token}"
|
14
|
+
'Authorization' => "Token #{token}",
|
15
|
+
"User-Agent": 'nlploud-ruby-client'
|
15
16
|
}
|
16
|
-
|
17
|
+
|
18
|
+
@root_url = if gpu
|
19
|
+
"#{BASE_URL}/#{API_VERSION}/gpu/#{model}"
|
20
|
+
else
|
21
|
+
"#{BASE_URL}/#{API_VERSION}/#{model}"
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
def entities(text)
|
@@ -67,6 +73,22 @@ module NLPCloud
|
|
67
73
|
JSON.parse(response.body)
|
68
74
|
end
|
69
75
|
|
76
|
+
def langdetection(text)
|
77
|
+
payload = {
|
78
|
+
'text' => text
|
79
|
+
}
|
80
|
+
response = RestClient.post("#{@root_url}/langdetection", payload.to_json, @headers)
|
81
|
+
JSON.parse(response.body)
|
82
|
+
end
|
83
|
+
|
84
|
+
def tokens(text)
|
85
|
+
payload = {
|
86
|
+
'text' => text
|
87
|
+
}
|
88
|
+
response = RestClient.post("#{@root_url}/tokens", payload.to_json, @headers)
|
89
|
+
JSON.parse(response.body)
|
90
|
+
end
|
91
|
+
|
70
92
|
def dependencies(text)
|
71
93
|
payload = {
|
72
94
|
'text' => text
|
metadata
CHANGED
@@ -1,19 +1,20 @@
|
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Salinas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: '
|
14
|
-
|
15
|
-
|
16
|
-
|
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, tokenization, POS tagging, and dependency
|
16
|
+
parsing. It is ready for production, served through a REST API. This is the Ruby
|
17
|
+
client for the API. More details here: https://nlpcloud.io. Documentation: https://docs.nlpcloud.io.'
|
17
18
|
email: all@juliensalinas.com
|
18
19
|
executables: []
|
19
20
|
extensions: []
|