Class: Google::Cloud::Vision::Annotation::Web::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/vision/annotation/web.rb

Overview

Page

Metadata for web pages.

See Google::Cloud::Vision::Annotation::Web.

Examples:

require "google/cloud/vision"

vision = Google::Cloud::Vision.new

image = vision.image "path/to/landmark.jpg"

web = image.web

page_with_matching_images = web.pages_with_matching_images.first
page_with_matching_images.url #=> "http://example.com/posts/123"
page_with_matching_images.score #=> 8.114753723144531

Instance Method Summary collapse

Instance Method Details

#scoreFloat

Overall relevancy score for the web page. Not normalized and not comparable across different image queries.

Returns:

  • (Float)


377
378
379
# File 'lib/google/cloud/vision/annotation/web.rb', line 377

def score
  @grpc.score
end

#to_aArray

Returns the object's property values as an array.

Returns:

  • (Array)


386
387
388
# File 'lib/google/cloud/vision/annotation/web.rb', line 386

def to_a
  [url, score]
end

#to_hHash

Converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


395
396
397
# File 'lib/google/cloud/vision/annotation/web.rb', line 395

def to_h
  { url: url, score: score }
end

#urlString

The result web page URL.

Returns:

  • (String)


367
368
369
# File 'lib/google/cloud/vision/annotation/web.rb', line 367

def url
  @grpc.url
end