Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Test project.
Pull request Compare This branch is 9 commits behind inetis:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Autocomplete (word completeion) function predicts word user intended to type in the search box.

Autocomplete takes a dictionary of weighted words and produces a list of suggestions for user's query.

The results on cities database:

query       suggestions
Lis Agne    Los Angeles, Los Angelitos, Les Agnels, Les Agneliers, Les Agneliers Bas
nw yr       New York, Nwoya, Nweyon, Na Yan, Nwarem
cpenh       Copenhagen, Cepni, Spencer, Cienega, Cuenha

Autocomplete is implemented in C++. Use it as follows:

TAutocomplete ac;
ac.load("cities.txt");                 // load dictionary once
vector<string> suggestions;            // autocomplete suggestions

ac.autocomplete("cpenh", suggestions); // find suggestions for input
                                       // query "cpenh"; max number
                                       // of sugegstions (default 5)
                                       // can be set as the last
                                       // parameter of the method`

See also:

Something went wrong with that request. Please try again.