nlpcloud 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nlpcloud.rb +47 -14
  3. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1bc3ef2c6d093286a398df29a536c6cd7b385c98529ca06504c2acf9d9b1d73
4
- data.tar.gz: fde382a7b8d2f2492f674fd9f9b8e915d0703bfc5f3c732d26123cf69120bdb8
3
+ metadata.gz: c8a08233de83602a883f76f24b1be58b8d6fa909b9194b3b1deeb2d9018d4987
4
+ data.tar.gz: 73830d3e197ff7727371d66f24f24b6829322ec04dafae682fcb3a03750716a3
5
5
  SHA512:
6
- metadata.gz: 4fc09a303f8bccc9100054b42c0b77201c05cb685ffe5f29a06e89066ad92dbdbb1a67fabdb9993f59b4f433c5ebdc2f7e1faaf885f0d446fc0ed97dceb9d465
7
- data.tar.gz: b03c237ee994bdc84344379285bf51994640ab618a03b74cfe4e967e4dfac6bc95d6daeb7142e01a35963c0ab72f5a42fa22e9c08c1eea10dba775c90ea26d60
6
+ metadata.gz: ffb8e5c89f39e339c1163679b3596b3567018c52e51b626351e186162a13d5bf7ac0258387dba2190d856faa9139788a3871a2fe07efbb76b8ca26d09db2a8af
7
+ data.tar.gz: 3216fbd124155653a20ea661a8fae938ddd8305b43bd08495b360b91cb57eb1d81a55b6aa774be2e36722f0cd1edbc644bcf6a1abb482eefb352500e1d151bd1
data/lib/nlpcloud.rb CHANGED
@@ -16,34 +16,67 @@ module NLPCloud
16
16
  @root_url = "#{BASE_URL}/#{API_VERSION}/#{model}"
17
17
  end
18
18
 
19
- def entities(user_input)
20
- api_post('entities', user_input)
19
+ def entities(text)
20
+ payload = {
21
+ 'text' => text
22
+ }
23
+ response = RestClient.post("#{@root_url}/entities", payload.to_json, @headers)
24
+ JSON.parse(response.body)
21
25
  end
22
26
 
23
- def dependencies(user_input)
24
- api_post('dependencies', user_input)
27
+ def classification(text, labels, multi_class)
28
+ payload = {
29
+ 'text' => text,
30
+ 'labels' => labels,
31
+ 'multi_class' => multi_class
32
+ }
33
+ response = RestClient.post("#{@root_url}/classification", payload.to_json, @headers)
34
+ JSON.parse(response.body)
25
35
  end
26
36
 
27
- def sentence_dependencies(user_input)
28
- api_post('sentence-dependencies', user_input)
37
+ def sentiment(text)
38
+ payload = {
39
+ 'text' => text
40
+ }
41
+ response = RestClient.post("#{@root_url}/sentiment", payload.to_json, @headers)
42
+ JSON.parse(response.body)
29
43
  end
30
44
 
31
- def lib_versions
32
- api_get('version')
45
+ def question(context, question)
46
+ payload = {
47
+ 'context' => context,
48
+ 'question' => question
49
+ }
50
+ response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
51
+ JSON.parse(response.body)
33
52
  end
34
53
 
35
- private
54
+ def summarization(text)
55
+ payload = {
56
+ 'text' => text
57
+ }
58
+ response = RestClient.post("#{@root_url}/summarization", payload.to_json, @headers)
59
+ JSON.parse(response.body)
60
+ end
36
61
 
37
- def api_post(endpoint, user_input)
62
+ def dependencies(text)
38
63
  payload = {
39
- 'text' => user_input
64
+ 'text' => text
40
65
  }
41
- response = RestClient.post("#{@root_url}/#{endpoint}", payload.to_json, @headers)
66
+ response = RestClient.post("#{@root_url}/dependencies", payload.to_json, @headers)
42
67
  JSON.parse(response.body)
43
68
  end
44
69
 
45
- def api_get(endpoint)
46
- response = RestClient.get("#{@root_url}/#{endpoint}", @headers)
70
+ def sentence_dependencies(text)
71
+ payload = {
72
+ 'text' => text
73
+ }
74
+ response = RestClient.post("#{@root_url}/sentence-dependencies", payload.to_json, @headers)
75
+ JSON.parse(response.body)
76
+ end
77
+
78
+ def lib_versions
79
+ response = RestClient.get("#{@root_url}/versions", @headers)
47
80
  JSON.parse(response.body)
48
81
  end
49
82
  end
metadata CHANGED
@@ -1,18 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nlpcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
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-01-19 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
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.'
13
+ description: 'Ruby client for the NLP Cloud API. NLP Cloud serves high performance
14
+ pre-trained models for NER, sentiment-analysis, classification, summarization, question
15
+ answering, and POS tagging, ready for production, served through a REST API. More
16
+ details here: https://nlpcloud.io. Documentation: https://docs.nlpcloud.io.'
16
17
  email: all@juliensalinas.com
17
18
  executables: []
18
19
  extensions: []