class AmazonTRP::Line

Attributes

block[R]
confidence[R]
geometry[R]
id[R]
text[R]
words[R]

Public Class Methods

new(block, blockMap) click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 99
def initialize(block, blockMap)
  @block = block
  @confidence = block[:confidence]
  @geometry = Geometry.new(block[:geometry])
  @id = block[:id]
  
  @text = block[:text] || ""
  
  @words = []
  if block[:relationships]
    block[:relationships].each do |rs|
      if rs[:type] == 'CHILD'
        rs[:ids].each do |cid|
          if blockMap[cid][:block_type] == "WORD"
            @words.append(Word.new(blockMap[cid], blockMap))
          end
        end
      end
    end
  end
end

Public Instance Methods

to_s() click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 121
def to_s
  s = "Line: "
  s = s + @text + "\n"
  s = s + "Words: "
  @words.each do |word|
    s = s + "[#{word}]"
  end
  return s
end