开发者

Which database i have to use to implement the auto-completion of dictionary

I ran across a interview question of implementing a dictionary that can implement the features of auto-completion, auto-correction, spell check etc...

I actually wanted to know which data base i have to use to store all the word like (for location country, c开发者_开发问答ity and zip code) .

Please suggest me if there any framework in java with any database or any optimal database that can achieve the solution

Any links that guide me on this are welcome...


The features you speak of are usually largely implemented in the application, not data, layer, since there is a significant UI component here. Any database (or even flat file) can store a list of words.

Can you be more specific about what area you are having trouble with? (If your question is really "How do I use a database?", that is too general for this site, and you should do some Googling. Try looking into JDBC for starters)


The simplest solution for auto-completion is to use a Navigable Set to find all the entries which start with a given String.

For auto-correction/spell check I would a plain set of correct words and to offer suggestions use a "sounds-like" encoder and a multi-map (Map of Lists) for all the words which sound like the word entered.


The simplest solution that can be done is using 'trie'. Its a data structure that represents the characeters at the indexed child node. http://en.wikipedia.org/wiki/Trie Has more info on this. THis need to be done in memory as at the end of each key stroke you are going to modify the set of suggesstions and auto complete list. Also as it is linked to the UI component like dropdown or text field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜