Repository navigation
fix(dedup): strip watermark and require 0.6 similarity for OCR duplicates - #380
Merged
Merged
Conversation
…ate matches Audit of 152 recent OCR merges: 43% were false. Short captions sharing only the @ffmemesbot watermark passed pg_trgm's default 0.3 threshold, and published-first ordering funnelled hundreds of unrelated memes into a few hub originals. Stripped similarity >= 0.6, ordered by similarity: ~2.5% false, ~93% recall.
This was referenced Oct 31, 2026
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.
What
OCR duplicate matching (
find_duplicate_by_ocr_text, used by Describe Memes, pending-meme dedup and upload moderation):@ffmemesbotwatermark (and OCR misreads like@ffemesbot) andimgflip.combefore the 12-char minimum and the match;similarity(stripped, stripped) >= 0.6; the%operator (default 0.3) stays only as the trigram-index prefilter;Why
We hand-labelled 152 OCR merges from the last 60 days. 43% were false merges, mostly unrelated short captions that shared only the watermark. Published-first ordering funnelled them into hub originals: one meme whose whole text is the watermark absorbed 655 dupes, another absorbed 760. Their reactions were moved onto the hub and the memes were removed from the feed. In the last 24h, 259 of 565 merges were below the new rule.
Tests
tests/storage/test_deduplication.pyandtests/tgbot/test_upload_moderation.pypass locally.Restoring historical false merges is a separate change.