Creating an Autocomplete Dictionary

In order to provide autocomplete suggestions to the user, these suggestions must be identified and stored as phrases that can be searched and returned to the user. This is done by creating an autocomplete dictionary, adding input sources, building the output dictionary, and specifying the dictionary in the display or API.

Note: Autocomplete dictionaries share many features with standard Watson Explorer Engine dictionaries. If you have already worked with dictionaries, the concepts discussed here will be familiar.

To create an autocomplete dictionary, click the () icon next to the Dictionaries link of the left-side navigation bar. This will display the New Dictionary screen as shown in Figure 1.

Figure 1. Creating an Autocomplete Dictionary

For the purposes of this tutorial, enter autocomplete-tutorial-dictionary into the name field, select base-autocomplete from the Copy defaults from drop down menu, and click on the Add button.

Note: We are using the base-autocomplete defaults when creating this dictionary because most autocomplete dictionaries require defaults that differ from the default values used by standard dictionaries. The defaults that differ are:

Should Tokenize is disabled. This instructs the Watson Explorer Engine to retain each phrase as a single entry into the dictionary rather than splitting phrases into individual words.

Prune Size is set to 1 because many autocomplete phrases that we want to be able to suggest will be encountered only once in the input. Setting a higher Prune Size could result in a very small autocomplete dictionary but could limit suggestions to common phrases only if your input is noisy.