Repository navigation
Conversation
One alternative in the image-reference pattern, (?:[0-9a-zA-Z]+){7,},
matches any run of seven or more ASCII letters or digits, so every
ordinary word of that length was removed: "Machine learning algorithms
are powerful." became " are .". Drop it; the remaining alternatives
still strip the Markdown image links and hashed image file names.
Fixes OpenDCAI#568
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One alternative in
RemoveImageRefsRefiner's pattern,(?:[0-9a-zA-Z]+){7,}, matches any run of 7 or more ASCII letters or digits. Because of that, the refiner removed every ordinary word of that length, even in rows with no image reference:Fix
Remove that alternative. The rest of the pattern is unchanged, and it still strips the Markdown image links (
,), hashed file-name tails and图 1-2:...captions.Tests
I added
test/cpu_only/test_remove_image_refs_refiner.py:test_words_of_seven_or_more_characters_are_kept: plain English sentences come back unchangedtest_image_references_are_still_removed: a short image link, a hashed image link and a图 x-y:caption are still removedBefore the fix: 1 failed (long words removed), 1 passed
After the fix: 2 passed
Fixes #568