views:

31

answers:

3

I have an application which lets people ask predefined queries. However, the list of such queries is too long. Hence, the current approach is to let users enter a word in the search box and then show them the likely matches from the list of queries. ( Very much like google's "Did you mean" feature.)

Is there an API in Java available for this? I should be able to supply the list of queries. The API should provide a fuzzy match capability, so that incorrect spellings do not matter. ( That is why an exact String matching algorithm is not sufficient)

A: 

The magic word here may be "regular expression" -- anything you can model as a finite state machine can be done with regular expressions.

Failing that, you might look into "digital search trees" or "tries".

Charlie Martin
@Charlie: Are there APIs available for building a Trie?
athena
http://code.google.com/p/patricia-trie/
Dilum Ranatunga
But tries are only useful if whatever you have typed is already spelled correctly.
Dilum Ranatunga
A: 

Some of the API's i can suggest are:

Similar SO Questions:

Emil
A: 

Perhaps a probabilistic algorithm using Soundex or a derivative would work? http://en.wikipedia.org/wiki/Soundex

Dilum Ranatunga