Automatic spell correction is available in Dialogflow API v2
2020 Update: It has been a while since I wrote this post. I have also confirmed with clients, and I can say that the autocorrect is now quite reliable. So you should use the feature, but remember that you don’t get the original query with the typo in the History and Training.
Recently, Dialogflow made an important improvement to their service. They provide automatic spelling correction if there are typos in the user’s message.
How to enable the feature
First, make sure you are using an agent which is on API v2.
Next, go to Settings > ML Settings and enable the Automatic Spell correction toggle.
How it works
So let us take a look at how well it works.
Regular (non-entity) words
Example 1: I introduce a typo in the Dialogflow simulatorYou can use the Simulator in both Dialogflow ES and Dialogfl... More for a regular (non-entity) word.
And Dialogflow is able to correct the spelling and produce the expected result.
Entity values
Can Dialogflow help with spell correction of entityBoth Dialogflow ES and Dialogflow CX support entities and th... More values too? Apparently, it can, but I found the behavior a little unpredictable.
Here is the entity element:
Example 2: Here, I introduce a typo in the word Carbon.
Which isn’t identified:
Example 3: Then I introduced another typo:
Which is corrected:
Should you start using the feature?
Personally, I am not sure if it is ready for production use.
Specifically, here are my concerns:
The entity autocorrect is not predictable
As you have seen above, it seems like there are some cases where the entity value is automatically corrected to the right spelling. But it doesn’t happen always, and the rules for when the spell correction gets triggered isn’t apparent.
There is no way to know if spell correction happened
It would be super useful to have a true/false value which specifies if some spell correction did happen.
In the best case, Dialogflow was correct, and you would still want to find out the mis-spelling, say if you want to add it to your own internal knowledge base or internal search engine. In the worst case, Dialogflow made a mistake and you can use it to decide if you want to turn the feature on/keep it turned on.
Even if the autocorrect feature isn’t turned on, Dialogflow can successfully map the intentBoth Dialogflow ES and Dialogflow CX have the concept of int... More on certain kinds of typos already (you can go and check this for yourself by omitting a vowel from a long-ish word). So having this data available will allow the developer to distinguish between the following scenarios:
- user made a typo, automatic spell correction wasn’t turned on, but Dialogflow got the mapping right
- user made a typo, automatic spell correction was turned on, Dialogflow got the mapping right because autocorrect was on
- user made a typo only in non-entity word, automatic spell correction was turned on, Dialogflow got the intent mapping right because of autocorrect
- user made a typo only in the entity word, spell correct was on, Dialogflow failed to get the intent mapping right (example 2 above)
- user made a typo only in entity word, spell correct was on, Dialogflow got intent mapping right (example 3 above) and extracted the entity value
It is possible I don’t have the exhaustive set of scenarios covered here, but hopefully you get the picture. Having knowledge of whether any spell correction was done will allow the developer to get a lot more insight into how Dialogflow works.
So my suggestion is to use it for your test agents at the moment, and then turn on the feature in your production bot once you have a good understanding of the overall effect of the spell correction.
Note: This is my old website and is in maintenance mode. I am publishing new articles only on my new website.
If you are not sure where to start on my new website, I recommend the following article:
Is Dialogflow still relevant in the era of Large Language Models?
Hi is there a way to turn off the spell checker of a specific intent?
Can you give me some more context? Why do you need to do this?
I have the same question. this looks not possible at the moment
In some cases, you can Disable the ML for a specific intent to get the expected behavior:
https://botflo.com/dialogflow-es-must-know-features/#10_Disable_ML