in src-csharp/TextractExtensions.cs [84:111]
public Table(Block block, List<Block> blocks) {
this.Block = block;
this.Confidence = block.Confidence;
this.Geometry = block.Geometry;
this.Id = block.Id;
this.Rows = new List<Row>();
var ri = 1;
var row = new Row();
var relationships = block.Relationships;
if(relationships != null && relationships.Count > 0) {
relationships.ForEach(r => {
if(r.Type == "CHILD") {
r.Ids.ForEach(id => {
var cell = new Cell(blocks.Find(b => b.Id == id), blocks);
if(cell.RowIndex > ri) {
this.Rows.Add(row);
row = new Row();
ri = cell.RowIndex;
}
row.Cells.Add(cell);
});
if(row != null && row.Cells.Count > 0)
this.Rows.Add(row);
}
});
}
}