Repository navigation
Fix surrogate pairs crashing tokenization and saving to UTF-8 - #418
pmachapman wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #418 +/- ##
=======================================
Coverage 92.30% 92.30%
=======================================
Files 399 399
Lines 25488 25509 +21
=======================================
+ Hits 23526 23547 +21
Misses 1962 1962 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
38c136c to
86b78fb
Compare
This comment has been minimized.
This comment has been minimized.
86b78fb to
a10a2aa
Compare
|
Verdict: approve. A split surrogate pair is joined before it reaches the engine and the UTF-8 alignment spool. The test now pins a lone surrogate as a build failure, which the author kept on purpose. Most important: F1 (accepted), Counts: Critical 0, Important 0 open (F1 accepted), Low 0 open. No new findings this round. Ran: the compare from Not verified: whether Serval sends lone surrogates, and the fix against a real MBart tokenizer, since the engine is mocked. Public API, published wheel, optional dependencies, and Findings: F1 accepted, F2 addressed, F3 addressed. Reviewed at a10a2aa |
Enkidu93
left a comment
There was a problem hiding this comment.
@Enkidu93 reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on pmachapman).
tests/jobs/test_nmt_engine_build_job.py line 93 at r2 (raw file):
def test_run_with_lone_surrogate(decoy: Decoy) -> None:
I think I'd prefer to just ignore the lone surrogate. We have seen some of these sneak through and I'd hate to fail an entire build because one character is off. Is there a reason you figured failing it would be preferable?
Fixes #414.
This PR fixes the following crash that occurs when a source string contains a broken surrogate:
This change is