Random dictionary word for given letter
Moderator: General Moderators
-
sathishkumar
- Forum Newbie
- Posts: 7
- Joined: Mon Mar 15, 2010 11:43 pm
Random dictionary word for given letter
hi everybody
Is there any possible code for getting output in php(all possible word from word dictionary)
for example....for word "werflo"
flower
fowler
reflow
wolfer
Is there any possible code for getting output in php(all possible word from word dictionary)
for example....for word "werflo"
flower
fowler
reflow
wolfer
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Random dictionary word for given letter
I think your best bet would be to mutate your string into every possible combination, then perform a look up in a dictionary database to determine which words exist in the given language.
pspell_check() may also be of interest to determining whether the spelling is correct or invalid (assuming you have the pspell extension).
pspell_check() may also be of interest to determining whether the spelling is correct or invalid (assuming you have the pspell extension).
-
sathishkumar
- Forum Newbie
- Posts: 7
- Joined: Mon Mar 15, 2010 11:43 pm
Re: Random dictionary word for given letter
Hi john,
Thanks your quick can you guide me with piece of code for this if possible. because i tired but many in vains.
Regards,
sathish
Thanks your quick can you guide me with piece of code for this if possible. because i tired but many in vains.
Regards,
sathish
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Random dictionary word for given letter
What have you tried? ..and what specifically are you having trouble with? I generally won't write anything beyond simple code for anyone without them demonstrating a little effort first.
-
sathishkumar
- Forum Newbie
- Posts: 7
- Joined: Mon Mar 15, 2010 11:43 pm
Re: Random dictionary word for given letter
I tried to get different combination of letter with looping. and i compared it with word dictionary but it takes much time to processing.
i want extact like unscramble in http://www.unscramble.net.
Regards,
sathish
i want extact like unscramble in http://www.unscramble.net.
Regards,
sathish
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Random dictionary word for given letter
Also see http://cogo.wordpress.com/2008/01/08/st ... on-in-php/ to generate word permutations.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Random dictionary word for given letter
Again.. I'm not here to write code for you. I'm here to help you learn..sathishkumar wrote:I tried to get different combination of letter with looping. and i compared it with word dictionary but it takes much time to processing.
i want extact like unscramble in http://www.unscramble.net.
Regards,
sathish
Post what you have tried, and we can move forward from there.
-
sathishkumar
- Forum Newbie
- Posts: 7
- Joined: Mon Mar 15, 2010 11:43 pm
Re: Random dictionary word for given letter
John I found word permutation there is no problem in it. but when compare it with word dictionary inside my database. it takes much time john(looping to compare 4 lakh words). is there any binary search for this?
Regards,
sathish
Regards,
sathish
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Random dictionary word for given letter
Performing a query against all permutations should not take long at all assuming you have a properly indexed your table.
I have asked you twice already to post what you have tried so far. This is the last time I will post here until you can provide the code you have done. I am simply grasping at straws otherwise...
It would also be helpful to see your table structure.
Code: Select all
$permutations = your_permutation_function('foobar'); //array of permutations
$sql = "
SELECT *
FROM dictionary
WHERE word IN ('". implode("','", $permutations) ."')
";It would also be helpful to see your table structure.