Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two issues with fuzzy matching #970

Merged
merged 2 commits into from
Feb 20, 2023
Merged

Fix two issues with fuzzy matching #970

merged 2 commits into from
Feb 20, 2023

Conversation

jeanas
Copy link
Contributor

@jeanas jeanas commented Feb 12, 2023

  • One issue with case,
  • One issue with difflib's “autojunk” heuristic.

Fixes #969

This seems intended at easing fuzzy matching with trivial edits in the
msgstr (changing case and adding whitespace), but it was only done on
the new msgstr, not on the old mgstr candidates, so it was possible for
merging catalogs to miss messages.
difflib has a heuristic that used to make fuzzy matching unreliable for
>200char strings.  See

python/cpython#90825

Fixes #969
@akx akx self-requested a review February 12, 2023 20:07
@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Merging #970 (c8b7ac5) into master (08af5e2) will decrease coverage by 0.01%.
The diff coverage is 92.00%.

@@            Coverage Diff             @@
##           master     #970      +/-   ##
==========================================
- Coverage   90.88%   90.88%   -0.01%     
==========================================
  Files          25       25              
  Lines        4333     4354      +21     
==========================================
+ Hits         3938     3957      +19     
- Misses        395      397       +2     
Impacted Files Coverage Δ
babel/messages/catalog.py 95.26% <92.00%> (-0.27%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jeanas
Copy link
Contributor Author

jeanas commented Feb 16, 2023

Is the 0.01% coverage decrease something I should worry about?

@jeanas
Copy link
Contributor Author

jeanas commented Feb 18, 2023

(Note that the two lines that don't have coverage are sanity check lines from the original difflib function that can't be triggered by babel because it uses the function correctly.)

@akx
Copy link
Member

akx commented Feb 20, 2023

Is the 0.01% coverage decrease something I should worry about?

Not at all :)

Copy link
Member

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good! Sorry for the delayed review.

@akx akx merged commit c76f1d4 into python-babel:master Feb 20, 2023
@jeanas jeanas deleted the autojunk branch February 20, 2023 13:56
@jeanas
Copy link
Contributor Author

jeanas commented Feb 20, 2023

Thank you for taking the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fuzzy matching sometimes misses obvious candidates
2 participants