IBM Cloud Docs
Autocorrecting user input

Autocorrecting user input

Autocorrection fixes misspellings that users make in their requests. Corrected words are used to match to an action or an intent.

Autocorrection corrects user input in the following way:

  • Original input: letme applt for a memberdhip
  • Corrected input: let me apply for a membership

When your assistant evaluates whether to correct the spelling of a word, it does not rely on a simple dictionary lookup process. Instead, it uses a combination of natural language processing and probabilistic models to assess whether a term is, in fact, misspelled and should be corrected.

Autocorrection is enabled automatically for all English-language assistants. It is also available in French-language assistants, but is disabled by default. Autocorrection isn't available for any other languages.

Disabling autocorrection

If necessary, you can disable autocorrection for your assistant.

If you find that a domain-specific term is being corrected that shouldn't be, you can prevent the correction from happening by adding the term or phrase to your training data. For more information, see Autocorrection rules.

If you are using actions in your assistant, follow these steps to disable autocorrection:

  1. On the Actions page, click Global settings Gear icon.

  2. Click the Autocorrection tab.

  3. Set the switch to Off, then click Save.

If you are using dialog in your assistant, follow these steps to disable autocorrection:

  1. In the Options section, click Autocorrection.

  2. Set the switch to Off.

Testing autocorrection in dialog

If you are using dialog, you can test autocorrection by using Try it out.

  1. In Try it out, enter a request that includes some misspelled words.

    If words in your input are misspelled, they are corrected automatically, and an auto-correct icon is displayed. The corrected utterance is underlined.

  2. Hover over the underlined utterance to see the original wording.

If there are misspelled terms that you expected your assistant to correct, but it did not, then review the rules that your assistant uses to decide whether to correct a word to see if the word falls into the category of words that your assistant intentionally does not change.

Autocorrection rules

To avoid overcorrection, your assistant does not correct the spelling of the following types of input:

  • Capitalized words
  • Words with an uppercase character
  • Emojis
  • Locations, such as states and street addresses
  • Numbers and units of measurement or time
  • Proper nouns, such as common given names or company names
  • Text within quotation marks
  • Words containing special characters, such as hyphens (-), asterisks (*), ampersands (&), or at signs (@), including those used in email addresses or URLs.
  • Words that belong, meaning words that have implied significance because they occur in your action steps or dialog entity values, entity synonyms, or intent user examples.

How is spelling autocorrection related to fuzzy matching?

In dialog, fuzzy matching helps your assistant recognize dictionary-based entity mentions in user input. It uses a dictionary lookup approach to match a word from the user input to an existing entity value or synonym in the skill's training data. For example, if the user enters boook, and your training data contains a @reading_material entity with a book value, then fuzzy matching recognizes that the two terms (boook and book) mean the same thing.

In dialog, when you enable both autocorrection and fuzzy matching, the fuzzy matching function runs before autocorrection is triggered. If it finds a term that it can match to an existing dictionary entity value or synonym, it adds the term to the list of words that belong to the skill, and does not correct it.

For example, if a user enters a sentence like I wnt to buy a boook, fuzzy matching recognizes that the term boook means the same thing as your entity value book, and adds it to the protected words list. Your assistant corrects the input to be, I want to buy a boook. Notice that it corrects wnt but does not correct the spelling of boook. If you see this type of result when you are testing your dialog, you might think your assistant is misbehaving. However, your assistant is not. Thanks to fuzzy matching, it correctly identifies boook as a @reading_material entity mention. And thanks to autocorrection revising the term to want, your assistant is able to map the input to your #buy_something intent. Each feature does its part to help your assistant understand the meaning of the user input.