Sha256: 7ba73232ac1a75d4209c4d1a81d11d4c08784929eb245a26fc67c6a18ba206fe

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 Bytes

Contents

require "calais"

module Jkl
  module Extraction
    class << self

      def calais_response(key, text)
        Calais.process_document(
            :content => text,
            :license_id => key
        )
      end

      def entities(key,text)
        calais_response(key, text).entities.map{|e| {e.type => [e.attributes["name"]]}}
      end

      def tags(key, text)
        nested_list = {}
        entities(key,text).each do |a| 
          nested_list = nested_list.merge!(a){ |key,v1,v2| v1+v2 }
        end
        nested_list
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jakal-0.2.0 lib/jkl/calais_client.rb
jakal-0.1.96 lib/jkl/calais_client.rb
jakal-0.1.95 lib/jkl/calais_client.rb
jakal-0.1.94 lib/jkl/calais_client.rb
jakal-0.1.93 lib/jkl/calais_client.rb
jakal-0.1.92 lib/jkl/calais_client.rb
jakal-0.1.91 lib/jkl/calais_client.rb
jakal-0.1.9 lib/jkl/calais_client.rb
jakal-0.1.8 lib/jkl/calais_client.rb
jakal-0.1.7 lib/jkl/calais_client.rb