Skip to content

fix: list the same stripped strings that text_duplicates counts - #794

Open
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-text-duplicates-dict-consistency-a3f1
Open

fix: list the same stripped strings that text_duplicates counts#794
tonycoder-hub wants to merge 1 commit into
huggingface:mainfrom
tonycoder-hub:cursor/fix-text-duplicates-dict-consistency-a3f1

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Summary

duplicate_fraction hashes stripped strings, so "hello sun" and "hello sun " count as duplicates. duplicates_dict used Counter(data) on the raw strings, so those pairs produced a non-zero fraction and an empty list.

Count over the same stripped strings. Distinct from #499 (module_type only).

Test plan

  • New test fails on current main ({} vs {'hello sun': 2}) and passes after
  • python -m pytest tests/test_metric_common.py -k text_duplicates → 2 passed, 1 skipped

duplicate_fraction is computed from hashes of stripped strings, so strings
that differ only in surrounding whitespace count as duplicates. duplicates_dict
was built from the raw strings, so a single call could report a non-zero
duplicate fraction together with an empty duplicates_dict.

Co-authored-by: Tony Coder <407243179@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants