4

I'm working on a project that requires a simple dictionary for checking spelling; it will be large, but will lack definitions. The solution we're currently working on has the base word list in a text file, and customizations (extra words, excluded words) in the DB.

The entire list needs to be loaded (best cached I think) for paginated display and customization using an existing JS widget, so what's the best way to store and load the base word list?

My initial thought was to have a text file with one word per line and write my own loader and cache object, but my boss suggested using a ResourceBundle to leverage the built-in caching. I'm thinking that could be done by using the words as keys with empty values and using the keyset of the bundle.

What would be the best solution to this?

1
  • Algorithm/approach discussions are safely on topic here. There's no need to migrate this question to Stack Overflow.
    – Adam Lear
    Aug 26, 2011 at 19:52

2 Answers 2

7

In general, the data structure your are looking for is called TRIE.

If you are looking to implement this in javascript, be sure to read John Resig's blog on that subject. He evaluated several techniques for a similar problem, highly recommended.

Also, take a look at this stackoverflow.com question to find java implementations.

1
  • I'll definitely look into a trie or DAWG if we run into performance issues; thanks! Aug 25, 2011 at 14:56
1

Is this for a language that does not already have dictionary files out there? I'm not 100% certain, but I was pretty sure that the Aspell open sourced dictionaries were available to developers...

1
  • The app doing the work is written in Java and running on multiple platforms (Linux, Windows), so I don't know if this would be the right solution. Aug 25, 2011 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.