Class: OCRLine
- Inherits:
-
OCRElement
- Object
- HOCRBox
- OCRElement
- OCRLine
- Defined in:
- lib/ocr_element.rb
Instance Attribute Summary
Attributes inherited from OCRElement
#children, #features, #ocr_class
Attributes inherited from HOCRBox
#bottom, #coordinates, #height, #left, #right, #top, #width
Instance Method Summary collapse
Methods inherited from OCRElement
create, create_from_html, #css_class_string, #each, extract_children, extract_coordinates, extract_coordinates_from_string, extract_ocr_class, extract_word_children, #features_to_css_class, #initialize, #mark_in_rspec, #to_html, #to_image_html
Methods inherited from HOCRBox
#bottom_distance_to, #coordinates_to_s, #enclosed_by?, #encloses?, #initialize, #left_distance_to, #left_of?, #right_distance_to, #right_of?, #to_css_style, #to_image_html, #top_distance_to
Constructor Details
This class inherits a constructor from OCRElement
Instance Method Details
#simple_line ⇒ Object
145 146 147 148 149 |
# File 'lib/ocr_element.rb', line 145 def simple_line "#{self.class} #{coordinates_to_s} ->[\n" + words.map {|w| w.to_s}.join("\n") + "]" end |
#to_s ⇒ Object
139 140 141 142 143 |
# File 'lib/ocr_element.rb', line 139 def to_s "#{self.class} #{coordinates_to_s} ->[\n" + words.map {|w| "#{w.coordinates_to_s}\t#{w.to_s}"}.join("\n") + "]" end |
#to_text ⇒ Object
151 152 153 |
# File 'lib/ocr_element.rb', line 151 def to_text words.map { |w| w.text }.join(" ") end |