I think I've come up with an simpler algorithm for the rhyming dictionary. Without going into details, it looks like this:
(1) Accept a word to be rhymed from the user.
(2) Identify the final vowel of the word, and any consonants that come after it. That this segment matches the final segment of a word under comparison is the minimum criterion for rhyming.
Two - /t o/
Say - /s ei/
Give - /g i v/
Point - /p oi n t/
(3) Create a list of words that share the same final segment, taking into account any differences which have been set to ignore. So, assume word strees is being ignored:
So these words rhyme:
Pain /p ei n/
Gain /g ei n/
Slain /s l ei n/
Pentane /p e n t ei n/
Insane /i n s ei n/
But if the destinction between /m/ and /n/ is ignored, these words are allowed:
Same /s ei m/
Game /g ei m/
Aim /ei m/
Nickname /n i k n ei m/
(4) Sort the resulting list into order of how many phonemes match for each word.
/p l ei n/ has the minimum 2 matches with /p ei n/, as has /f o n t ei n, but /b l ei n/ has three. If the difference between /l/ and /r/ is being ignored, then /g r ei n/ also has 3.
The main problem with this algorithm is that sometimes a phoneme is skipped over when rhyming two words, and this algorithm can't cope with that. Porridge (/p o r i dZ/) almost rhymes with Orange (/o r i n dZ/). Similarly, Review (/r i v iu/) with Renfrew (/r e n f r iu/). I don't know whether this is important.
No comments:
Post a Comment