Sha256: b3b357375803d12e0a40ef489ab8325d47bcb388e47feda1a7b94142ebbabdb5
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require "cgi" require "jkl/rest_client.rb" require "jkl/rss_client.rb" require "jkl/calais_client.rb" require "jkl/url_doc_handler.rb" module Jkl class << self def headlines(feed, keyphrase) get_from_as_xml "#{feed}#{keyphrase}" end def pages(headlines) items = get_items_from headlines descriptions = "" items.each do |item| descriptions << attribute_from(item, :description).gsub("<![CDATA[","").gsub("]]>","") end descriptions end def descriptions(headlines) items = get_items_from headlines descriptions = [] items.each do |item| descriptions << attribute_from(item, :description).gsub("<![CDATA[","").gsub("]]>","") end descriptions end def links(headlines) items = get_items_from headlines links = [] items.each do |item| links << attribute_from(item, :link) end links 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jakal-0.1.0 | lib/jkl.rb |