Introduction
The development of robust Natural Language Processing (NLP) models for Spelling and Grammatical Error Correction (GEC) is currently bottlenecked by a shortage of high-quality, large-scale datasets of natural human errors. Existing resources often rely on synthetic "pseudo-errors" or noisy Wikipedia edit histories. Synthetic errors frequently fail to replicate the nuances of human mistakes, while Wikipedia data is often contaminated with vandalism or "semantic rewrites"—edits that change meaning rather than fixing mechanical errors. To address this, we present the GitHub Typo Corpus, a massive multilingual dataset harvested from the natural correction cycles of open-source software development.
Methodology: The Extraction Pipeline
GitHub serves as an ideal source for natural language corrections because of its structured version control and the prevalence of peer-reviewed documentation. The authors developed a sophisticated pipeline to isolate genuine typos from the millions of commits pushed to the platform.
The pipeline consists of four primary stages:
- Repository Selection: The authors targeted active, high-quality repositories (50+ stars) with permissive licenses.
- Commit Extraction: They specifically targeted commits where the message contained the word "typo," extracting the line-by-line "diffs" (the before-and-after states of the text).
- Language Filtering: To distinguish natural language from source code, the system uses a Gated Convolutional Neural Network (NanigoNet). This ensures the dataset contains human language and that the source and target languages match.
- Typo Classification: Because "typo" commits often include unrelated semantic changes, a logistic regression classifier was trained to identify "true typos." This model uses three key features: the ratio of language model perplexity (calculated via a character-level LSTM), normalized edit distance, and a flag for purely numerical changes.
Dataset Characteristics
The resulting GitHub Typo Corpus contains over 350,000 edits, with approximately 260,000 classified as true typos, spanning more than 15 languages. While English is the most represented language (255k edits), the corpus includes significant data for Simplified Chinese (3.1k) and Japanese (1.5k).
The dataset categorizes errors into four distinct types:
- Mechanical: Errors involving punctuation, capitalization, or formatting.
- Spell: Traditional misspellings of words.
- Grammatical: Errors in syntax or word choice that affect the grammatical structure (e.g., confusing "its" and "it's").
- Semantic: Edits that alter the meaning of the sentence. While these are collected, they are typically excluded from the "true typo" count to maintain dataset purity for correction tasks.
Results and Evaluation
The authors' simplified classification approach proved highly effective. The 3-feature logistic regression model achieved impressive F1 scores: 0.917 for English, 0.896 for Chinese, and 0.933 for Japanese. This demonstrates that simple linguistic features like perplexity and edit distance are powerful indicators of whether an edit is a correction or a rewrite.
Furthermore, the study benchmarked popular open-source spell checkers, Aspell and Enchant, against the English spelling errors in the corpus. Both tools performed poorly, achieving F0.5 scores of only 0.577 and 0.521, respectively. This suggests that real-world typos found in technical documentation and commit histories are significantly more diverse and challenging than those found in standard benchmarks.
Conclusion
The GitHub Typo Corpus represents a significant step forward in providing the NLP community with realistic, large-scale data for error correction. By leveraging the inherent quality control of the GitHub ecosystem, the authors have produced a dataset that is both cleaner and more representative of actual human error than previous alternatives. Future efforts will focus on expanding the dataset's linguistic diversity by identifying typo-fixing commits using non-English keywords.
Summary updated