Context Spell Checker for the English Language


Spell Checker is a sequence-to-sequence model that detects and corrects spelling errors in your input text. It’s based on Levenshtein Automaton for generating candidate corrections and a Neural Language Model for ranking corrections.

Live Demo Download Copy S3 URI

How to use

The model works at the token level, so you must put it after tokenization. The model can change the length of the tokens when correcting words, so keep this in mind when using it before other annotators that may work with absolute references to the original document like NerConverter.

documentAssembler = DocumentAssembler()\

tokenizer = RecursiveTokenizer()\
.setPrefixes(["\"", "“", "(", "[", "\n", "."]) \
.setSuffixes(["\"", "”", ".", ",", "?", ")", "]", "!", ";", ":", "'s", "’s"])

spellModel = ContextSpellCheckerModel\
val assembler = new DocumentAssembler()

val tokenizer = new RecursiveTokenizer()
.setPrefixes(Array("\"", "“", "(", "[", "\n", "."))
.setSuffixes(Array("\"", "”", ".", ",", "?", ")", "]", "!", ";", ":", "'s", "’s"))

val spellChecker = ContextSpellCheckerModel.
import nlu
nlu.load("spell").predict("""]) \

Model Information

Model Name: spellcheck_dl
Compatibility: Spark NLP 3.0.0+
License: Open Source
Edition: Official
Input Labels: [token]
Output Labels: [corrected]
Language: en

Data Source

American National Corpus.