class AmazonTRP::Cell

Attributes

block[R]
columnIndex[R]
columnSpan[R]
confidence[R]
content[R]
geometry[R]
id[R]
rowIndex[R]
rowSpan[R]
text[R]

Public Class Methods

new(block, blockMap) click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 323
def initialize(block, blockMap)
  @block = block
  @confidence = block[:confidence]
  @rowIndex = block[:row_index]
  @columnIndex = block[:column_index]
  @rowSpan = block[:row_span]
  @columnSpan = block[:column_span]
  @geometry = Geometry.new(block[:geometry])
  @id = block[:id]
  @content = []
  @text = ""
  if block[:relationships]
    block[:relationships].each do |rs|
      if rs[:type] == 'CHILD'
        for cid in rs[:ids]
          blockType = blockMap[cid][:block_type]
          if blockType == "WORD"
            w = Word.new(blockMap[cid], blockMap)
            @content.append(w)
            @text = @text + w.text + ' '
          elsif blockType == "SELECTION_ELEMENT"
            se = SelectionElement.new(blockMap[cid], blockMap)
            @content.append(se)
            @text = @text + se.selectionStatus + ', '
          end
        end
      end
    end
  end
  @text = @text.strip
end

Public Instance Methods

to_s() click to toggle source
# File lib/amazon-textract-parser-ruby.rb, line 355
def to_s
  @text
end