pointproven214
i speak facts not emotions
Algorithm That Counts Rap Rhymes and Scouts Mad Lines
FEBRUARY 13, 2015 / ERIC
“Men lie, women lie, numbers don’t” – Jay Z
Among the many things rappers like to boast about, some are relatively easy to quantify, like money, whereas rhyming skills are something that have been very difficult to measure – up till now. In this post, I’ll present Raplyzer, a computer program which automatically detects rhymes from rap lyrics and which is used to rank popular rappers based on their average Rhyme factor. I’ll also present another program called BattleBot, which is a search engine for rhyming rap lines based on the algorithm used in Raplyzer.
Rap Rhyming 101
In rap lyrics, assonance, where words don’t have necessarily the same ending but they share a vowel sound, is the most typical form of rhyming nowadays [1]. In multi-syllable rhymes (multis), it is not only the last syllable but multiple syllables that share a vowel sound. For example:
“This is a job – I get paid to sling some raps,
What you made last year was less than my income tax” [2]
As one author puts it: “Multis are hallmarks of all the dopest flows, and all the best rappers use them”
Automatic Rhyme Detection
I’ve developed an algorithm called Raplyzer for detecting assonance rhymes. If you’re not interested in the technical details, you might want to skip directly to the results in the next section.
In order to detect rhymes, the key thing is to find matching vowel sound sequences. Unfortunately, vowel sounds can’t be trivially extracted from English text since words are not pronounced as they are written (as opposed to the Finnish language for which I originally developed Raplyzer). Luckily, there’s a great open source speech synthesizer, eSpeak, which can be used to obtain a phonetic transcription of the lyrics.
From the phonetic transcription, we remove everything but vowels and do the following:
Go through a song word by word.
For each word, find the longest matching vowel sequence that ends with one of the 15 previous words (start with the last vowels of two words, if they’re the same, proceed to the second to last vowels, third to last, and so on. Proceed ignoring word boundaries until the first non-matching vowels have been encountered).
Compute the average rhyme length (= Rhyme factor) by averaging the lengths of the longest matching vowel sequences of all words.
When finding the longest matching vowel sequence, we do not accept matches where any of the rhyming words are exactly the same, since typically some phrases, e.g., in the chorus, are repeated several times and these shouldn’t count as rhymes. Also, before running the phonetic transcription, we remove all duplicate lines from the text to normalize the lyrics, as in some cases the lyrics contain the chorus repeated many times, whereas in some cases they might just have “Chorus 4X”. And when matching vowels, we accept certain pairs of vowel phonemes that sound very similar (as specified here).
Algorithm That Counts Rap Rhymes and Scouts Mad Lines
FEBRUARY 13, 2015 / ERIC
“Men lie, women lie, numbers don’t” – Jay Z
Among the many things rappers like to boast about, some are relatively easy to quantify, like money, whereas rhyming skills are something that have been very difficult to measure – up till now. In this post, I’ll present Raplyzer, a computer program which automatically detects rhymes from rap lyrics and which is used to rank popular rappers based on their average Rhyme factor. I’ll also present another program called BattleBot, which is a search engine for rhyming rap lines based on the algorithm used in Raplyzer.
Rap Rhyming 101
In rap lyrics, assonance, where words don’t have necessarily the same ending but they share a vowel sound, is the most typical form of rhyming nowadays [1]. In multi-syllable rhymes (multis), it is not only the last syllable but multiple syllables that share a vowel sound. For example:
“This is a job – I get paid to sling some raps,
What you made last year was less than my income tax” [2]
As one author puts it: “Multis are hallmarks of all the dopest flows, and all the best rappers use them”
Automatic Rhyme Detection
I’ve developed an algorithm called Raplyzer for detecting assonance rhymes. If you’re not interested in the technical details, you might want to skip directly to the results in the next section.
In order to detect rhymes, the key thing is to find matching vowel sound sequences. Unfortunately, vowel sounds can’t be trivially extracted from English text since words are not pronounced as they are written (as opposed to the Finnish language for which I originally developed Raplyzer). Luckily, there’s a great open source speech synthesizer, eSpeak, which can be used to obtain a phonetic transcription of the lyrics.
From the phonetic transcription, we remove everything but vowels and do the following:
Go through a song word by word.
For each word, find the longest matching vowel sequence that ends with one of the 15 previous words (start with the last vowels of two words, if they’re the same, proceed to the second to last vowels, third to last, and so on. Proceed ignoring word boundaries until the first non-matching vowels have been encountered).
Compute the average rhyme length (= Rhyme factor) by averaging the lengths of the longest matching vowel sequences of all words.
When finding the longest matching vowel sequence, we do not accept matches where any of the rhyming words are exactly the same, since typically some phrases, e.g., in the chorus, are repeated several times and these shouldn’t count as rhymes. Also, before running the phonetic transcription, we remove all duplicate lines from the text to normalize the lyrics, as in some cases the lyrics contain the chorus repeated many times, whereas in some cases they might just have “Chorus 4X”. And when matching vowels, we accept certain pairs of vowel phonemes that sound very similar (as specified here).
Algorithm That Counts Rap Rhymes and Scouts Mad Lines