-
Notifications
You must be signed in to change notification settings - Fork 20
feat: wrapped tables #9
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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