alchemy-api-rb 0.7.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 27897aabc68b346ff1072a7a171157808352563e
4
- data.tar.gz: f531406493702ae8ceb335411e948dee76b166ad
2
+ SHA256:
3
+ metadata.gz: 0a16e75a69158f058748bf8683051976cf2d16152d98fd22b5d89308aec40b5b
4
+ data.tar.gz: 0f0ca590a560302c6a6b994be02c669bc4af706d62dd9f9474764512578680f3
5
5
  SHA512:
6
- metadata.gz: b1e2ded8fe1487ea7a39a820bd47ce08243e8e7bf2dd6cd03a84d2a3e1183dbe61798961075894fa9447398ee687aac1a083339407e8294e02f6b1e6b749a260
7
- data.tar.gz: efe914ea6bd0e7e85db69ec74b5eecf166c79107df2d5670578c56d6eea182899341d329d158496b30719d2ae5f17dccb48c7deba5f62cb193f1347ee3c3bc4b
6
+ metadata.gz: b1c067bfaeb3796ec79cf1c885f875f175fe33e3db49d571f1b9c7d34dd8a111d75661a90565db1c60485db03d30b4775d0d439b7a2d183a107b7c336cf25b06
7
+ data.tar.gz: '0584936bc2802852de9fa1a5715e87846d3383c7f85bf60d2b031b6c85e18f98e747860addf6c35a524027b5a830cd629df0fff6206f5eb096de152de82c2f46'
@@ -1,4 +1,5 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.2
2
3
  Exclude:
3
4
  - alchemy-api-rb.gemspec
4
5
  - vendor/**/*
@@ -11,7 +12,80 @@ Encoding:
11
12
  # no need to always specify encoding
12
13
  Enabled: false
13
14
 
14
- LineLength:
15
- # just one more character please
16
- Max: 80
15
+ Style/NumericPredicate:
16
+ # The following is a false positive for specs:
17
+ #
18
+ # "Use be.positive? instead of be > 0."
19
+ Exclude:
20
+ - 'spec/**/*'
21
+
22
+ Metrics/BlockLength:
23
+ # Certain DSL use blocks and can be lengthy
24
+ Exclude:
25
+ - 'spec/**/*'
26
+ - 'alchemy-api-rb.gemspec'
27
+
28
+ AlignParameters:
29
+ # allow for multi-line methods to have normal indentation.
30
+ # for example:
31
+ #
32
+ # Person.where(
33
+ # first_name: 'tom',
34
+ # last_name: 'foolery'
35
+ # )
36
+ EnforcedStyle: with_fixed_indentation
37
+
38
+ Layout/AlignParameters:
39
+ # allow for end of if to be aligned with a variable.
40
+ # for example:
41
+ #
42
+ # foo = if a == b
43
+ # 'bar'
44
+ # else
45
+ # 'baz'
46
+ # end
47
+ EnforcedStyle: with_fixed_indentation
48
+
49
+ Layout/MultilineMethodCallIndentation:
50
+ # allow for multi-line method chaining to have normal indentation.
51
+ # for example:
52
+ #
53
+ # Person
54
+ # .where(first_name: 'tom')
55
+ # .not(last_name: 'foolery')
56
+ EnforcedStyle: indented
57
+
58
+ Style/RaiseArgs:
59
+ Enabled: false
60
+
61
+ Lint/EndAlignment:
62
+ EnforcedStyleAlignWith: variable
63
+
64
+ ClassAndModuleChildren:
65
+ # ok to use compact style when modules are predefined.
66
+ # for example the following is fine so long as we're sure that
67
+ # module MDB has already been required/defined.
68
+ #
69
+ # class MDB::Person; end
70
+ Enabled: false
71
+
72
+ Style/FrozenStringLiteralComment:
73
+ Enabled: false
74
+
75
+ Style/ParallelAssignment:
76
+ Enabled: false
17
77
 
78
+ Metrics/AbcSize:
79
+ Enabled: true
80
+
81
+ Metrics/MethodLength:
82
+ Enabled: false
83
+
84
+ Style/PercentLiteralDelimiters:
85
+ PreferredDelimiters:
86
+ default: ()
87
+ "%i": ()
88
+ "%w": ()
89
+
90
+ Style/FormatString:
91
+ Enabled: false
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.2.9
@@ -2,12 +2,13 @@ language: ruby
2
2
 
3
3
  cache: bundler
4
4
 
5
+ before_install: gem update --system
6
+
5
7
  rvm:
6
- - 2.3.0
7
- - 2.2.4
8
- - 2.1.8
9
- - 2.0.0-p648
10
- - jruby-19mode
8
+ - 2.5.0
9
+ - 2.4.3
10
+ - 2.2.9
11
+ - jruby
11
12
 
12
13
  env:
13
14
  global:
@@ -2,6 +2,11 @@
2
2
 
3
3
  * Your contribution here.
4
4
 
5
+ # 0.8.0 (01/24/2018)
6
+
7
+ * [#26](https://github.com/technekes/alchemy-api-rb/pull/26): Add support for image scene text extraction endpoint - [@sciamp](https://github.com/sciamp)
8
+ * [#25](https://github.com/technekes/alchemy-api-rb/pull/25): Add support for emotion analysis endpoint - [@sciamp](https://github.com/sciamp)
9
+
5
10
  # 0.7.0 (04/22/2016)
6
11
 
7
12
  ### Changes
@@ -49,4 +54,3 @@
49
54
  #### Fixes
50
55
 
51
56
  * [#9](https://github.com/technekes/alchemy-api-rb/pull/9): Set excon adapter on faraday initialization - [@AdamFerguson](https://github.com/AdamFerguson).
52
-
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://secure.travis-ci.org/technekes/alchemy-api-rb.png?branch=master)](http://travis-ci.org/technekes/alchemy-api-rb)
4
4
  [![Code Climate](https://codeclimate.com/github/technekes/alchemy-api-rb.png)](https://codeclimate.com/github/technekes/alchemy-api-rb)
5
5
  [![Coverage Status](https://img.shields.io/coveralls/technekes/alchemy-api-rb.svg)](https://coveralls.io/r/technekes/alchemy-api-rb)
6
- [![Dependency Status](https://gemnasium.com/connexio-labs/omniauth-connexio.png)](https://gemnasium.com/connexio-labs/omniauth-connexio)
6
+ [![Dependency Status](https://gemnasium.com/badges/github.com/technekes/alchemy-api-rb.svg)](https://gemnasium.com/github.com/technekes/alchemy-api-rb)
7
7
  [![Gem Version](https://badge.fury.io/rb/alchemy-api-rb.png)](http://badge.fury.io/rb/alchemy-api-rb)
8
8
 
9
9
  This is a Ruby Client Library that provides access to the [Alchemy text mining API](http://www.alchemyapi.com/). The current version targets the following API's:
@@ -11,8 +11,10 @@ This is a Ruby Client Library that provides access to the [Alchemy text mining A
11
11
  * Author Extraction
12
12
  * Combined Call
13
13
  * Concept Tagging
14
+ * Emotion Analysis
14
15
  * Entity Extraction
15
16
  * Face Detection/Recognition
17
+ * Image Scene Text Extraction
16
18
  * Image Tagging
17
19
  * Keyword Extraction
18
20
  * Language Detection
@@ -107,8 +109,7 @@ If you would like to expirement with the API you can run the `console` rake task
107
109
  ## TODO
108
110
 
109
111
  1. Add missing Alchmey API search modes
110
- 2. Add the ability to search all supported API's in a single request?
111
- 3. Add support for raw output (JSON, XML and RDF)?
112
+ 1. Add support for raw output (JSON, XML and RDF)?
112
113
 
113
114
  ## Contributing
114
115
 
data/Rakefile CHANGED
@@ -1,11 +1,10 @@
1
- #!/usr/bin/env rake
2
1
  require 'bundler/gem_tasks'
3
2
  require 'rake/testtask'
4
3
  require 'rubocop/rake_task'
5
4
 
6
5
  RuboCop::RakeTask.new(:rubocop)
7
6
 
8
- task default: [:rubocop, :test]
7
+ task default: %i(rubocop test)
9
8
 
10
9
  Rake::TestTask.new do |t|
11
10
  t.libs.push 'lib'
@@ -16,6 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = AlchemyAPI::VERSION
18
18
 
19
+ gem.required_ruby_version = '>= 2.2.9'
20
+
19
21
  gem.add_dependency 'faraday', '~> 0.9.0'
20
22
  gem.add_dependency 'excon', '~> 0.28'
21
23
 
@@ -24,7 +26,7 @@ Gem::Specification.new do |gem|
24
26
  gem.add_development_dependency 'rake', '~> 10.3.0'
25
27
  gem.add_development_dependency 'minitest-reporters', '~> 1.0.0'
26
28
  gem.add_development_dependency 'vcr', '~> 2.9.2'
27
- gem.add_development_dependency 'webmock', '~> 1.19.0'
29
+ gem.add_development_dependency 'webmock', '~> 3.3.0'
28
30
  gem.add_development_dependency 'coveralls', '~> 0.7.0'
29
- gem.add_development_dependency 'rubocop', '~> 0.25.0'
31
+ gem.add_development_dependency 'rubocop', '~> 0.52.1'
30
32
  end
@@ -9,7 +9,7 @@ module AlchemyAPI
9
9
  private
10
10
 
11
11
  def supported_search_types
12
- [:html, :url]
12
+ %i(html url)
13
13
  end
14
14
 
15
15
  def indexer
@@ -19,9 +19,8 @@ module AlchemyAPI
19
19
  when :json
20
20
  parsed = JSON.parse(@response.body)
21
21
  indexer ? parsed[indexer] : parsed
22
- when :xml
23
- when :rdf
24
- fail NotImplementedError
22
+ when :rdf, :xml
23
+ raise NotImplementedError
25
24
  end
26
25
  end
27
26
 
@@ -34,8 +33,8 @@ module AlchemyAPI
34
33
  def check_options(opts)
35
34
  @options = opts
36
35
 
37
- fail MissingOptionsError unless options && options.keys
38
- fail UnsupportedSearchMode unless supported_search_types.include?(mode)
36
+ raise MissingOptionsError unless options && options.keys
37
+ raise UnsupportedSearchMode unless supported_search_types.include?(mode)
39
38
  end
40
39
 
41
40
  def connection
@@ -46,15 +45,15 @@ module AlchemyAPI
46
45
  end
47
46
 
48
47
  def supported_search_types
49
- [:text, :url, :html]
48
+ %i(text url html)
50
49
  end
51
50
 
52
51
  def mode
53
- [:text, :url, :html].each do |type|
52
+ %i(text url html).each do |type|
54
53
  return type if options.keys && options.keys.include?(type)
55
54
  end
56
55
 
57
- fail MissingOptionsError
56
+ raise MissingOptionsError
58
57
  end
59
58
 
60
59
  def method_prefix
@@ -6,7 +6,7 @@ module AlchemyAPI
6
6
  end
7
7
 
8
8
  def self.add_mode(key, klass)
9
- @modes = {} unless @modes
9
+ @modes ||= {}
10
10
 
11
11
  @modes[key] = klass
12
12
  end
@@ -22,7 +22,7 @@ module AlchemyAPI
22
22
  end
23
23
 
24
24
  def self.output_mode=(value)
25
- fail InvalidOutputMode unless valid_output_modes.include?(value.to_s)
25
+ raise InvalidOutputMode unless valid_output_modes.include?(value.to_s)
26
26
 
27
27
  @output_mode = value
28
28
  end
@@ -0,0 +1,15 @@
1
+ module AlchemyAPI
2
+ class EmotionAnalysis < Base
3
+ Config.add_mode :emotion_analysis, self
4
+
5
+ def web_method
6
+ "#{method_prefix}GetEmotion"
7
+ end
8
+
9
+ private
10
+
11
+ def indexer
12
+ 'docEmotions'
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module AlchemyAPI
2
+ class ImageSceneText < Base
3
+ Config.add_mode :image_scene_text, self
4
+
5
+ def web_method
6
+ "#{method_prefix}GetRankedImageSceneText"
7
+ end
8
+
9
+ private
10
+
11
+ def supported_search_types
12
+ [:url]
13
+ end
14
+
15
+ def indexer
16
+ 'sceneTextLines'
17
+ end
18
+ end
19
+ end
@@ -10,7 +10,7 @@ module AlchemyAPI
10
10
 
11
11
  def supported_search_types
12
12
  # TODO: fix html
13
- [:text, :url]
13
+ %i(text url)
14
14
  end
15
15
 
16
16
  def indexer
@@ -9,7 +9,7 @@ module AlchemyAPI
9
9
  private
10
10
 
11
11
  def supported_search_types
12
- [:url, :html]
12
+ %i(url html)
13
13
  end
14
14
 
15
15
  def indexer
@@ -9,7 +9,7 @@ module AlchemyAPI
9
9
  private
10
10
 
11
11
  def supported_search_types
12
- [:url, :html]
12
+ %i(url html)
13
13
  end
14
14
 
15
15
  def indexer
@@ -1,3 +1,3 @@
1
1
  module AlchemyAPI
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'.freeze
3
3
  end
@@ -16,9 +16,11 @@ require 'alchemy-api/author_extraction'
16
16
  require 'alchemy-api/taxonomy'
17
17
  require 'alchemy-api/image_tagging'
18
18
  require 'alchemy-api/combined_call'
19
+ require 'alchemy-api/emotion_analysis'
20
+ require 'alchemy-api/image_scene_text'
19
21
 
20
22
  module AlchemyAPI
21
- BASE_URL = 'https://access.alchemyapi.com/calls/'
23
+ BASE_URL = 'https://access.alchemyapi.com/calls/'.freeze
22
24
 
23
25
  def self.config
24
26
  Config
@@ -39,8 +41,8 @@ module AlchemyAPI
39
41
  def self.search(mode, opts)
40
42
  klass = Config.modes[mode]
41
43
 
42
- fail InvalidAPIKey unless Config.apikey
43
- fail InvalidSearchMode unless klass
44
+ raise InvalidAPIKey unless Config.apikey
45
+ raise InvalidSearchMode unless klass
44
46
 
45
47
  klass.new.search(opts)
46
48
  end
@@ -0,0 +1,47 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
+
3
+ describe AlchemyAPI, 'emotion_analysis' do
4
+ before do
5
+ AlchemyAPI::Config.apikey = API_KEY
6
+ end
7
+
8
+ subject { AlchemyAPI::EmotionAnalysis.new }
9
+
10
+ describe '#search' do
11
+ {
12
+ text: 'Google is a large company',
13
+ html: '<html><body>Google is a large company</body></html>',
14
+ url: 'http://www.alchemy.com'
15
+ }.each do |type, value|
16
+ [:json].each do |mode|
17
+ before do
18
+ AlchemyAPI::Config.output_mode = mode
19
+ end
20
+
21
+ describe "#{type} search with #{mode} results" do
22
+ it 'returns a hash of results' do
23
+ cassette_name = "emotion_analysis_call_basic_#{type}_#{mode}_search"
24
+ VCR.use_cassette(cassette_name) do
25
+ result = subject.search(type => value)
26
+
27
+ result.must_be_instance_of Hash
28
+ end
29
+ end
30
+
31
+ it 'includes the keyword docEmotions' do
32
+ cassette_name = "emotion_analysis_call_basic_#{type}_#{mode}_search"
33
+ VCR.use_cassette(cassette_name) do
34
+ result = subject.search(type => value)
35
+
36
+ result['anger'].wont_be_nil
37
+ result['disgust'].wont_be_nil
38
+ result['fear'].wont_be_nil
39
+ result['joy'].wont_be_nil
40
+ result['sadness'].wont_be_nil
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,45 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
+
3
+ describe AlchemyAPI, 'image_scene_text' do
4
+ before do
5
+ AlchemyAPI::Config.apikey = API_KEY
6
+ end
7
+
8
+ subject { AlchemyAPI::ImageSceneText.new }
9
+
10
+ describe '#search' do
11
+ {
12
+ url: 'https://www.scenicwonders.com/wp-content/uploads/2011/03/Yosemite-National-Park-sign-by-Acradenia.jpg'
13
+ }.each do |type, value|
14
+ [:json].each do |output_mode|
15
+ before do
16
+ AlchemyAPI::Config.output_mode = output_mode
17
+ end
18
+
19
+ describe "#{type} search with #{output_mode} results" do
20
+ it 'returns an array of results' do
21
+ cassette_name = 'image_scene_text_basic_'\
22
+ "#{type}_#{output_mode}_search"
23
+ VCR.use_cassette(cassette_name) do
24
+ result = subject.search(type => value)
25
+
26
+ result.must_be_instance_of Array
27
+ end
28
+ end
29
+
30
+ it 'includes the keyword text, words and confidence' do
31
+ cassette_name = 'image_scene_text_basic_'\
32
+ "#{type}_#{output_mode}_search"
33
+ VCR.use_cassette(cassette_name) do
34
+ result = subject.search(type => value)[0]
35
+
36
+ result['text'].wont_be_nil
37
+ result['words'].wont_be_nil
38
+ result['confidence'].wont_be_nil
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -4,10 +4,8 @@ require 'minitest/reporters'
4
4
  require 'webmock/minitest'
5
5
  require 'vcr'
6
6
  require 'pry'
7
- require 'codeclimate-test-reporter'
8
7
  require 'coveralls'
9
8
 
10
- CodeClimate::TestReporter.start
11
9
  Coveralls.wear!
12
10
  Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
13
11
 
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://access.alchemyapi.com/calls/html/HTMLGetEmotion
6
+ body:
7
+ encoding: UTF-8
8
+ string: apikey=ALCHEMY_KEY&html=%3Chtml%3E%3Cbody%3Efoo+bar%3C%2Fbody%3E%3C%2Fhtml%3E&outputMode=json
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ''
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Tue, 10 May 2016 08:36:48 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '449'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ X-Alchemyapi-Currentversion:
32
+ - '12.36'
33
+ X-Alchemyapi-Html-Content-Size:
34
+ - '33'
35
+ X-Alchemyapi-Key:
36
+ - ALCHEMY_KEY
37
+ X-Alchemyapi-Params:
38
+ - sentiment=0&knowledgeGraph=0&detectedLanguage=english&submitLanguage=detect
39
+ X-Alchemyapi-Status:
40
+ - OK
41
+ X-Alchemyapi-Text-Content-Size:
42
+ - '9'
43
+ X-Alchemyapi-Total-Emotion-Transactions:
44
+ - '1'
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ body:
48
+ encoding: UTF-8
49
+ string: "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
50
+ or using information generated by AlchemyAPI, you are agreeing to be bound
51
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
52
+ \ \"totalTransactions\": \"0\",\n \"language\": \"english\",\n \"docEmotions\":
53
+ {\n \"anger\": \"0.062204\",\n \"disgust\": \"0.199106\",\n
54
+ \ \"fear\": \"0.349846\",\n \"joy\": \"0.191003\",\n \"sadness\":
55
+ \"0.134205\"\n }\n}\r\n"
56
+ http_version:
57
+ recorded_at: Tue, 10 May 2016 08:36:48 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://access.alchemyapi.com/calls/text/TextGetEmotion
6
+ body:
7
+ encoding: UTF-8
8
+ string: apikey=ALCHEMY_KEY&outputMode=json&text=lorem+ipsum
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ''
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Tue, 10 May 2016 08:36:55 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '449'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ X-Alchemyapi-Currentversion:
32
+ - '12.37'
33
+ X-Alchemyapi-Key:
34
+ - ALCHEMY_KEY
35
+ X-Alchemyapi-Params:
36
+ - sentiment=0&knowledgeGraph=0&detectedLanguage=english&submitLanguage=detect
37
+ X-Alchemyapi-Status:
38
+ - OK
39
+ X-Alchemyapi-Text-Content-Size:
40
+ - '11'
41
+ X-Alchemyapi-Total-Emotion-Transactions:
42
+ - '1'
43
+ Access-Control-Allow-Origin:
44
+ - "*"
45
+ body:
46
+ encoding: UTF-8
47
+ string: "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
48
+ or using information generated by AlchemyAPI, you are agreeing to be bound
49
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
50
+ \ \"totalTransactions\": \"0\",\n \"language\": \"english\",\n \"docEmotions\":
51
+ {\n \"anger\": \"0.112686\",\n \"disgust\": \"0.186012\",\n
52
+ \ \"fear\": \"0.188489\",\n \"joy\": \"0.444334\",\n \"sadness\":
53
+ \"0.215615\"\n }\n}\r\n"
54
+ http_version:
55
+ recorded_at: Tue, 10 May 2016 08:36:55 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://access.alchemyapi.com/calls/url/URLGetEmotion
6
+ body:
7
+ encoding: UTF-8
8
+ string: apikey=ALCHEMY_KEY&outputMode=json&url=http%3A%2F%2Fwww.google.com
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ''
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Tue, 10 May 2016 08:36:53 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '485'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ X-Alchemyapi-Currentversion:
32
+ - '12.36'
33
+ X-Alchemyapi-Key:
34
+ - ALCHEMY_KEY
35
+ X-Alchemyapi-Params:
36
+ - sentiment=0&knowledgeGraph=0&detectedLanguage=english&submitLanguage=detect
37
+ X-Alchemyapi-Raw-Content-Size:
38
+ - '45721'
39
+ X-Alchemyapi-Requested-Url:
40
+ - http://www.google.com
41
+ X-Alchemyapi-Retrieved-Url:
42
+ - http://www.google.com/
43
+ X-Alchemyapi-Status:
44
+ - OK
45
+ X-Alchemyapi-Text-Content-Size:
46
+ - '435'
47
+ X-Alchemyapi-Total-Emotion-Transactions:
48
+ - '1'
49
+ Access-Control-Allow-Origin:
50
+ - "*"
51
+ body:
52
+ encoding: UTF-8
53
+ string: "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
54
+ or using information generated by AlchemyAPI, you are agreeing to be bound
55
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
56
+ \ \"url\": \"http://www.google.com/\",\n \"totalTransactions\": \"0\",\n
57
+ \ \"language\": \"english\",\n \"docEmotions\": {\n \"anger\":
58
+ \"0.031833\",\n \"disgust\": \"0.140543\",\n \"fear\": \"0.106253\",\n
59
+ \ \"joy\": \"0.50064\",\n \"sadness\": \"0.040764\"\n }\n}\r\n"
60
+ http_version:
61
+ recorded_at: Tue, 10 May 2016 08:36:53 GMT
62
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://access.alchemyapi.com/calls/url/URLGetRankedImageSceneText
6
+ body:
7
+ encoding: UTF-8
8
+ string: apikey=ALCHEMY_KEY&outputMode=json&url=https%3A%2F%2Fwww.scenicwonders.com%2Fwp-content%2Fuploads%2F2011%2F03%2FYosemite-National-Park-sign-by-Acradenia.jpg
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ''
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Tue, 10 May 2016 10:28:20 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Content-Length:
26
+ - '2780'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ X-Alchemyapi-Currentversion:
32
+ - '12.37'
33
+ X-Alchemyapi-Key:
34
+ - ALCHEMY_KEY
35
+ X-Alchemyapi-Params:
36
+ - sentiment=0&knowledgeGraph=0&detectedLanguage=unknown
37
+ X-Alchemyapi-Raw-Content-Size:
38
+ - '517691'
39
+ X-Alchemyapi-Requested-Url:
40
+ - https://www.scenicwonders.com/wp-content/uploads/2011/03/Yosemite-National-Park-sign-by-Acradenia.jpg
41
+ X-Alchemyapi-Retrieved-Url:
42
+ - https://www.scenicwonders.com/wp-content/uploads/2011/03/Yosemite-National-Park-sign-by-Acradenia.jpg
43
+ X-Alchemyapi-Status:
44
+ - OK
45
+ X-Alchemyapi-Total-Scene-Text-Transactions:
46
+ - '4'
47
+ Access-Control-Allow-Origin:
48
+ - "*"
49
+ body:
50
+ encoding: UTF-8
51
+ string: "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
52
+ or using information generated by AlchemyAPI, you are agreeing to be bound
53
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
54
+ \ \"url\": \"https://www.scenicwonders.com/wp-content/uploads/2011/03/Yosemite-National-Park-sign-by-Acradenia.jpg\",\n
55
+ \ \"totalTransactions\": \"0\",\n \"sceneText\": \"yosemite\\nnational\\npark\\nw\",\n
56
+ \ \"sceneTextLines\": [\n {\n \"confidence\": 0.990553,\n
57
+ \ \"region\": {\n \"height\": 60,\n \"width\":
58
+ 224,\n \"x\": 607,\n \"y\": 289\n },\n
59
+ \ \"text\": \"yosemite\",\n \"words\": [\n {\n
60
+ \ \"confidence\": 0.990553,\n \"region\":
61
+ {\n \"height\": 60,\n \"width\":
62
+ 224,\n \"x\": 607,\n \"y\":
63
+ 289\n },\n \"text\": \"yosemite\"\n
64
+ \ }\n ]\n },\n {\n \"confidence\":
65
+ 0.990283,\n \"region\": {\n \"height\": 61,\n \"width\":
66
+ 224,\n \"x\": 607,\n \"y\": 349\n },\n
67
+ \ \"text\": \"national\",\n \"words\": [\n {\n
68
+ \ \"confidence\": 0.990283,\n \"region\":
69
+ {\n \"height\": 61,\n \"width\":
70
+ 224,\n \"x\": 607,\n \"y\":
71
+ 349\n },\n \"text\": \"national\"\n
72
+ \ }\n ]\n },\n {\n \"confidence\":
73
+ 0.990963,\n \"region\": {\n \"height\": 50,\n \"width\":
74
+ 131,\n \"x\": 659,\n \"y\": 425\n },\n
75
+ \ \"text\": \"park\",\n \"words\": [\n {\n
76
+ \ \"confidence\": 0.990963,\n \"region\":
77
+ {\n \"height\": 50,\n \"width\":
78
+ 131,\n \"x\": 659,\n \"y\":
79
+ 425\n },\n \"text\": \"park\"\n }\n
80
+ \ ]\n },\n {\n \"confidence\": 0,\n \"region\":
81
+ {\n \"height\": 17,\n \"width\": 34,\n \"x\":
82
+ 326,\n \"y\": 8\n },\n \"text\": \"w\",\n
83
+ \ \"words\": [\n {\n \"confidence\":
84
+ 0.511145,\n \"region\": {\n \"height\":
85
+ 17,\n \"width\": 34,\n \"x\":
86
+ 326,\n \"y\": 8\n },\n \"text\":
87
+ \"w\"\n }\n ]\n }\n ]\n}\r\n"
88
+ http_version:
89
+ recorded_at: Tue, 10 May 2016 10:28:20 GMT
90
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-api-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.19.0
117
+ version: 3.3.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.19.0
124
+ version: 3.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: coveralls
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.25.0
145
+ version: 0.52.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.25.0
152
+ version: 0.52.1
153
153
  description: Provides access to the Alchemy text mining API - http://www.alchemyapi.com/
154
154
  email:
155
155
  - john.allen@technekes.com
@@ -174,8 +174,10 @@ files:
174
174
  - lib/alchemy-api/combined_call.rb
175
175
  - lib/alchemy-api/concept_tagging.rb
176
176
  - lib/alchemy-api/config.rb
177
+ - lib/alchemy-api/emotion_analysis.rb
177
178
  - lib/alchemy-api/entity_extraction.rb
178
179
  - lib/alchemy-api/face_detection.rb
180
+ - lib/alchemy-api/image_scene_text.rb
179
181
  - lib/alchemy-api/image_tagging.rb
180
182
  - lib/alchemy-api/keyword_extraction.rb
181
183
  - lib/alchemy-api/language_detection.rb
@@ -193,8 +195,10 @@ files:
193
195
  - spec/base_spec.rb
194
196
  - spec/combined_call_spec.rb
195
197
  - spec/concept_tagging_spec.rb
198
+ - spec/emotion_analysis_spec.rb
196
199
  - spec/entity_extraction_spec.rb
197
200
  - spec/face_detection_spec.rb
201
+ - spec/image_scene_text_spec.rb
198
202
  - spec/image_tagging_spec.rb
199
203
  - spec/keyword_extraction_spec.rb
200
204
  - spec/language_detection_spec.rb
@@ -214,10 +218,14 @@ files:
214
218
  - spec/vcr_cassettes/concept_basic_html_json_search.yml
215
219
  - spec/vcr_cassettes/concept_basic_text_json_search.yml
216
220
  - spec/vcr_cassettes/concept_basic_url_json_search.yml
221
+ - spec/vcr_cassettes/emotion_analysis_call_basic_html_json_search.yml
222
+ - spec/vcr_cassettes/emotion_analysis_call_basic_text_json_search.yml
223
+ - spec/vcr_cassettes/emotion_analysis_call_basic_url_json_search.yml
217
224
  - spec/vcr_cassettes/entity_basic_html_json_search.yml
218
225
  - spec/vcr_cassettes/entity_basic_text_json_search.yml
219
226
  - spec/vcr_cassettes/entity_basic_url_json_search.yml
220
227
  - spec/vcr_cassettes/face_detection_basic_url_json_search.yml
228
+ - spec/vcr_cassettes/image_scene_text_basic_url_json_search.yml
221
229
  - spec/vcr_cassettes/image_tagging_basic_url_json_search.yml
222
230
  - spec/vcr_cassettes/keyword_basic_html_json_search.yml
223
231
  - spec/vcr_cassettes/keyword_basic_text_json_search.yml
@@ -248,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
256
  requirements:
249
257
  - - ">="
250
258
  - !ruby/object:Gem::Version
251
- version: '0'
259
+ version: 2.2.9
252
260
  required_rubygems_version: !ruby/object:Gem::Requirement
253
261
  requirements:
254
262
  - - ">="
@@ -256,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
264
  version: '0'
257
265
  requirements: []
258
266
  rubyforge_project:
259
- rubygems_version: 2.6.3
267
+ rubygems_version: 2.7.4
260
268
  signing_key:
261
269
  specification_version: 4
262
270
  summary: This is a ruby client library that provides access to the Alechemy text mining
@@ -268,8 +276,10 @@ test_files:
268
276
  - spec/base_spec.rb
269
277
  - spec/combined_call_spec.rb
270
278
  - spec/concept_tagging_spec.rb
279
+ - spec/emotion_analysis_spec.rb
271
280
  - spec/entity_extraction_spec.rb
272
281
  - spec/face_detection_spec.rb
282
+ - spec/image_scene_text_spec.rb
273
283
  - spec/image_tagging_spec.rb
274
284
  - spec/keyword_extraction_spec.rb
275
285
  - spec/language_detection_spec.rb
@@ -289,10 +299,14 @@ test_files:
289
299
  - spec/vcr_cassettes/concept_basic_html_json_search.yml
290
300
  - spec/vcr_cassettes/concept_basic_text_json_search.yml
291
301
  - spec/vcr_cassettes/concept_basic_url_json_search.yml
302
+ - spec/vcr_cassettes/emotion_analysis_call_basic_html_json_search.yml
303
+ - spec/vcr_cassettes/emotion_analysis_call_basic_text_json_search.yml
304
+ - spec/vcr_cassettes/emotion_analysis_call_basic_url_json_search.yml
292
305
  - spec/vcr_cassettes/entity_basic_html_json_search.yml
293
306
  - spec/vcr_cassettes/entity_basic_text_json_search.yml
294
307
  - spec/vcr_cassettes/entity_basic_url_json_search.yml
295
308
  - spec/vcr_cassettes/face_detection_basic_url_json_search.yml
309
+ - spec/vcr_cassettes/image_scene_text_basic_url_json_search.yml
296
310
  - spec/vcr_cassettes/image_tagging_basic_url_json_search.yml
297
311
  - spec/vcr_cassettes/keyword_basic_html_json_search.yml
298
312
  - spec/vcr_cassettes/keyword_basic_text_json_search.yml