Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
checking against a dictionary
Old 03-30-2009, 11:25 AM checking against a dictionary
Skilled Talker

Posts: 68
Name: Avi Zolty
Location: Atlanta
Trades: 0
Hey

Is it possible to check a string of characters against a dictionary (to see if it's a real word)?
I have a script that basically gives me all the permutations of some characters, and I want my script to before it echo's it out to me, to check if it is a real word or not?

I figure I may have to connect to a SQL database.. but I don't want to upload a whole dictionary to my server... what's the best way to do this?
** NOTE:**
I now have a wordlist with a bunch of words... but how do I make it "check" it?
__________________
"If you say something interesting, people will remember your name" ~ Anonymous


Please login or register to view this content. Registration is FREE
.asp <- Irony

Last edited by Zoltar1992; 03-30-2009 at 12:13 PM..
Zoltar1992 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-30-2009, 04:12 PM Re: checking against a dictionary
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Depends on the format of your word list. Give us some more details and then we can assist more usefully.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 03-30-2009, 04:20 PM Re: checking against a dictionary
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Depending on how long your wordlist is, you could just parse the file into an array of words and then use in_array to check if your word is in it. This kind of linear search, however you might not want to do on a large list with a large number of requests. Adding the words to an SQL database might improve performance, but it will depend on the number of requests you're dealing with.

Assuming your words are line seperated:
PHP Code:
$path '/path/to/file.txt';
$wordArray file($path);

$myWord 'someword';

if(
in_array($myWord $wordArray))
{
     
//your word is in the dictionary

__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to checking against a dictionary
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18047 seconds with 12 queries