indico 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/indico.rb CHANGED
@@ -123,6 +123,10 @@ module Indico
123
123
  api_handler(text, "places", config)
124
124
  end
125
125
 
126
+ def self.summarization(text, config = {})
127
+ api_handler(text, "summarization", config)
128
+ end
129
+
126
130
  def self.fer(image, config = nil)
127
131
  size = (config != nil and config["detect"] == true) ? false : 48
128
132
  api_handler(preprocess(image, size, false), 'fer', config)
data/lib/indico/helper.rb CHANGED
@@ -69,7 +69,7 @@ module Indico
69
69
 
70
70
  results = JSON.parse(response.body)
71
71
  if results.key?('error')
72
- fail results['error']
72
+ fail IndicoError, results['error']
73
73
  else
74
74
  results['results']
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module Indico
2
- VERSION = '0.10.2'
2
+ VERSION = '0.10.3'
3
3
  end
data/spec/indico_spec.rb CHANGED
@@ -173,6 +173,14 @@ describe Indico do
173
173
  expect result[0]["confidence"] != v1_result[0]["confidence"]
174
174
  end
175
175
 
176
+ it 'should return a text summary' do
177
+ text = "We've been debunking this hoax for SEVEN YEARS now, and here we are doing it again. " \
178
+ "No, Facebook hasn't changed its privacy settings. " \
179
+ "No, what you post doesn't belong to Facebook now. "
180
+ result = Indico.summarization(text, {top_n: 1})
181
+ expect(result.length).to eql(1)
182
+ end
183
+
176
184
  it 'should tag face with correct facial expression' do
177
185
  expected_keys = Set.new(%w(Angry Sad Neutral Surprise Fear Happy))
178
186
  test_face= File.dirname(__FILE__) + "/data/happy.png"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indico
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-09-27 00:00:00.000000000 Z
15
+ date: 2016-10-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: inifile