![]() Input Format Two lines each containing a string, such as ahi_dee_uhl_ahiz (in Line 1) and ree_uhl_ahiz (in Line 2). Code is already provided for the program which runs your function bRhymes(). ![]() Write a function bRhymes() that accepts 2 pronunciations as strings and returns the rhyme percentage rounded to 1 decimal place, -1 if it is a perfect rhyme or -999 if the rhyme is too weak. The rhyme score is then determined by the total score divided by the total number of letters in the larger pronunciation ( excluding the underscores if any ). An underscore "_" represents the ending and starting of two syllables. If three consecutive letters match a score of 3 should be added, and so on. If two consecutive letters match a score of 2 should be added to the overall rhyme score. If one letter matches, that should add a score of 0 to the overall rhyme score 2. A rhyme score is calculated by comparing the letters of each syllable of two words: 1. Otherwise the program must return the rhyme (percentage) score. However, if the pronunciations receive a score of 40% or lower, the rhyme is too weak to use and the program must return -999. In such a case the program must return -1. If a pair of pronunciations receive a score of 75% or higher, it is considered a perfect rhyme. ![]() Because the program ignores perfect rhymes, words that rhyme perfectly will receive a score higher than a certain amount. The program returns a rhyme percentage based on the pronunciation of the words. The program ignores and discards perfect rhymes such as rat and bat or glove and dove. You decide to write a program that checks if two words rhyme. You are a songwriter, tired and upset because of all the lame easy rhymes that are in the most popular songs today.
0 Comments
Leave a Reply. |