Class: Google::Cloud::Vision::Annotation::Text::Page
- Inherits:
 - 
      Object
      
        
- Object
 - Google::Cloud::Vision::Annotation::Text::Page
 
 
- Defined in:
 - lib/google/cloud/vision/annotation/text.rb
 
Overview
Page
A page within a detected text (OCR). See #pages.
Defined Under Namespace
Classes: Block, Language, Paragraph, Symbol, Word
Instance Method Summary collapse
- 
  
    
      #blocks  ⇒ Array<Block> 
    
    
  
  
  
  
  
  
  
  
  
    
List of blocks of text, images etc on this page.
 - 
  
    
      #break_type  ⇒ ::Symbol 
    
    
  
  
  
  
  
  
  
  
  
    
The type of a detected break at the start or end of the page.
 - 
  
    
      #height  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Page height in pixels.
 - 
  
    
      #languages  ⇒ Array<Language> 
    
    
  
  
  
  
  
  
  
  
  
    
A list of detected languages together with confidence.
 - 
  
    
      #prefix_break?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
True if a detected break prepends the page.
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Deeply converts object to a hash.
 - 
  
    
      #width  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Page width in pixels.
 
Instance Method Details
#blocks ⇒ Array<Block>
List of blocks of text, images etc on this page.
      341 342 343 344 345  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 341 def blocks @blocks ||= Array(@grpc.blocks).map do |b| Block.from_grpc b end end  | 
  
#break_type ⇒ ::Symbol
The type of a detected break at the start or end of the page.
      303 304 305 306  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 303 def break_type @grpc.property.detected_break && @grpc.property.detected_break.type.to_sym end  | 
  
#height ⇒ Integer
Page height in pixels.
      332 333 334  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 332 def height @grpc.height end  | 
  
#languages ⇒ Array<Language>
A list of detected languages together with confidence.
      292 293 294 295 296  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 292 def languages @languages ||= Array(@grpc.property.detected_languages).map do |l| Language.from_grpc l end end  | 
  
#prefix_break? ⇒ Boolean
True if a detected break prepends the page.
      313 314 315 316  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 313 def prefix_break? @grpc.property.detected_break && @grpc.property.detected_break.is_prefix end  | 
  
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
      352 353 354 355 356  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 352 def to_h { languages: languages.map(&:to_h), break_type: break_type, prefix_break: prefix_break?, width: width, height: height, blocks: blocks.map(&:to_h) } end  | 
  
#width ⇒ Integer
Page width in pixels.
      323 324 325  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 323 def width @grpc.width end  |