fix(cleaners): return no bullets from extract_ordered_bullets for blank text
SA
8h ago+5+5+0123456789-0-0-0123456789
Summary
extract_ordered_bullets takes text.split()[0] without checking that the text has a word, so an empty or whitespace-only string raises IndexError: list index out of range:
>>> extract_ordered_bullets("")
IndexError: list index out of range
The docstring says text without a leading ordered bullet gives (None, None, None). Blank text has no bullet either, so it now returns the same.
This is the same slip as in clean_ordered_bullets, which I fixed separately in #4862. The two PRs touch different files and are independent.
Validation
- Added
""," "and"\n"cases totest_extract_ordered_bullets; all three fail without the fix. pytest test_unstructured/cleaners/test_extract.py: 42 passed.ruff checkandruff format --checkclean on the two touched files.
Release note
extract_ordered_bullets no longer raises IndexError on empty or whitespace-only text.
AI-assisted change. I reviewed the diff and ran the tests locally. I can't apply labels; this is a bug fix.