|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Jul 2004
Location: Central Coast, CA
Posts: 365
|
Rhyming Words
I need an application that will rhyme words... how would be the best way to approach this?
I've thought about it breifly and the best solution I can think of right now is to grab the last three letters and search for them in other words... this seems rediculously not right =/ Any advice? |
|
|
|
|
|
#2 |
|
SitePoint Evangelist
![]() ![]() ![]() ![]() Join Date: Jul 2000
Location: Warwickshire, England
Posts: 590
|
in php maybe use metaphone() or soundex() on the end of the words?
|
|
|
|
|
|
#3 |
|
Simulation Cricketer
![]() ![]() ![]() ![]() Join Date: Sep 2004
Location: australia
Posts: 473
|
So these words will be stored in a database somewhere?
Once you grab the last three letters assign a variable to it ($vari) and run some SQL: SELECT * FROM tablename WHERE words_column = $vari hope that helps ![]() |
|
|
|
|
|
#4 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Sep 2004
Location: secunderabad
Posts: 273
|
could be much closer,
SELECT * FROM tablename WHERE words_column like '%$vari' |
|
|
|
|
|
#5 | |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Jul 2004
Location: Central Coast, CA
Posts: 365
|
Quote:
I never knew there was a php function for pronoucing words... amazing. |
|
|
|
|
|
|
#6 |
|
SitePoint resident know-it-all
![]() ![]() Join Date: Apr 2000
Location: Melbourne, Australia
Posts: 2,918
|
To implement this more rigorously, you'll need a better way to isolate the last syllable of a string/word for comparison with these functions. One way might be to look into implementing Liang's Algorithm in PHP.
Liang's Algorithm is a method for identifying locations in a text document where hyphens could be reasonably inserted. Since hyphens are generally placed between syllables, the same algorithm could work for this problem. The only description of Liang's Algorithm I could find mentioned online was in the documentation for the TeX page layout software, which can be found online in TeX format. You'll probably want to try to produce a rendered version of the document to read it. http://sources.redhat.com/ml/xsl-lis.../msg00508.html |
|
|
|
|
|
#7 |
|
SitePoint Member
Join Date: May 2004
Location: Pacific Northwest
Posts: 5
|
You also might find it helpful to have a look at a rhyming dictionary for songwriters. It would be great if you could just load one of those into your program, but even if you can't, seeing the way it is laid out will give you some insight into the way our ear decides two words "rhyme".
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 05:29.











Linear Mode
