Class: AlchemyApi::TermExtraction

Inherits:
Base
  • Object
show all
Defined in:
lib/alchemy_api/term_extraction.rb

Class Method Summary collapse

Methods inherited from Base

check_json_for_errors_and_raise!, get_json

Class Method Details

.get_ranked_keywords_handler(response) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/alchemy_api/term_extraction.rb', line 47

def self.get_ranked_keywords_handler(response)
  json = get_json(response)
  keywords = json['keywords'].map do |kw|
    Keyword.new(kw['text'], kw['relevance'].to_f)
  end
  TermExtractionResult.new(keywords, json['language'],
                           json['url'], json['text'])
end