class CognitiveVision::ImageFeature::Description

Public Instance Methods

key() click to toggle source
# File lib/cognitive_vision/image_feature/description.rb, line 4
def key
  'description'
end
parse(response) click to toggle source
# File lib/cognitive_vision/image_feature/description.rb, line 8
def parse(response)
  description_response = response[key]
  captions = description_response['captions'].map do |caption|
    CognitiveVision::DescriptionCaption.new(text: caption['text'], confidence: caption['confidence'])
  end
  CognitiveVision::Description.new(tags: description_response['tags'], captions: captions)
end