Implementing a rhyme finder [closed]
Asked Answered
A

5

11

Was wondering if anyone had any tips or could point me in the right direction to finding/creating some sort of algorithm to find rhyming words.

I specifically do not want to use an API, as creating the algorithm just to create it is my end goal.

Not that it should be important but I'm coding in java.

Thank you

Arrival answered 19/12, 2012 at 21:13 Comment(6)
Good luck, endlessly tough?Hoon
what is the definition of a rhyme?Pulsar
@AlexLynch en.wikipedia.org/wiki/Rhyme, I do not know had your language define them but in my native (Polish) we also categorize rhymes. ;-)Lateral
/Proud folk stare after me, Call me Calliope; Tooting joy, tooting hope, I am the calliope./Instructive
@Vash the point was to get the author to start researching what a rhyme is by himself. one must know what a rhyme is before writing an algorithm to detect rhymesPulsar
@AlexLynch, So that was a rhetorical question. But was hard to assume it. ;-).Lateral
L
8

This seems like it could be a huge project if you don't want to use an API. The challenging step would be to determine the phonetics of a word (two words rhyme if their endings are phonetically similar). If you can do this, you can compare the endings of their pronunciation. You could possibly find an API that would convert known words to their phonetic spellings but if you don't want to use APIs you have to do it yourself and it's no small task... not to mention, hasn't been perfect by anyone.

The other method would be to research the Metaphone algorithm, explained here: http://www.blackbeltcoder.com/Articles/algorithms/phonetic-string-comparison-with-soundex

Lip answered 19/12, 2012 at 21:23 Comment(2)
Soundex was developed specifically for North American family names during the processing of their census. It is not a general purpose library for phonetic analysis of words, though it is still probably of interest to the asker. It's also focussed on the start of words, whereas rhymes relate to their endings. The technique may be malleable.Downer
I provided that link because of the Metaphone algorithm, not Soundex.Lip
B
6

Best algorithm will use a dictionary of words classified on groups with rhymes. It's very hard problem and need linguistics background. I suppose you want some, probably not the best, algorithm for automatic finding the rhymes.

Basic idea to code pronunciation of the word (not the word itself) with some value. And values that ends with equal codes identify words rhymes.

From my perspective it is more researching than finding the correct algorithm.

Take a look at that paper: A System for the Automatic Identification of Rhymes

Benoni answered 19/12, 2012 at 21:28 Comment(0)
H
4

I think leveraging a standard phonetic algorithm would be a good idea. I think Soundex might be a bit limited, but a double metaphone would probably be a good choice.

Get the metaphone representations of the words in question, remove the first characters, and check whether the remaining portion of the shorter of the two words matches the end of the longer. With double metaphone, it's very similar, but make four comparisons, primary to primary, secondary to primary, primary to secondary and secondary to secondary.

I think that would be a good starting point.

A note on this and many other phonetic algorithms: It isn't designed to provide precise phonetic definition. Varied geographic pronunciation, common mispronunciations and alternate pronunciations make a hard and fast single correct pronunciation impossible to obtain based solely on the word. Novel spelling and letter usage make it hard to algorithmically obtain a close pronunciation (care for some hors d'oeuvres?). Also, a major goal of many such algorithms are to match similar sounding or misheard words or names to each other, so the results are usually intended to be a bit imprecise (this is probably a good thing, for this purpose as well).

Hubert answered 19/12, 2012 at 21:29 Comment(2)
Double metaphone drops all the non-initial vowels from the word, so it doesn't get you all the way there on rhyming.Ecstasy
Absolutely true. I do maintain that it is a good starting point, though.Hubert
B
4

I wrote a rhyming dictionary program at my blog. The idea is to use a dictionary with pronunciations and compare phonemes starting from the end; two words with the same ending phonemes are rhymes for each other.

Bangs answered 19/12, 2012 at 22:4 Comment(0)
L
0

You may want to take a look at the Carnegie Mellon pronouncing dictionary, for starters. It's the best pronouncing dictionary I've been able to find.

http://www.speech.cs.cmu.edu/cgi-bin/cmudict

Lowry answered 23/1, 2014 at 4:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.