Class: Google::Cloud::Vision::Annotation::Text::Page::Language

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

Overview

Language

A language within a detected text (OCR). See Google::Cloud::Vision::Annotation::Text#pages.

Examples:

require "google/cloud/vision"

vision = Google::Cloud::Vision.new

image = vision.image "path/to/text.png"
text = image.text
page = text.pages.first

language = page.languages.first
language.code #=> "en"

Instance Method Summary collapse

Instance Method Details

#codeString

The language code detected for a structural component.

Returns:



956
957
958
# File 'lib/google/cloud/vision/annotation/text.rb', line 956

def code
  @grpc.language_code
end

#confidenceFloat

Confidence of detected language.

Returns:

  • (Float)

    A value in the range [0,1].



965
966
967
# File 'lib/google/cloud/vision/annotation/text.rb', line 965

def confidence
  @grpc.confidence
end

#to_hHash

Deeply converts object to a hash. All keys will be symbolized.

Returns:

  • (Hash)


974
975
976
# File 'lib/google/cloud/vision/annotation/text.rb', line 974

def to_h
  { code: code, confidence: confidence }
end