Class: Mathpix::Result::Word
- Inherits:
-
Object
- Object
- Mathpix::Result::Word
- Defined in:
- lib/mathpix/result.rb
Overview
Word data structure for fine-grained bounding boxes
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#bbox ⇒ Array<Integer>?
Word bounding box.
-
#confidence ⇒ Float
Word confidence.
-
#initialize(data) ⇒ Word
constructor
A new instance of Word.
-
#inspect ⇒ String
Inspect.
-
#text ⇒ String
Word text.
-
#to_h ⇒ Hash
Convert to hash.
Constructor Details
#initialize(data) ⇒ Word
Returns a new instance of Word.
254 255 256 |
# File 'lib/mathpix/result.rb', line 254 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
252 253 254 |
# File 'lib/mathpix/result.rb', line 252 def data @data end |
Instance Method Details
#bbox ⇒ Array<Integer>?
Word bounding box
272 273 274 |
# File 'lib/mathpix/result.rb', line 272 def bbox data['bbox'] end |
#confidence ⇒ Float
Word confidence
266 267 268 |
# File 'lib/mathpix/result.rb', line 266 def confidence data['confidence'] || 0.0 end |
#inspect ⇒ String
Inspect
284 285 286 |
# File 'lib/mathpix/result.rb', line 284 def inspect "#<Mathpix::Result::Word text=\"#{text}\" confidence=#{confidence}>" end |
#text ⇒ String
Word text
260 261 262 |
# File 'lib/mathpix/result.rb', line 260 def text data['text'] || '' end |
#to_h ⇒ Hash
Convert to hash
278 279 280 |
# File 'lib/mathpix/result.rb', line 278 def to_h data end |