Repository navigation
fix(general_text): keep cleaned text and count each modified row once in ReferenceRemoverRefiner - #561
Closed
cyberspace-cs wants to merge 1 commit into
Conversation
… in ReferenceRemoverRefiner (OpenDCAI#554) The operator built the cleaned text with ref_pattern.subn() and cite_pattern.subn() but appended the original item instead of the refined one, so <ref>/<ref> tags and {{cite}} templates were never removed from the output column. Append the cleaned text instead. The modified-row counter was also incremented twice per changed row (once inside the pattern check and again via a redundant 'modified' flag), doubling the reported 'Total modified items'; remove the duplicate count. Adds cpu-only regression tests covering closed/unclosed markers, untouched rows and the non-doubled summary count.
Contributor
Author
|
Closing this as a duplicate — I missed #555 when I opened it. Same root cause, same fix (reassign My branch additionally covers the double-counted "Total modified items" log line and a no-substitution case; I can send those as a small follow-up to #555 if you want them. Sorry for the noise. |
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
Fixes #554.
ReferenceRemoverRefinerbuilt the cleaned text withref_pattern.subn()andcite_pattern.subn(), but then appended the original item instead of the cleaned one:So the operator never removed anything —
<ref>...</ref>tags and{{cite ...}}templates stayed in the output column.In addition, the modified-row counter was incremented twice per changed row (once inside the pattern check and again via a redundant
modifiedflag), so the logged "Total modified items" was double the real count.Fix
refined_text(the cleaned text) instead of the originalitem.Behavior
For the reproducer in #554:
Paris is the capital of France.<ref>Smith 2020</ref>Paris is the capital of France.Summary log for two modified rows:
Total modified items: 4→Total modified items: 2.Tests
Added
test/cpu_only/test_reference_remover_refiner.py(cpu-only):<ref>tags and{{cite}}templatespytest -m cpu test/cpu_only/test_reference_remover_refiner.py→ 4 passed.