Skip to content

rfctr(html): prepare for new html parser - #3257

Merged
scanny merged 8 commits into
mainfrom
scanny/prep-for-new-html-parser
Jun 21, 2024
Merged

scanny merged 8 commits into
mainfrom
scanny/prep-for-new-html-parser

Conversation

@scanny

@scanny scanny commented Jun 20, 2024 •

Copy link
Copy Markdown
Contributor

Summary
Extract as much mechanical refactoring from the HTML parser change-over into the PR as possible. This leaves the next PR focused on installing the new parser and the ingest-test impact.

Reviewers: Commits are well groomed and reviewing commit-by-commit is probably easier.

Additional Context
This PR introduces the rewritten HTML parser. Its general design is recursive, consistent with the recursive structure of HTML (tree of elements). It also adds the unit tests for that parser but it does not install the parser. So the behavior of partition_html() is unchanged by this PR. The next PR in this series will do that and handle the ingest and other unit test changes required to reflect the dozen or so bug-fixes the new parser provides.

@scanny
scanny force-pushed the scanny/prep-for-new-html-parser branch from e391d5a to 75c0755 Compare June 20, 2024 05:28
@scanny
scanny force-pushed the scanny/prep-for-new-html-parser branch from 75c0755 to c1f87cc Compare June 20, 2024 05:31
@scanny
scanny requested a review from Coniferish June 20, 2024 06:07
@scanny
scanny force-pushed the scanny/prep-for-new-html-parser branch from c1f87cc to b2b0e0b Compare June 20, 2024 06:07
@scanny
scanny force-pushed the scanny/prep-for-new-html-parser branch from b2b0e0b to a6707c4 Compare June 20, 2024 18:46
scanny added 8 commits June 21, 2024 12:05
The new parser is going to make things crowded for a single module.
Extract an `html/` sub-package so the various components can have their
own modules.
Now that the broad refactoring is done and HTMLDocument is on its way
out, move `HtmlPartitionerOptions` to its natural home in
`unstructured.partition.html.partition` alongside `partition_html()`.
In preparation for consolidating the partitioning tests with the soon to
be legacy HTMLDocument tests, establish clear test categories and
organize tests into those categories.
Some of the HTMLDocument tests are useful and relevant as integration
tests for `partition_html()`. Others are implementation specific and are
replaced by unit tests on the new parser.

Salvage those that will be useful after swapping in the new parser and
add them to `test_unstructured/partition/html/test_partition.py`.

These will be adjusted after installing the new parser to call
`partition_html()` instead of `HTMLDocument` to get their elements.
@sentry

sentry Bot commented Jul 2, 2024

Copy link
Copy Markdown

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte /general/v0/general View Issue

Did you find this useful? React with a 👍 or 👎

This branch was previously deployed

1 inactive deployment
ci — c6394863 Deployed Jun 21, 2024 by scanny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants