Systems and methods for serializing data extracted from data objects
Disclosed are systems and methods for detecting a table from a document, classifying each cell of the table as one of: a value cell, a row header cell, or a column header cell, and performing a bounding box elongation operation to match each cell that is classified as a value cell to a first corresponding cell that is identified as a row header cell and a second corresponding cell that is identified as a column header cell. For each cell classified as a value cell, a data tuple is generated comprising a row header element, a column header element, and a value element, wherein the row header element corresponds to a first value in the first corresponding cell, the column header element corresponds to a second value in the second corresponding cell, and the value element corresponds to a third value in the value cell.
1 . A computer-implemented method for extracting tabular data from a document, the method comprising:
detecting, by one or more processors, a table from the document;
extracting, by the one or more processors, information about the table from the document;
identifying, by the one or more processors, cells within the table, each cell comprising a bounding box;
classifying, by the one or more processors, each cell as one of: a value cell, a row header cell, or a column header cell;
iteratively performing, by the one or more processors, a bounding box elongation operation for each cell that is classified as the value cell to match the cell to a first corresponding cell that is identified as a row header cell and a second corresponding cell that is identified as a column header cell;
upon matching the cell to the first corresponding cell and the second corresponding cell by the bounding box elongation operation, generating, by the one or more processors, a data tuple comprising a row header element, a column header element, and a value element, wherein the row header element corresponds to a first value in the first corresponding cell, the column header element corresponds to a second value in the second corresponding cell, and the value element corresponds to a third value in the cell; and
storing, by the one or more processors, the data tuple for each cell classified as the value cell in a database.
2 . The computer-implemented method of claim 1 , wherein the bounding box elongation operation comprises:
determining top, bottom, left, and right edges of the bounding box for the cell classified as the value cell;
extending the left edge of the bounding box of the cell classified as the value cell until it overlaps with a row header cell; and
extending the top edge of the bounding box of the cell classified as the value cell until it overlaps with a column header cell.
3 . The computer-implemented method of claim 1 , wherein the bounding box elongation operation comprises:
extending the bounding box for the cell classified as the value cell horizontally to form a horizontally elongated bounding box for the cell classified as the value cell; and
extending the bounding box for the cell classified as the value cell vertically to form a vertically elongated bounding box for the cell classified as the value cell.
4 . The computer-implemented method of claim 1 , wherein an R-tree data structure is used to match each cell that is classified as the value cell to the first corresponding cell and the second corresponding cell.
5 . The computer-implemented method of claim 3 , wherein the first corresponding cell is determined by an intersection with the horizontally elongated bounding box, and the second corresponding cell is determined by an intersection with the vertically elongated bounding box.
6 . The computer-implemented method of claim 1 , wherein the bounding box elongation operation comprises identifying vertical lines and horizontal lines in the table.
7 . The computer-implemented method of claim 1 , wherein the bounding box elongation operation comprises identifying gaps between columns.
8 . The computer-implemented method of claim 1 , wherein a number of data tuples generated is equal to a number of value cells identified in the table.
9 . A system for extracting tabular data from a document, the system comprising:
one or more non-transitory computer readable media storing instructions; and
one or more processors executing the instructions to perform operations including:
detecting a table from a document;
extracting information about the table from the document;
identifying cells within the table, each cell comprising a bounding box;
classifying each cell as one of: a value cell, a row header cell, or a column header cell;
iteratively performing a bounding box elongation operation for each cell that is classified as the value cell to match the cell to a first corresponding cell that is identified as a row header cell and a second corresponding cell that is identified as a column header cell;
upon matching the cell to the first corresponding cell and the second corresponding cell by the bounding box elongation operation, generating a data tuple comprising three elements: a row header element, a column header element, and a value element; wherein the row header element corresponds to a first value in the first corresponding cell, the column header element corresponds to a second value in the second corresponding cell, and the value element corresponds to a third value in the cell; and
storing the data tuple for each cell classified as the value cell in a database.
10 . The system of claim 9 , wherein the bounding box elongation operation comprises:
determining top, bottom, left, and right edges of the bounding box for the cell classified as the value cell;
extending the left edge of the bounding box of the cell classified as the value cell until it overlaps with a row header cell; and
extending the top edge of the bounding box of the cell classified as the value cell until it overlaps with a column header cell.
11 . The system of claim 9 , wherein the bounding box elongation operation comprises:
extending the bounding box for the cell classified as the value cell horizontally to form a horizontally elongated bounding box for the cell classified as the value cell; and
extending the bounding box for the cell classified as the value cell vertically to form a vertically elongated bounding box for the cell classified as the value cell.
12 . The system of claim 9 wherein an R-tree data structure is used to match each cell that is classified as the value cell to the first corresponding cell and the second corresponding cell.
13 . The system of claim 11 , wherein the first corresponding cell is determined by an intersection with the horizontally elongated bounding box, and the second corresponding cell is determined by an intersection with the vertically elongated bounding box.
14 . The system of claim 9 , wherein the bounding box elongation operation comprises identifying vertical lines and horizontal lines in the table.
15 . The system of claim 9 , wherein the bounding box elongation operation comprises identifying gaps between columns.
16 . The system of claim 9 , wherein a number of data tuples generated is equal to a number of value cells identified in the table.
17 . One or more non-transitory computer readable media storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising:
detecting a table from a document;
extracting information about the table from the document;
identifying cells within the table, each cell comprising a bounding box;
classifying each cell as one of: a value cell, a row header cell, or a column header cell;
iteratively performing a bounding box elongation operation for each cell that is classified as the value cell to match the cell to a first corresponding cell that is identified as a row header cell and a second corresponding cell that is identified as a column header cell;
upon matching the cell to the first corresponding cell and the second corresponding cell by the bounding box elongation operation, generating a data tuple comprising three elements: a row header element, a column header element, and a value element; wherein the row header element corresponds to a first value in the first corresponding cell, the column header element corresponds to a second value in the second corresponding cell, and the value element corresponds to a third value in the cell; and
storing the data tuple for each cell classified as the value cell in a database.
18 . The one or more non-transitory computer readable media of claim 17 , wherein the bounding box elongation operation comprises:
determining top, bottom, left, and right edges of the bounding box for the cell classified as the value cell;
extending the left edge of the bounding box of the cell classified as the value cell until it overlaps with a row header cell; and
extending the top edge of the bounding box of the cell classified as the value cell until it overlaps with a column header cell.
19 . The one or more non-transitory computer readable media of claim 17 , wherein the bounding box elongation operation comprises:
extending the bounding box for the cell classified as the value cell horizontally to form a horizontally elongated bounding box for the cell classified as the value cell; and
extending the bounding box for the cell classified as the value cell vertically to form a vertically elongated bounding box for the cell classified as the value cell.
20 . The one or more non-transitory computer readable media of claim 17 , wherein an R-tree data structure is used to match each cell that is classified as the value cell to the first corresponding cell and the second corresponding cell.