Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table extraction in ParsrConverter #2262

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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