Sha256: 78191c80234cdcb740b90ce3bf85629914b42d41fcc2d9fbd13fca081b09f1c6

Contents?: true

Size: 604 Bytes

Versions: 2

Compression:

Stored size: 604 Bytes

Contents

require "calais"

module Jkl
  module Extraction
    class << self

      def calais_response(key, text)
        Calais.process_document(
            :content => text,
            :content_type => :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

2 entries across 2 versions & 1 rubygems

Version Path
jakal-0.1.3 lib/jkl/calais_client.rb
jakal-0.1.2 lib/jkl/calais_client.rb