nlpcloud 1.0.15 → 1.0.18

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nlpcloud.rb +23 -6
  3. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7a5cf9c2df4c28f9f5b880d8becfc560adcd1578b6b2b1c84fc41adfd4a4451
4
- data.tar.gz: 89137b44db071f0cae6400dab96a1f28e5550aa0d470f0814efd9e888b98c41c
3
+ metadata.gz: 0ce2d6801c7755ddca5273e89a899ab4fc5980f59046b29e48f2b5fbcdd2c735
4
+ data.tar.gz: c4f466132c5378e2009d3fe5f16abd4d5fb50b7d60ae3993f1bc8986417e88f0
5
5
  SHA512:
6
- metadata.gz: 9c8de92b7d3f71708f54265a8dfbc09a004f7025afb28965bab867df9352c2c7e6fa990fff60c18286707ff5b214f7443d7c4a236a3d70017cae2499332d64e0
7
- data.tar.gz: b26ea1c63cbee49c1622fda01f7a5f1a2abc3d4a1cac44920cea52e11fc359a5a38f897570a6c53cb75b5d00bf0bedc9760b7ed537f39a84ca6e259810666d3b
6
+ metadata.gz: e174bf062d7e069ae5a51dc264b7fff737e10ef49a25047221659e18baa75301fb60e8b28ca5fc63d4dcf6db9fd64368a2e7c8b20bee5e0e1912e2fbbd36ac9d
7
+ data.tar.gz: 6d84bd69c13b9fa22a4f2f7fb5dbf0f76efb067a477f5546b126b5f825d655dae64b351ff8424b68bcd2f38c567335e15e4268b87b7ea2fbb95b37735d4d8070
data/lib/nlpcloud.rb CHANGED
@@ -35,7 +35,7 @@ module NLPCloud
35
35
  JSON.parse(response.body)
36
36
  end
37
37
 
38
- def classification(text, labels, multi_class: nil)
38
+ def classification(text, labels: nil, multi_class: nil)
39
39
  payload = {
40
40
  'text' => text,
41
41
  'labels' => labels,
@@ -48,7 +48,7 @@ module NLPCloud
48
48
  def generation(text, min_length: nil, max_length: nil, length_no_input: nil,
49
49
  end_sequence: nil, remove_input: nil, do_sample: nil, num_beams: nil, early_stopping: nil,
50
50
  no_repeat_ngram_size: nil, num_return_sequences: nil, top_k: nil, top_p: nil,
51
- temperature: nil, repetition_penalty: nil, length_penalty: nil, bad_words: nil)
51
+ temperature: nil, repetition_penalty: nil, length_penalty: nil, bad_words: nil, remove_end_sequence: nil)
52
52
  payload = {
53
53
  'text' => text,
54
54
  'min_length' => min_length,
@@ -66,7 +66,8 @@ module NLPCloud
66
66
  'temperature' => temperature,
67
67
  'repetition_penalty' => repetition_penalty,
68
68
  'length_penalty' => length_penalty,
69
- 'bad_words' => bad_words
69
+ 'bad_words' => bad_words,
70
+ 'remove_end_sequence' => remove_end_sequence
70
71
  }
71
72
  response = RestClient.post("#{@root_url}/generation", payload.to_json, @headers)
72
73
  JSON.parse(response.body)
@@ -80,10 +81,10 @@ module NLPCloud
80
81
  JSON.parse(response.body)
81
82
  end
82
83
 
83
- def question(context, question)
84
+ def question(question, context: nil)
84
85
  payload = {
85
- 'context' => context,
86
- 'question' => question
86
+ 'question' => question,
87
+ 'context' => context
87
88
  }
88
89
  response = RestClient.post("#{@root_url}/question", payload.to_json, @headers)
89
90
  JSON.parse(response.body)
@@ -113,6 +114,14 @@ module NLPCloud
113
114
  JSON.parse(response.body)
114
115
  end
115
116
 
117
+ def semantic_similarity(sentences)
118
+ payload = {
119
+ 'sentences' => sentences
120
+ }
121
+ response = RestClient.post("#{@root_url}/semantic_similarity", payload.to_json, @headers)
122
+ JSON.parse(response.body)
123
+ end
124
+
116
125
  def tokens(text)
117
126
  payload = {
118
127
  'text' => text
@@ -137,6 +146,14 @@ module NLPCloud
137
146
  JSON.parse(response.body)
138
147
  end
139
148
 
149
+ def embeddings(sentences)
150
+ payload = {
151
+ 'sentences' => sentences
152
+ }
153
+ response = RestClient.post("#{@root_url}/embeddings", payload.to_json, @headers)
154
+ JSON.parse(response.body)
155
+ end
156
+
140
157
  def lib_versions
141
158
  response = RestClient.get("#{@root_url}/versions", @headers)
142
159
  JSON.parse(response.body)
metadata CHANGED
@@ -1,20 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nlpcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.18
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-01-19 00:00:00.000000000 Z
11
+ date: 2022-03-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'NLP Cloud serves high performance pre-trained or custom models for NER,
14
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.'
15
+ machine translation, language detection, semantic similarity, tokenization, POS
16
+ tagging, embeddings, and dependency parsing. It is ready for production, served
17
+ through a REST API. This is the Ruby client for the API. More details here: https://nlpcloud.io.
18
+ Documentation: https://docs.nlpcloud.io.'
18
19
  email: all@juliensalinas.com
19
20
  executables: []
20
21
  extensions: []