Skip to content

Commit

Permalink
Fix table extraction in ParsrConverter (#2262)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdankostic authored Mar 2, 2022
1 parent c5542bd commit a5501c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion haystack/nodes/file_converter/parsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ def _convert_table_element(
elem_idx: int,
meta: Optional[Dict[str, str]] = None,
) -> Dict[str, Any]:

row_idx_start = 0
caption = ""
table_list = [[""] * len(element["content"][0]["content"]) for _ in range(len(element["content"]))]
number_of_columns = max([len(row["content"]) for row in element["content"]])
number_of_rows = len(element["content"])
table_list = [[""] * number_of_columns for _ in range(number_of_rows)]

for row_idx, row in enumerate(element["content"]):
for col_idx, cell in enumerate(row["content"]):
Expand Down

0 comments on commit a5501c7

Please sign in to comment.