“Hamilton” is the massively successful Broadway musical about American's founding father Alexander Hamilton. By combining hip-hop and musical theatre, its writer, creator and star Lin-Manuel Miranda devised a juggernaut that found wide appeal among audiences. But what exactly makes his lyrical construction special, and how did Mr. Miranda weave four decades of hip-hop history with three centuries of the American story? To answer part of this question, we looked to the rhyme patterns in “Hamilton,” trying to classify the specific ways Mr. Miranda references foundational rappers such as Big Pun, Rakim, and Lauryn Hill into his verses about the Revolutionary War and constitutional congress. See the full project: We Wrote an Algorithm to Unravel the Rhymes of Hit Musical ‘Hamilton’ » Syllables vs. words The prospect of training a computer to recognize ryhmes becomes daunting when considering the complexity of rhyme structures (like the difference between perfect and oblique rhymes). Early in our process, we decided to consider rhyme solely at the syllabic level, rather than only focusing on entire words. Rap lyrics will often combine rhyming sounds together, making it impossible to fully capture the breadth of rhyme construction by asking only: “Do these words rhyme?” For example, everyone would agree that when Nas writes these words, he’s rhyming the word “monkey” with “funky”:

Rap pers I mon key flip em with the fun ky rhy thm I be kick in

Mu si cian in flict in com po si tion of pain

The ends of “musician” and “composition” rhyme, but "com-" also rhymes with the “mon-” and “fun-” sounds. If we limited rhyme to only full words, we would lose these syllabic rhyme patterns that are integral to the complex compositions of modern rappers. Phonetics Our general approach to extracting rhyme patterns begins with breaking each word into syllables and translating them into a regular phonetic language. We do this with the assistance of the CMU Pronouncing Dictionary with syllable annotations added by Susan Bartlett, Grzegorz Kondrak and Colin Cherry. This translates each word into a series of syllables, each of which is a series of phonemes, written in a code called the “Arpabet.” For example, in the final translation, the word “Hamilton” would be broken into: Syllable Phonetic language Ha “HH-AE” mil ”M-AH-L” ton ”T-AH-N” Vowel sounds To determine if two syllables can be rhymed, they first must share a similar vowel sound. The CMU Pronouncing Dictionary assigns each syllable one of 15 different vowel sounds. Any two syllables that have the same vowel sound (the same Arpabet character) are potential rhymes. Any two words with vowels that sound similar are weaker potential rhymes. But how do you measure vowel sound similarity? Generally, vowels with similar resonant frequencies (often produced in similar parts of the mouth) are similar enough that a rapper can bend their sounds to produce syllables that rhyme. For instance, when Lin-Manuel Miranda has Aaron Burr rhyme “Scotsman” with “dropped in,” he is able to do so because the “ə” vowel of “man” has very similar formant frequencies to the “ɪ” vowel of “in.”

Scotsman: S K AA T S M AH N

Dropped in: D R AA P T IH N

Stress Next, we look at syllable stress and assign a score. Generally, rhyme is heard most strongly between two stressed or emphasized syllables. As such, the highest score goes to two stressed syllables. Pairs with a single stressed syllable receive a lower score, and the lowest score is given to two unstressed syllables. Suffix Finally, we look at the consonant sounds that come after the vowel in a given syllable to determine if two syllables rhyme. If two syllables share a similar vowel sound and the same suffix phonemes, we immediately classify them as a rhyme. Here is the table of rhyme scores for the line “Forgotten spot in the Caribbean.” The higher the score, the more likely the syllables rhyme. We've highlighted the matching scores, which indicate possible rhymes: between "spot” and “got,” “en” and “an,” “en,” and “for” and “Car.”