indico 0.5.2 → 0.5.3
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 +4 -4
 - data/README.md +5 -5
 - data/lib/indico/image.rb +3 -0
 - data/lib/indico/version.rb +1 -1
 - data/spec/indico_spec.rb +7 -8
 - metadata +17 -17
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 12321afac104c51a250901849e6d497bb2ebaf36
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0c7eb47b1ff1aead6d87a79291d50d641095d165
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1cc6667c5a7c9fcff695037c00c3352debf9390fef7be5402ff77c977bb80006ceefb96203ed78b0d851a8af25ba7b15f5a244c40fb7512486a63e3bdb7b891c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3c248d2a456984c1ca6c1f368320c1f52cd2387af92f8b759f43683d0cfcdf629abfa84341ee3ac675b2627a3f22e0702ee822ea3eee109a85db50d2a7d1ef6e
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -80,7 +80,7 @@ Each `Indico` method has a corresponding batch method for analyzing many example 
     | 
|
| 
       80 
80 
     | 
    
         | 
| 
       81 
81 
     | 
    
         
             
            Calling multiple APIs with a single function
         
     | 
| 
       82 
82 
     | 
    
         
             
            ---------
         
     | 
| 
       83 
     | 
    
         
            -
            There are two multiple API functions ` 
     | 
| 
      
 83 
     | 
    
         
            +
            There are two multiple API functions `analyze_text` and `analyze_image` (and their batch counterparts). These functions are similar to the existing api functions, but take in an additional `apis` argument as an array of strings of API names (defaults to all existing apis). `analyze_text` accepts a list of existing text APIs and vice versa for `analyze_image`.
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
85 
     | 
    
         
             
            Accepted text API names: `text_tags, political, sentiment, language`
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
         @@ -95,11 +95,11 @@ Accepted image API names: `fer, facial_features, image_features` 
     | 
|
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
            => "YOUR_API_KEY"
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
            > Indico. 
     | 
| 
      
 98 
     | 
    
         
            +
            > Indico.analyze_text("Best day ever", ["sentiment", "language"])
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
100 
     | 
    
         
             
            => {"sentiment"=>0.9899001220871786, "language"=>{"Swedish"=>0.0022464881013042294, "Vietnamese"=>9.887170914498351e-05, ...}}
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
            > Indico. 
     | 
| 
      
 102 
     | 
    
         
            +
            > Indico.analyze_text(["Best day ever", "Worst day ever"], ["sentiment", "language"])
         
     | 
| 
       103 
103 
     | 
    
         | 
| 
       104 
104 
     | 
    
         
             
            => {"sentiment"=>[0.9899001220871786, 0.005709885173415242], "language"=>[{"Swedish"=>0.0022464881013042294, "Vietnamese"=>9.887170914498351e-05, "Romanian"=>0.00010661175919993216, ...}, {"Swedish"=>0.4924352805804646, "Vietnamese"=>0.028574824174911372, "Romanian"=>0.004185623723173551, "Dutch"=>0.000717033819689362, "Korean"=>0.0030093489153785826, ...}]}
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
         @@ -107,11 +107,11 @@ Accepted image API names: `fer, facial_features, image_features` 
     | 
|
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
            => [[[0.66, 0.99, 0.03], [0.42, 0.72, 0.86], [0.95, 0.44, 0.61], [0.39, 0.57, 0.4], [0.06, 0.52, 0.43], [0.11, 0.09, 0.78], [0.35, 0.69, 0.32], [0.44, 0.5, 0.26], [0.71, 0.75, 0.64], [0.91, 0.92, 0.14], [0.71, 0.98, 0.02], ..]]
         
     | 
| 
       109 
109 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
            > Indico. 
     | 
| 
      
 110 
     | 
    
         
            +
            > Indico.analyze_image(test_face, ["fer", "facial_features"])
         
     | 
| 
       111 
111 
     | 
    
         | 
| 
       112 
112 
     | 
    
         
             
            => {"facial_features"=>[0.0, -0.026176479280200796, 0.20707644777495776, ...], "fer"=>{"Angry"=>0.08877494466353497, "Sad"=>0.3933999409104264, "Neutral"=>0.1910612654566151, "Surprise"=>0.0346146405941845, "Fear"=>0.17682159820518667, "Happy"=>0.11532761017005204}}
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
            > Indico. 
     | 
| 
      
 114 
     | 
    
         
            +
            > Indico.analyze_image([test_face, test_face], ["fer", "facial_features"])
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
       116 
116 
     | 
    
         
             
            => {"facial_features"=>[[0.0, -0.026176479280200796, 0.20707644777495776, ...], [0.0, -0.026176479280200796, 0.20707644777495776, ...]], "fer"=>[{"Angry"=>0.08877494466353497, "Sad"=>0.3933999409104264, "Neutral"=>0.1910612654566151, "Surprise"=>0.0346146405941845, "Fear"=>0.17682159820518667, "Happy"=>0.11532761017005204}, {"Angry"=>0.08877494466353497, "Sad"=>0.3933999409104264, "Neutral"=>0.1910612654566151, "Surprise"=>0.0346146405941845, "Fear"=>0.17682159820518667, "Happy"=>0.11532761017005204}]}
         
     | 
| 
       117 
117 
     | 
    
         
             
            ```
         
     | 
    
        data/lib/indico/image.rb
    CHANGED
    
    | 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'oily_png'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'base64'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'uri'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            module Indico
         
     | 
| 
       5 
6 
     | 
    
         
             
                def self.preprocess(image, size, min_axis)
         
     | 
| 
         @@ -52,6 +53,8 @@ module Indico 
     | 
|
| 
       52 
53 
     | 
    
         
             
                                image = Base64.encode64(file.read)
         
     | 
| 
       53 
54 
     | 
    
         
             
                            end
         
     | 
| 
       54 
55 
     | 
    
         
             
                        end
         
     | 
| 
      
 56 
     | 
    
         
            +
                    elsif str =~ /\A#{URI::regexp}\z/
         
     | 
| 
      
 57 
     | 
    
         
            +
                        image = str
         
     | 
| 
       55 
58 
     | 
    
         
             
                    else
         
     | 
| 
       56 
59 
     | 
    
         
             
                        begin
         
     | 
| 
       57 
60 
     | 
    
         
             
                            image = ChunkyPNG::Image.from_data_url("data:image/png;base64," + str.gsub("data:image/png;base64," ,""))
         
     | 
    
        data/lib/indico/version.rb
    CHANGED
    
    
    
        data/spec/indico_spec.rb
    CHANGED
    
    | 
         @@ -278,12 +278,11 @@ describe Indico do 
     | 
|
| 
       278 
278 
     | 
    
         
             
                expect(Set.new(response.keys)).to eql(Set.new(['sentiment']))
         
     | 
| 
       279 
279 
     | 
    
         
             
              end
         
     | 
| 
       280 
280 
     | 
    
         | 
| 
       281 
     | 
    
         
            -
               
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
               
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
               
     | 
| 
       288 
     | 
    
         
            -
              # end
         
     | 
| 
      
 281 
     | 
    
         
            +
              it 'should accept image urls' do
         
     | 
| 
      
 282 
     | 
    
         
            +
                response = Indico.image_features('http://icons.iconarchive.com/icons/' +
         
     | 
| 
      
 283 
     | 
    
         
            +
                                                 'oxygen-icons.org/oxygen/48/' +
         
     | 
| 
      
 284 
     | 
    
         
            +
                                                 'Emotes-face-smile-icon.png')
         
     | 
| 
      
 285 
     | 
    
         
            +
              
         
     | 
| 
      
 286 
     | 
    
         
            +
                expect(response.length).to eql(2048)
         
     | 
| 
      
 287 
     | 
    
         
            +
              end
         
     | 
| 
       289 
288 
     | 
    
         
             
            end
         
     | 
    
        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.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Slater Victoroff
         
     | 
| 
         @@ -11,76 +11,76 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2015-10-15 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: inifile
         
     | 
| 
       18 
18 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       19 
19 
     | 
    
         
             
                requirements:
         
     | 
| 
       20 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 20 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       21 
21 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
22 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
       23 
23 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       24 
24 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
25 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       26 
26 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       28 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
29 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
       30 
30 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
31 
     | 
    
         
             
              name: oily_png
         
     | 
| 
       32 
32 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
33 
     | 
    
         
             
                requirements:
         
     | 
| 
       34 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 34 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       35 
35 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       36 
36 
     | 
    
         
             
                    version: 1.2.0
         
     | 
| 
       37 
37 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       38 
38 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       39 
39 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 41 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       42 
42 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       43 
43 
     | 
    
         
             
                    version: 1.2.0
         
     | 
| 
       44 
44 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       45 
45 
     | 
    
         
             
              name: bundler
         
     | 
| 
       46 
46 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       47 
47 
     | 
    
         
             
                requirements:
         
     | 
| 
       48 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 48 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       49 
49 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       50 
50 
     | 
    
         
             
                    version: '1.6'
         
     | 
| 
       51 
51 
     | 
    
         
             
              type: :development
         
     | 
| 
       52 
52 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       53 
53 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       54 
54 
     | 
    
         
             
                requirements:
         
     | 
| 
       55 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 55 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       56 
56 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       57 
57 
     | 
    
         
             
                    version: '1.6'
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: rake
         
     | 
| 
       60 
60 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                requirements:
         
     | 
| 
       62 
     | 
    
         
            -
                - -  
     | 
| 
      
 62 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       63 
63 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       64 
64 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       65 
65 
     | 
    
         
             
              type: :development
         
     | 
| 
       66 
66 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       67 
67 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       68 
68 
     | 
    
         
             
                requirements:
         
     | 
| 
       69 
     | 
    
         
            -
                - -  
     | 
| 
      
 69 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       70 
70 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       71 
71 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       72 
72 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       73 
73 
     | 
    
         
             
              name: rspec
         
     | 
| 
       74 
74 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       75 
75 
     | 
    
         
             
                requirements:
         
     | 
| 
       76 
     | 
    
         
            -
                - -  
     | 
| 
      
 76 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       77 
77 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       78 
78 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       79 
79 
     | 
    
         
             
              type: :development
         
     | 
| 
       80 
80 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       81 
81 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       82 
82 
     | 
    
         
             
                requirements:
         
     | 
| 
       83 
     | 
    
         
            -
                - -  
     | 
| 
      
 83 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       84 
84 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       85 
85 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       86 
86 
     | 
    
         
             
            description: A simple Ruby Wrapper for the indico set of APIs.
         
     | 
| 
         @@ -93,8 +93,8 @@ executables: [] 
     | 
|
| 
       93 
93 
     | 
    
         
             
            extensions: []
         
     | 
| 
       94 
94 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       95 
95 
     | 
    
         
             
            files:
         
     | 
| 
       96 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
       97 
     | 
    
         
            -
            - .rspec
         
     | 
| 
      
 96 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 97 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
       98 
98 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       99 
99 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       100 
100 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -128,17 +128,17 @@ require_paths: 
     | 
|
| 
       128 
128 
     | 
    
         
             
            - lib
         
     | 
| 
       129 
129 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       130 
130 
     | 
    
         
             
              requirements:
         
     | 
| 
       131 
     | 
    
         
            -
              - -  
     | 
| 
      
 131 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       132 
132 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       133 
133 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       134 
134 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       135 
135 
     | 
    
         
             
              requirements:
         
     | 
| 
       136 
     | 
    
         
            -
              - -  
     | 
| 
      
 136 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       137 
137 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       138 
138 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       139 
139 
     | 
    
         
             
            requirements: []
         
     | 
| 
       140 
140 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       141 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 141 
     | 
    
         
            +
            rubygems_version: 2.4.6
         
     | 
| 
       142 
142 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       143 
143 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       144 
144 
     | 
    
         
             
            summary: A simple Ruby Wrapper for the indico set of APIs.
         
     |