[Paper Review] Misspelling Correction with Pre-trained Contextual Language Model
This paper proposes a contextual spelling correction method using BERT's masked language modeling capability combined with edit distance for candidate ranking. It demonstrates that pre-trained BERT, without fine-tuning, effectively corrects both non-word and real-word spelling errors by leveraging contextual embeddings and edit distance, achieving robust performance even on noisy, multi-error sentences from informal sources.
Spelling irregularities, known now as spelling mistakes, have been found for several centuries. As humans, we are able to understand most of the misspelled words based on their location in the sentence, perceived pronunciation, and context. Unlike humans, computer systems do not possess the convenient auto complete functionality of which human brains are capable. While many programs provide spelling correction functionality, many systems do not take context into account. Moreover, Artificial Intelligence systems function in the way they are trained on. With many current Natural Language Processing (NLP) systems trained on grammatically correct text data, many are vulnerable against adversarial examples, yet correctly spelled text processing is crucial for learning. In this paper, we investigate how spelling errors can be corrected in context, with a pre-trained language model BERT. We present two experiments, based on BERT and the edit distance algorithm, for ranking and selecting candidate corrections. The results of our experiments demonstrated that when combined properly, contextual word embeddings of BERT and edit distance are capable of effectively correcting spelling errors.
Motivation & Objective
- To investigate whether pre-trained BERT can effectively correct spelling errors in context without fine-tuning.
- To evaluate the effectiveness of combining BERT’s contextual embeddings with edit distance for ranking correction candidates.
- To assess BERT’s robustness in correcting misspellings within sentences containing multiple errors or informal language.
- To explore the potential of BERT as a universal model for correcting various types of linguistic errors beyond spelling.
- To examine the feasibility of extending BERT to both detect and correct spelling errors in a single pipeline.
Proposed method
- Utilize BERT’s masked token prediction to generate candidate corrections for misspelled words.
- Generate candidate corrections using edit distance (e.g., Levenshtein distance) within a small threshold (≤2) from the misspelled word.
- Rank the candidate corrections based on BERT’s predicted probability for each candidate at the masked token position.
- Select the highest-probability candidate as the final correction.
- Test the method on real-world, non-native English text with multiple errors, including informal and punctuational noise.
- Evaluate performance using standard metrics, treating both non-word and real-word errors under a unified framework.
Experimental results
Research questions
- RQ1Can BERT’s masked language modeling capability effectively correct spelling errors in context without fine-tuning?
- RQ2How does combining BERT’s contextual embeddings with edit distance improve correction accuracy compared to either method alone?
- RQ3To what extent is BERT robust when correcting misspellings in sentences with multiple errors or informal language?
- RQ4Can the same framework correct both non-word and real-word spelling errors effectively?
- RQ5Is it feasible to extend BERT to detect spelling errors and correct them in a single unified pipeline?
Key findings
- BERT demonstrated strong performance in correcting spelling errors using only its pre-trained weights, without any fine-tuning.
- The combination of BERT’s contextual prediction and edit distance significantly improved correction accuracy over baseline methods.
- BERT successfully corrected misspellings even in sentences with multiple errors and informal language, showing high robustness.
- The method achieved effective correction of both non-word errors (e.g., 'acsese' → 'access') and real-word errors (e.g., 'exibitions' → 'exhibitions').
- BERT was able to correctly predict corrections in complex, noisy social media-style text where punctuation and grammar were inconsistent.
- The approach showed promise for generalization to other error types, such as syntax errors, by framing them as masked prediction tasks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.