Autocorrect as you type functionality (beta) was released on Friday 13 Aug as a part of the WebSpellChecker v5.15.0 release. Autocorrect automatically makes or suggests corrections for common spelling mistakes while users are typing.
It is a new feature enabled for:
- WProofreader core (e.g. WProofreader add-on for RTEs, plugin for WordPress, plugin for CKEditor 5, browser extension);
Autocorrect is enabled by default using the new WProofreader API option autocorrect.
The feature is available for all languages where spelling is supported (excluding Japanese and Chinese).
For the 12 most popular languages (AI-based English, Ai-based German, American English, British English, Canadian English, French, Spanish, Italian, Swedish, German, Dutch, Greek) autocorrect is based on the replaced_data statistics from our databaseDB with word pairs that will be used initially for autocorrect check in case of the Cloud version and extracted *.cvs files for the Server version. Autocorrect for other languages generates suggestions purely from spell-check dictionaries.
While the Server client can configure what languages should have autocorrect enabled using AppServerX.xml.
There is an known issue with how the autocorrect functionality works in the Firefox and CKEditor 5 bundle. It's limited to some cases where a misspelled word is followed by a comma or other punctuation symbol (while it is supposed to work with 'space'). Due to certain specifics of CKEditor 5, we are not able to fix that right away but it is in our plans.
The autocorrect mechanism
The trigger action that starts autocorrection - the user types a word and presses space key or comma.
Algorithm behind autocorrect is relying on a similarity score (Levenshtein distance). If the condition is not met, we return an empty response -> no autoreplace.
Also, there is an additional check for the languages that use replaced_data statistics file, the algorithm will check if the word for replace is present in one of the available dictionaries: language dictionary, user or company custom dictionary. If a word is not present in the dictionary, we will not use the word from the autocorrect file.
In case of auto detected language, autocorrect uses the last detected language as a language for autocorrect check.
The user can undo the correction using the Revert option. For now Revert isn't localized and valid only for the current section.
Some clients may want to have their own lists for autocorrection. This option will be available for the Server clients only, Cloud customers may report the most common corrections and we will add them manually.
How the autocorrect works
The user is typing text and Autocorrect automatically makes or suggests corrections for common spelling mistakes like hte-the, havent-haven’t, isnt-isn’t.
The autocorrected word will be underlined with a gray dotted line. End users have an option to revert/undo the correction by hovering on it and selecting the original word.
Also, users can enable/disable Autocorrect in the Settings dialog of the product with a toggle “Correct spelling automatically”.
Check how it works in the video below or play with demos here.
How to configure Autocorrect
Admins can disable autocorrect by default by adding autocorrect option set to false to WEBSPELLCHECKER_CONFIG. In this case end users still will have an option to enable autocorrect from UI of the Settings dialog.
This option as well as all other options for WProofreader are available in the WProofreader API options.