Spelling Error Correction Using a Nested RNN Model and Pseudo Training Data

Hao Li, Yang Wang, Xinyu Liu, Zhichao Sheng, Si Wei · DOI

Abstract

We propose a nested recurrent neural network (nested RNN) model for English spelling error correction and generate pseudo data based on phonetic similarity to train it. The model fuses orthographic information and context as a whole and is trained in an end-to-end fashion. This avoids feature engineering and does not rely on a noisy channel model as in traditional methods. Experiments show that the proposed method is superior to existing systems in correcting spelling errors.

Introduction

Spelling correction is a fundamental task in Natural Language Processing (NLP), yet it remains challenging due to the variety of error types. Errors are generally categorized into two groups:

  1. Non-word errors: Misspellings that result in a string not found in a dictionary (e.g., "teh" instead of "the").
  2. Real-word errors: Valid words used incorrectly in context (e.g., using "though" when "thought" was intended).

Traditional systems often rely on manual feature engineering or noisy channel models, which are difficult to scale. While modern Grammatical Error Correction (GEC) systems exist, they often lack sufficient human-annotated spelling data to perform optimally. This research introduces a standalone, neural-based spelling corrector designed to handle both error types through a unified architecture and a novel data generation strategy.

Methodology

The Nested RNN Architecture

The core of the proposed system is a "nested" architecture that processes text at two distinct levels to capture both internal word structure and external context.

  • CharRNN (Word-Level): A Gated Recurrent Unit (GRU) reads a word character-by-character. Unlike models that ignore character order, this captures the specific "shape" and orthography of the word.
  • WordRNN (Context-Level): This layer takes the vector representations from the CharRNN and processes the entire sentence using a Bidirectional GRU. This allows the model to evaluate whether a word fits its surrounding context, which is essential for identifying real-word errors.
The Nested RNN architecture combines character-level (CharRNN) and word-level (WordRNN) processing to generate a corrected output.

Phonetic Pseudo-Data Generation

To address the scarcity of labeled training data, the authors developed a method to generate high-quality pseudo-data based on phonetic similarity. Rather than introducing random character swaps, the method mimics human error patterns:

  1. Phonetic Mapping: A model maps words to their pronunciations (phonemes).
  2. Confusion Matrix: A matrix is constructed to identify characters that frequently produce similar sounds.
  3. Error Injection: Using the One Billion Word Benchmark, the authors introduced "smart" errors by replacing characters with phonetically similar alternatives (e.g., "understand" → "understend").

Experiments and Results

Datasets

The model was trained on the phonetically-augmented One Billion Word Benchmark. Evaluation was conducted on a specialized subset of the JFLEG (JHU FLuency-oriented Error Correction Group) dataset, consisting of 480 development and 432 test errors specifically annotated for spelling.

Performance

The Nested RNN significantly outperformed existing baselines, including dictionary-based tools and other neural architectures.

Performance comparison of the Nested RNN against baseline systems on the JFLEG development and test sets.

As shown in the results, the Nested RNN achieved a state-of-the-art $F_{0.5}$ score of 69.39 on the test set. It notably outperformed the LSTM-Char-CNN (64.75) and the psycholinguistics-based scRNN (64.04). Qualitatively, the model excelled at correcting real-word errors that dictionary-based systems like Enchant (54.32) typically miss because the erroneous words are technically valid English words.

Discussion and Limitations

The success of the model highlights the importance of phonetic similarity in training spelling correctors. By using RNNs instead of CNNs, the model maintains flexibility; while CNN kernels can be disrupted by a single character deletion, RNNs are better suited for sequential data where lengths may vary.

However, some limitations remain:

  • Vocabulary Constraints: The model uses a fixed output vocabulary. Misspellings of rare or technical words result in an "UNK" (Unknown) token, which the system currently handles by simply copying the source word.
  • One-to-One Mapping: The architecture assumes each input word maps to one output word, making it less effective for errors involving accidental word splits or joins.

Future work will focus on improving "copy mechanisms" for unknown words and exploring open-vocabulary approaches to handle technical terminology.

Summary updated

Abstract

We propose a nested recurrent neural network (nested RNN) model for English spelling error correction and generate pseudo data based on phonetic similarity to train it. The model fuses orthographic information and context as a whole and is trained in an end-to-end fashion. This avoids feature engineering and does not rely on a noisy channel model as in traditional methods. Experiments show that the proposed method is superior to existing systems in correcting spelling errors.
BibTeX
@misc{li2018spelling,
  author = {Hao Li and Yang Wang and Xinyu Liu and Zhichao Sheng and Si Wei},
  title = {{Spelling Error Correction Using a Nested RNN Model and Pseudo Training Data}},
  year = {2018},
  eprint = {1811.00238},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1811.00238},
}
Figure