Sha256: 8102f31fdabd3107a4128fc0e1bae4b84302edce8d2e02ddcb82e6eccfdd06fd

Contents?: true

Size: 567 Bytes

Versions: 3

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 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

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

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jakal-0.1.6 lib/jkl/calais_client.rb
jakal-0.1.5 lib/jkl/calais_client.rb
jakal-0.1.4 lib/jkl/calais_client.rb