I wrote a program that successfully tells me that the first quatrain in Shakespeare's Sonnet 130 is not in iambic pentameter.
@lambdagrrl Are you going from machine learning and then applying to new cases, or do you have a definition? cos I literally never understood iambic, so I would love
a definition
@edensaesthetic I'm programming in the definition. So a line is in iambic pentameter if it can be said in five iambs, i.e. five pairs of syllables with the stress falling on the second of each pair. I'm using CMU's pronunciation dictionary to look up the possible pronunciations of each word, and then seeing if there's a way to say the line that fits the pattern.
@edensaesthetic Sonnet 130 begins:
My mistress’ eyes are nothing like the sun;
Coral is far more red than her lips’ red;
If snow be white, why then her breasts are dun;
If hairs be wires, black wires grow on her head.
The second line is not strict iambic pentameter, because you cannot say "co-RAL", only "CO-ral". But Shakespeare wrote it anyway because it sounded better that way. Stressing the first beat instead of the second in that manner is called "inversion" or "substitution".
@lambdagrrl That sounds amazing?! Legitimately, that would be really cool as an explanation of different meters and like 'warnings' for partial matches in meter and 'errors' for harsh breaks?