Word Is In Dictionary or Not
Asked Answered
B

1

3

I am trying to see if a word is in the dictionary or not. Is there any way to do that?

Borglum answered 7/5, 2011 at 2:58 Comment(5)
are we talking about the data-structure "dictionary"?Melaniamelanic
The data structure or Language dictionary?Carnival
Language dictionary. So if i put in "efslkjd" it should not say that is a word but if i put in "Thank" in should say it is a wordBorglum
Do you have an dictionary on your system? On linux, you normally have files called *dict* and/or *spell* on your drive. Depending on your locale, they might contain abbvs. like en-US and similar. To have a starting point, use find/locate: find $(locate -i dict) -size +100k -ls or find $(locate -i spell) -size +100k -ls | grep -i en | grep -i us. Then you analyze the files, which are usually plain text in an easy to guess format. Read the file, fill a map, 10M of RAM is no problem - is it?Myeloid
i dont think so . i have a mac.Borglum
S
2

Get a list of (assumingly) English words and put it in a database (probably Sqlite for portability). You can get lists of words here:

http://wordlist.sourceforge.net/

Or here (found at https://stackoverflow.com/questions/824422):

http://www.curlewcommunications.co.uk/wordlist.html

Use a library corresponding to the database of your choice to query the table for a word. Here's a Sqlite engine written in pure Java:

http://sqljet.com/

Strychninism answered 7/5, 2011 at 3:0 Comment(2)
I am a beginner to this stuff so I don't really know how to use Sqlite. Are there any easier ways?Borglum
@The Waller: Not that are as efficient. There's a tutorial on the Sqljet site here: sqljet.com/tutorial.htmlStrychninism

© 2022 - 2024 — McMap. All rights reserved.