Class: OCRWord
- Inherits:
-
OCRElement
- Object
- HOCRBox
- OCRElement
- OCRWord
- 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
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, #top_distance_to
Constructor Details
This class inherits a constructor from OCRElement
Instance Method Details
#text ⇒ Object
117 118 119 |
# File 'lib/ocr_element.rb', line 117 def text children.flatten[0] end |
#to_html ⇒ Object
131 132 133 |
# File 'lib/ocr_element.rb', line 131 def to_html "<span class='#{ css_class_string }'>#{ text }</span>" end |
#to_image_html(options = {}) ⇒ Object
125 126 127 128 129 |
# File 'lib/ocr_element.rb', line 125 def to_image_html( = {}) zoom = [:zoom] || 1 display_class = [:css_class] || css_class_string "<span class='#{ css_class_string}' style='#{ to_css_style(zoom) }'>#{ text }</span>" end |
#to_s ⇒ Object
121 122 123 |
# File 'lib/ocr_element.rb', line 121 def to_s "#{text}:#{coordinates}->#{@features}" end |