Class: RTesseract::Box::BoxParser
- Inherits:
-
Object
- Object
- RTesseract::Box::BoxParser
- Defined in:
- lib/rtesseract/box.rb
Overview
Parse word data from html.
Instance Method Summary collapse
-
#initialize(word_html) ⇒ BoxParser
constructor
A new instance of BoxParser.
- #to_h ⇒ Object
Constructor Details
#initialize(word_html) ⇒ BoxParser
Returns a new instance of BoxParser.
53 54 55 56 57 |
# File 'lib/rtesseract/box.rb', line 53 def initialize(word_html) @word = word_html title = @word.attributes['title'].value.to_s @attributes = title.gsub(';', '').split(' ') end |
Instance Method Details
#to_h ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/rtesseract/box.rb', line 59 def to_h { word: @word.text, x_start: @attributes[1].to_i, y_start: @attributes[2].to_i, x_end: @attributes[3].to_i, y_end: @attributes[4].to_i } end |