Class: Google::Cloud::Vision::Annotation::Text::Word
- Inherits:
 - 
      Object
      
        
- Object
 - Google::Cloud::Vision::Annotation::Text::Word
 
 
- Defined in:
 - lib/google/cloud/vision/annotation/text.rb
 
Overview
Word
A word within a detected text (OCR). See #words.
Instance Method Summary collapse
- 
  
    
      #bounds  ⇒ Array<Vertex> 
    
    
  
  
  
  
  
  
  
  
  
    
The bounds of the word within the detected text.
 - 
  
    
      #text  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
The text of the word.
 - 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Deeply converts object to a hash.
 
Instance Method Details
#bounds ⇒ Array<Vertex>
The bounds of the word within the detected text.
      215 216 217 218 219 220  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 215 def bounds return [] unless @grpc.bounding_poly @bounds ||= Array(@grpc.bounding_poly.vertices).map do |v| Vertex.from_grpc v end end  | 
  
#text ⇒ String
The text of the word.
      206 207 208  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 206 def text @grpc.description end  | 
  
#to_h ⇒ Hash
Deeply converts object to a hash. All keys will be symbolized.
      227 228 229  | 
    
      # File 'lib/google/cloud/vision/annotation/text.rb', line 227 def to_h { text: text, bounds: bounds.map(&:to_h) } end  |