-
fix: handle text too long for spacy issue (#4353)
发布于
2026-05-17 13:28:24 +00:00 This PR addresses the issue that very long text can fail partition
because its length exceedsspacy's character limit.spacyis used to
classify text content. For text too long to fit under the limit we now
truncate the text and use the truncated text to represent the full text
for classification purposes.
Summary by cubic
Prevents tokenization failures on very long inputs by truncating text
that exceedsspacy’smax_length, keeping partition/classification
stable for large documents without affecting normal cases.- Bug Fixes
- Guard
_processfor inputs overnlp.max_length; truncate at the
last whitespace within budget, log a warning, and avoidspacy
ValueError E088. - Add tests for truncation behavior and for normal processing within the
limit.- Update version to
0.22.29and changelog.
- Update version to
Written for commit 1bfdd91b99789c5333f300f8e10481250a536add.
Summary will update on new commits. Review
in cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
下载附件