nlpcloud 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/nlpcloud.rb +50 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f1bc3ef2c6d093286a398df29a536c6cd7b385c98529ca06504c2acf9d9b1d73
|
4
|
+
data.tar.gz: fde382a7b8d2f2492f674fd9f9b8e915d0703bfc5f3c732d26123cf69120bdb8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4fc09a303f8bccc9100054b42c0b77201c05cb685ffe5f29a06e89066ad92dbdbb1a67fabdb9993f59b4f433c5ebdc2f7e1faaf885f0d446fc0ed97dceb9d465
|
7
|
+
data.tar.gz: b03c237ee994bdc84344379285bf51994640ab618a03b74cfe4e967e4dfac6bc95d6daeb7142e01a35963c0ab72f5a42fa22e9c08c1eea10dba775c90ea26d60
|
data/lib/nlpcloud.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'rest-client'
|
5
|
+
|
6
|
+
module NLPCloud
|
7
|
+
BASE_URL = 'https://api.nlpcloud.io'
|
8
|
+
API_VERSION = 'v1'
|
9
|
+
|
10
|
+
# Client requests the API.
|
11
|
+
class Client
|
12
|
+
def initialize(model, token)
|
13
|
+
@headers = {
|
14
|
+
'Authorization' => "Token #{token}"
|
15
|
+
}
|
16
|
+
@root_url = "#{BASE_URL}/#{API_VERSION}/#{model}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def entities(user_input)
|
20
|
+
api_post('entities', user_input)
|
21
|
+
end
|
22
|
+
|
23
|
+
def dependencies(user_input)
|
24
|
+
api_post('dependencies', user_input)
|
25
|
+
end
|
26
|
+
|
27
|
+
def sentence_dependencies(user_input)
|
28
|
+
api_post('sentence-dependencies', user_input)
|
29
|
+
end
|
30
|
+
|
31
|
+
def lib_versions
|
32
|
+
api_get('version')
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def api_post(endpoint, user_input)
|
38
|
+
payload = {
|
39
|
+
'text' => user_input
|
40
|
+
}
|
41
|
+
response = RestClient.post("#{@root_url}/#{endpoint}", payload.to_json, @headers)
|
42
|
+
JSON.parse(response.body)
|
43
|
+
end
|
44
|
+
|
45
|
+
def api_get(endpoint)
|
46
|
+
response = RestClient.get("#{@root_url}/#{endpoint}", @headers)
|
47
|
+
JSON.parse(response.body)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nlpcloud
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julien Salinas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'Ruby client for the NLP Cloud API. NLP Cloud serves all the spaCy pre-trained
|
14
|
+
models, and your own custom models, through a RESTful API ready for production.
|
15
|
+
More details here: https://nlpcloud.io. Documentation: https://docs.nlpcloud.io.'
|
16
|
+
email: all@juliensalinas.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/nlpcloud.rb
|
22
|
+
homepage: https://github.com/nlpcloud/nlpcloud-ruby
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata:
|
26
|
+
documentation_uri: https://docs.nlpcloud.io
|
27
|
+
homepage_uri: https://nlpcloud.io
|
28
|
+
source_code_uri: https://github.com/nlpcloud/nlpcloud-ruby
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubygems_version: 3.1.4
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Ruby client for the NLP Cloud API
|
48
|
+
test_files: []
|