feat: added excel backend - #334
Conversation
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWonderful, this rule succeeded.When test data is updated, we require two reviewers
|
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
| return k | ||
| return 0 | ||
|
|
||
| def convert_workbook(self, doc: DoclingDocument) -> DoclingDocument: |
There was a problem hiding this comment.
All methods that are not meant for the public API (presumably this one and various ones below), should be start with a _ as per PEP 8.
|
|
||
| return doc | ||
|
|
||
| def get_level(self) -> int: |
There was a problem hiding this comment.
Is this method used somewhere? If not, let's best remove it.
| return { | ||
| "beg_row": start_row, | ||
| "beg_col": start_col, | ||
| "end_row": max_row, | ||
| "end_col": max_col, | ||
| "num_rows": max_row + 1 - start_row, | ||
| "num_cols": max_col + 1 - start_col, | ||
| "data": data, | ||
| }, visited_cells |
There was a problem hiding this comment.
Let's use pydantic classes instead of raw dictionaries, as this keeps way easier to maintain.
Also I think several of these keys (e.g. "beg_row", "beg_col", ...) appear to be unused.
| xlsx_path.parent.parent / "groundtruth" / "docling_v2" / xlsx_path.name | ||
| ) | ||
|
|
||
| conv_result: ConversionResult = converter.convert(xlsx_path) |
There was a problem hiding this comment.
It would be interesting to test also with the bytes stream
| # Parses the DOCX into a structured document model. | ||
|
|
||
| origin = DocumentOrigin( | ||
| filename=self.file.name or "file", |
There was a problem hiding this comment.
as a default, I would suggest file.xlsx
| from typing import Set, Tuple, Union | ||
|
|
||
| from docling_core.types.doc import ( | ||
| DocItemLabel, |
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Adding a backend to convert excel workbooks.
Resolves #258.
Checklist:
conventional commits.