Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rhyming dictionary

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
GB
My daughter (Joanna aged 9) would like me to write her a programme where she would type in a word and the programme would display (from a word list) rhyming words.

I know about Soundex, but that won't give me just rhymes will it.

I think it is also sql server and foxpro only?

Any ideas? Peter Meachem
peter@accuflight.com
 
My first impression would be to create a database table to hold all the words. Each word entered would have a NumOfSyllables field, as well as belong to a certain "rhyme group". The number of syllables may or may not matter that much to Joanna, but it'd be a nice option to include without too much headache on your part. The value in the rhyme group would tie rhyming words together, and should be unique in a separate "lookup" table. The big headache would be establishing and maintaining the list of words and assigning each new entry to a rhyme group. Assuming this list is partially filled, if she enters "bake", your app would find the word "bake" in the words table, determine the rhyme group "bake" belongs to, and display all words in that rhyme group ("cake" and "lake" and "mistake" should be in this group).

Hope that helps!

~Mike

P.S. For extra credit, what word rhymes with "orange"? : )
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Just hope you know of a database dictionary...perhaps by compairing a series of 2 of the same sounds within the pronunciation of the word, you can get a pretty close estimate...

I dont know of any dictionary databases...try looking for one, and just access certain parts of it...

And I can tell you that its going to kill you trying to find all the ways a word can rhyme...but hey, it would actually be DANG useful!...imagine the poetry writers getting their hands on this baby!

Good luck on the proble...I mean, project...=P Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
"Dont yell at me if I'm wrong!...I'm at least trying to help!"
 
The word list is easy, there are loads around on the internet. The number of syllables would, as you say be nice, but the word list I use for a speller has 200,000 entries, I really don't fancy going through that lot by hand. It's got to be done using code only, I'm got going to spend weeks on it!
According to an online dictionary, rhymes for orange are:-

challenge, expunge, lozenge, lunge, orange, plunge, scavenge, sponge

Which are ok if you talk funny. And a definition of orange is
Definitions of orange:


noun: any of a range of colors between red and yellow
noun: round yellow to orange fruit of any of several citrus trees
noun: a river in South Africa that flows generally westward to the Atlantic Ocean
noun: any citrus tree bearing oranges
noun: any pigment producing the orange color
adjective: similar to the color of a ripe orange

which is fine if you know what an orange is, not so useful if not.

I didn't know that soundex was originally used for the US census in the early part of the last century until this evening. Peter Meachem
peter@accuflight.com
 
You can do some shortcuts to make the rhyme groups through a simple powerhouse approach. That is, by identifying certain letter/placement combinations that produce the same sounds.

In the above paragraph, for instance, the "an" at the end of a word will catch "man", "tan", "milkman", etc. The "ake" in "make" will match with "take", "mistake", "lake", etc. Anything with "ation" is a good bet, and so on. Obviously this is one approach to a long process, and I'm just thinking it would be a way to provide you with starting lists of rhyming possibilities for you to OK/Discard, while making the dictionary.

Anthony's got a point. You could sell this$$ Maybe get your daughter to test it and you can cut her in on the profits. I know my girls would love it.

Good luck :)
 
Neat little factoid:

There is no true rhyme for the word "orange" in the English language. Nate Gagne
nathan.gagne@verizon.net

Like my post? Let me know it was helpful!
 
If it is "O.K." for your daughter to do her rhymes on-line:




If you are just into doing it yourself, or she does not have net/web access, the only offering I have is a copy of a soundex routine. This routine (when / if I find it) is at least fairly well annotated, as I needed to "understand" the process before implementing it.

It would need some (non-trivial) modifications to be a rhyme srearch engine. Specifically, I think you would need to isolate the last syllable of a word (or phrase) and do the soundex on that (perhaps w/o the leading character), so (for example), bake would also find ache. As an alternative to actually identifying the last syllable, you might just try the last 3, 4, or 5 letters.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I'm not at all sure that a genuine Soundex implementation would lend itself to finding rhymes. In particular, one of the things it does is to drop 'inessential' letters which severely impact any ability to spot syllables with any degree of reliability.
 
? sndx2("Bake")
B2000

? sndx2("Ache")
A2000


Looks like a 'reasonable' process to me.

As previously noted, some modification some modification could improve the resulst, but the above is "basically" matching the "che" in ""Ache" to the "ake" in "Bake". Removing the standard characeristic Initial letter/dipthong (or possibly replacing it with the proper code) is an obvious first necessary step. Another would be to use the trailing codes instead ot the inital ones, but these are easy modifications. It is the "unknown" other isues which are not (at least by ME) forseen that may confound such a procedure.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Actually, it is matching the 'ch' with the 'k'.

One you understand how Soundex works it is easy to spot the problems it has. Try "Mast", "Most", and "Mist". Here in the UK none of those 1-syllable words rhyme, yet Sounded gives them all exactly the same value. "Dry", "Dare", "Door", abd "Dire" are additional trivial examples.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top