Class: AlchemyApi::ConceptTagging

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

Class Method Summary collapse

Methods inherited from Base

check_json_for_errors_and_raise!, get_json

Class Method Details

.get_concepts_handler(response) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/alchemy_api/concept_tagging.rb', line 52

def self.get_concepts_handler(response)
  json = get_json(response)
  concepts = json['concepts'].map do |c|
    Concept.new(c['text'], c['relevance'].to_f)
  end
  ConceptTaggingResult.new(concepts, json['language'], json['url'], json['text'])
end