feat: wrapped tables - #9
Conversation
| _documentai_table: documentai.Document.Page.Table = dataclasses.field( | ||
| init=True, repr=False | ||
| ) | ||
| body_rows: List[List[str]] = dataclasses.field(init=True, repr=False) |
There was a problem hiding this comment.
The body rows and header rows perhaps could be cached properties and extracted only when called. Or alternatively, populated in __post_init__ (calling some of the private helper functions extracting rows from documentai.Table).
There was a problem hiding this comment.
what would be the benefit of populating it in __post_init__
| paragraphs = [] | ||
| tables = [] | ||
|
|
||
| for line in documentai_page.lines: |
There was a problem hiding this comment.
The code for populating lines, paragraphs, and tables could go into post_init, since then the user could also instantiate a wrapped_page by just passing in a documentai_page message (useful when we support in-memory documents).
There was a problem hiding this comment.
I don't believe we can support both, since populating the things in post_init would require me to remove them from init. Also there would be no difference between from_documentai_page and using DocumentWrapper()
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕
BEGIN_COMMIT_OVERRIDE
chore: wrapped tables
END_COMMIT_OVERRIDE