match_lyrics in stages/transcribe.py uses difflib.SequenceMatcher with its default autojunk=True. Once a sequence has 200 or more items, difflib treats any token appearing in more than 1% of it as junk. In lyrics those are the most common words ("you", "I", "the", …), and junk tokens can't start a matching block.
As a result, runs of words that Whisper heard correctly come back as replace opcodes instead of equal. On one real song (388 heard tokens against 450 reference tokens), one block had 17 of 18 heard words matching the reference exactly but was still labelled replace. The overall ratio is 0.74 with autojunk and 0.81 without.
All three consumers of the matcher are affected:
the similarity check against SIMILARITY_THRESHOLD
dropped_lines
missing_spans, which are built from delete opcodes
Passing autojunk=False is a one-line change. Expect the similarity ratio and the dropped/missing classification to shift on longer songs, so it's worth checking a few real songs before and after.
**Filed by LLM agent**
`match_lyrics` in `stages/transcribe.py` uses `difflib.SequenceMatcher` with its default `autojunk=True`. Once a sequence has 200 or more items, difflib treats any token appearing in more than 1% of it as junk. In lyrics those are the most common words ("you", "I", "the", …), and junk tokens can't start a matching block.
As a result, runs of words that Whisper heard correctly come back as `replace` opcodes instead of `equal`. On one real song (388 heard tokens against 450 reference tokens), one block had 17 of 18 heard words matching the reference exactly but was still labelled `replace`. The overall ratio is 0.74 with autojunk and 0.81 without.
All three consumers of the matcher are affected:
- the similarity check against `SIMILARITY_THRESHOLD`
- `dropped_lines`
- `missing_spans`, which are built from `delete` opcodes
Passing `autojunk=False` is a one-line change. Expect the similarity ratio and the dropped/missing classification to shift on longer songs, so it's worth checking a few real songs before and after.
Measured on two real songs' transcripts, without running any model. Dropped lines and missing-lyrics spans come from classify_lyrics_match.
song
matcher
ratio
exact-matched words
dropped lines
missing-lyrics spans
A (63 lines)
difflib, autojunk on (current)
0.74
309
none
4 / 34s
A
difflib, autojunk off
0.81
340
last line
4 / 43s
A
edit distance (rapidfuzz Levenshtein opcodes)
0.81
340
6 lines
7 / 124s
B (52 lines)
difflib, autojunk on (current)
0.68
192
8 lines
2 / 38s
B
difflib, autojunk off
0.66
187
7 lines
2 / 60s
B
edit distance
0.67
188
7 lines, including 3 the current matcher places correctly
8 / 123s
Turning autojunk off gives more exact matches on song A and fewer on song B. On both songs it also makes the line classification no better: song A gains a dropped line and more missing time, and song B gains more missing time. Plain edit distance is clearly worse, because it doesn't favour long runs of consecutive matches and breaks matched lines apart.
Not changing anything for now. A matching change needs a small set of songs with known-correct line placement to judge it against. Two songs without ground truth can't tell an improvement from a regression.
**Comment by LLM agent**
Measured on two real songs' transcripts, without running any model. Dropped lines and missing-lyrics spans come from `classify_lyrics_match`.
| song | matcher | ratio | exact-matched words | dropped lines | missing-lyrics spans |
|---|---|---|---|---|---|
| A (63 lines) | difflib, autojunk on (current) | 0.74 | 309 | none | 4 / 34s |
| A | difflib, autojunk off | 0.81 | 340 | last line | 4 / 43s |
| A | edit distance (`rapidfuzz` Levenshtein opcodes) | 0.81 | 340 | 6 lines | 7 / 124s |
| B (52 lines) | difflib, autojunk on (current) | 0.68 | 192 | 8 lines | 2 / 38s |
| B | difflib, autojunk off | 0.66 | 187 | 7 lines | 2 / 60s |
| B | edit distance | 0.67 | 188 | 7 lines, including 3 the current matcher places correctly | 8 / 123s |
Turning autojunk off gives more exact matches on song A and fewer on song B. On both songs it also makes the line classification no better: song A gains a dropped line and more missing time, and song B gains more missing time. Plain edit distance is clearly worse, because it doesn't favour long runs of consecutive matches and breaks matched lines apart.
Not changing anything for now. A matching change needs a small set of songs with known-correct line placement to judge it against. Two songs without ground truth can't tell an improvement from a regression.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Filed by LLM agent
match_lyricsinstages/transcribe.pyusesdifflib.SequenceMatcherwith its defaultautojunk=True. Once a sequence has 200 or more items, difflib treats any token appearing in more than 1% of it as junk. In lyrics those are the most common words ("you", "I", "the", …), and junk tokens can't start a matching block.As a result, runs of words that Whisper heard correctly come back as
replaceopcodes instead ofequal. On one real song (388 heard tokens against 450 reference tokens), one block had 17 of 18 heard words matching the reference exactly but was still labelledreplace. The overall ratio is 0.74 with autojunk and 0.81 without.All three consumers of the matcher are affected:
SIMILARITY_THRESHOLDdropped_linesmissing_spans, which are built fromdeleteopcodesPassing
autojunk=Falseis a one-line change. Expect the similarity ratio and the dropped/missing classification to shift on longer songs, so it's worth checking a few real songs before and after.Comment by LLM agent
Measured on two real songs' transcripts, without running any model. Dropped lines and missing-lyrics spans come from
classify_lyrics_match.rapidfuzzLevenshtein opcodes)Turning autojunk off gives more exact matches on song A and fewer on song B. On both songs it also makes the line classification no better: song A gains a dropped line and more missing time, and song B gains more missing time. Plain edit distance is clearly worse, because it doesn't favour long runs of consecutive matches and breaks matched lines apart.
Not changing anything for now. A matching change needs a small set of songs with known-correct line placement to judge it against. Two songs without ground truth can't tell an improvement from a regression.