Automatically populate sentences using Java

Suppose I have about 1000 sentences that I want to offer as sentences when a user enters text in a field.

I thought about starting lucene in memory search, and then served the results in suggestions set.

triggerto start the search will be space charand exit from the input field.

I intend to use this with GWTso that the client simply receives the results from the server.

I do not want to do what Google does; where they fill out each word and make suggestions for each set of keywords. I just want to check the keywords and make suggestions based on this. For example, when I print the title for a question here in stackoverflow.

Has anyone done something like this before? Is there a library that I could use?

+3
source share
2 answers

If you have only 1000 sentences, you probably do not need a powerful index like lucene. I’m not sure if you want to make the sentences “complete the sentence” or “offer other requests containing the same keywords”. Here are solutions for both:

, , SortedSet tailSet, , "", ( A, B "", B). , tailSet, , inputString.length() . , inputString.length() .

" ", , . , HashMap<String,Set<String>>, , . , .

, , (, ). , . - , ? , .

+1

. .

+2

All Articles