Module: SemanticExtraction::Yahoo

Includes:
UtilityMethods
Defined in:
lib/semantic_extraction/extractors/yahoo.rb

Constant Summary collapse

STARTER =
"http://api.search.yahoo.com/ContentAnalysisService/V1/termExtraction"

Class Method Summary collapse

Methods included from UtilityMethods

included

Class Method Details

.find_keywords(text) ⇒ Object



6
7
8
9
10
# File 'lib/semantic_extraction/extractors/yahoo.rb', line 6

def self.find_keywords(text)
  prefix = 'context'
  raw = SemanticExtraction.post(STARTER, text, prefix, :appid)
  self.output_keywords(raw)
end

.output_keywords(raw) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/semantic_extraction/extractors/yahoo.rb', line 12

def self.output_keywords(raw)
  h = Nokogiri::XML(raw)
  keywords = []
  (h/"Result").each do |p|
    keywords << p.text
  end
  return keywords
end