# 拼写检查器

拼写检查器是一种软件，用于识别文本中拼写不正确的单词，并在许多实现中为其提供修改建议。拼写检查器出现在文字处理器、浏览器、搜索引擎和开发环境中，是信息检索、机器翻译和文本抽取等自然语言处理流程的基础组件。

| 关键事实 | 详情 |
|---|---|
| 错误类型 | 非词错误，即该词根本不在语言词汇表中；以及真词错误，即该词本身有效但不合语境<sup>[1](https://www.microsoft.com/en-us/research/blog/speller100-zero-shot-spelling-correction-at-scale-for-100-plus-languages/)</sup> |
| 主要错误模式 | 对大型文本文件的分析发现，80%至95%的拼写错误与正确拼写仅在某一种方式上不同：错一个字母、少一个字母、多一个字母或字母换位<sup>[2](https://titan.dcs.bbk.ac.uk/~roger/spellchecking.html)</sup> |
| 奠基论文 | 弗雷德·J·达梅劳（Fred J. Damerau），《一种计算机检测与纠正拼写错误的技术》，《ACM通讯》7(3)，171–176，1964年3月；其方法假设每个非词典词至多含一个错误，在测试运行中对超过95%的此类错误类型做出了正确识别<sup>[3](https://cir.nii.ac.jp/crid/1361137045892695424)</sup> |
| 核心统计框架 | 噪声信道模型，将拼错的词视为目标词的受损版本，并将错误模型与语言模型相结合<sup>[4](https://aclanthology.org/H05-1120.pdf)</sup> |
| 广泛使用的开源引擎 | Hunspell，LibreOffice、OpenOffice.org、Mozilla Firefox和Thunderbird以及Google Chrome的拼写检查器，也被macOS、InDesign、memoQ、Opera和SDL Trados使用<sup>[5](https://hunspell.github.io/)</sup> |
| 搜索引擎规模 | 在微软Bing，约15%的提交查询包含拼写错误，使拼写纠正成为搜索栈中的第一个组件<sup>[1](https://www.microsoft.com/en-us/research/blog/speller100-zero-shot-spelling-correction-at-scale-for-100-plus-languages/)</sup> |

## 拼写检查器的工作原理

**检测。** 文本被分词，每个词都与一组正确拼写的参考词或其统计数据进行比对。词典中不存在的词被标记为潜在的非词错误<sup>[6](https://arxiv.org/abs/2410.23514)</sup>。真词错误更难处理：单词拼写正确，但不是作者想要的词，例如同音词误打，传统的词典查找无法检测到它<sup>[7](https://arxiv.org/abs/2302.06407)</sup>。

**候选生成。** 对于被标记的词，检查器生成一组在词汇上最接近它的词典词，最常见的是通过编辑距离，即将一个字符串转换为另一个字符串所需的最少单字符插入、删除、替换或换位次数。最小编辑距离方法被描述为研究最多、使用最广的拼写检查方法<sup>[8](https://nadre.ethernet.edu.et/record/19291/files/Hayu%20Bakele.pdf)</sup>。一种互补方法使用k元语法重叠，比较构成错误词和候选词典词的短字符序列<sup>[9](https://www-nlp.stanford.edu/IR-book/html/htmledition/spelling-correction-1.html)</sup>。

**排序。** 候选词被打分并排序。在噪声信道框架中，检查器选择使候选词的语言模型概率与观察到字符串由该词产生的错误模型概率之组合最大化的纠正<sup>[4](https://aclanthology.org/H05-1120.pdf)</sup>。[彼得·诺维格](https://www.edgepedia.org/zh/peter-norvig)（Peter Norvig）被广泛研究的30行纠正器说明了简单模型的权衡：它在270项开发集上达到75%的准确率，在400项最终测试集上达到68%，诺维格认为，准确率达到90%的纠正器需要使用周围词的上下文<sup>[10](https://www.norvig.com/spell-correct.html)</sup>。他的例子说明了原因：“adres”应变为“address”而非更接近的“acres”，而“thear”应根据句子变为“there”或“their”<sup>[10](https://www.norvig.com/spell-correct.html)</sup>。

**真词纠正。** 纠正真词错误的方法分为基于资源和基于统计两大类。基于资源的方法使用WordNet中的语义距离度量来寻找与其邻词语义距离较远的词；如果某个拼写变体更符合语境，则假设原词是错误。统计方法用n元语言模型重建候选句子并打分，对梅斯（Mays）、达梅劳和默瑟（Mercer）三元模型的重审表明它优于基于资源的方法<sup>[11](https://www.cs.toronto.edu/~gh/research-pages/research-spelling-correction.html)</sup>。

## 历史

计算语言学中的拼写检查研究可追溯到1961年，当时开发了第一个具有拼写检查能力的手写识别器<sup>[12](https://doi.org/10.1155/2023/7625785)</sup>。该领域的奠基论文是达梅劳1964年发表在《ACM通讯》上的文章，它假设词典中找不到的词至多含一个错误——错一个字母、少一个字母、多一个字母或一次换位——并在每种假设下将输入与词典重新比对<sup>[3](https://cir.nii.ac.jp/crid/1361137045892695424)</sup>。一篇相关综述指出，据报告达梅劳的四种错误类型占错误的80%<sup>[13](https://jklp.org/profession/papers/spell/paper.html)</sup>。

一系列早期实用软件在斯坦福人工智能实验室运行，那里约1967年编写了用于PDP-6上[Lisp](https://www.edgepedia.org/zh/lisp-programming-language)文本的拼写检查器，而拉尔夫·戈林（Ralph Gorin）1971年编写的SPELL程序被描述为ispell的直接祖先，也是第一个为检查文本文档拼写而编写的计算机程序<sup>[14](https://jklp.org/profession/papers/spell/ispell.html)</sup>。

统计方法通过噪声信道框架成熟起来。埃里克·布里尔（Eric Brill）和罗伯特·C·摩尔（Robert C. Moore）2000年的ACL论文《一种改进的噪声信道拼写纠正错误模型》改进了用于加权编辑操作的错误模型<sup>[15](https://aclanthology.org/P00-1037/)</sup>。1997年，[Microsoft Word](https://www.edgepedia.org/zh/microsoft-word) 97引入了基于完整自然语言处理系统的[语法检查器](https://www.edgepedia.org/zh/grammar-checker)，将自动校对扩展到孤立词之外<sup>[16](https://www.microsoft.com/en-us/research/?p=939033)</sup>。

## 形态学与形态丰富的语言

要求列出每个有效词形的简单词典查找，对于构词丰富的语言效果不佳。在黏着语中，词的概念远比词典条目宽泛，因为派生和屈折词缀能产性地创造新形式<sup>[17](https://arxiv.org/abs/cmp-lg/9410004)</sup>。

凯马尔·奥夫拉泽（Kemal Oflazer）1994年针对土耳其语的方法将双层形态学——一种关于表层字母如何对应底层词汇形式的形式模型——与动态规划搜索算法相结合。在实验中，当编辑距离为1时，95%的情况下找到了目标正确词，74%的情况下将其作为第一候选提供<sup>[17](https://arxiv.org/abs/cmp-lg/9410004)</sup>。

**基于形态学的词典。** 基于形态学的拼写检查器将词典查找与语言的形态学属性结合，以减小词典规模，同时处理屈折、派生和复合。2023年为资源匮乏语言达乌罗图瓦语（Dawurootsuwa）构建的拼写检查器采用Hunspell词典格式，包含5000个词根和2500多条形态学规则，在3156个不同的词上进行了测试<sup>[12](https://doi.org/10.1155/2023/7625785)</sup>。类似工作利用派生来减少需比较的词数：一个阿拉伯语拼写检查器调整了莱文斯坦算法以纠正派生词，因为大多数阿拉伯语词是派生的，并组织词典以最小化比较次数<sup>[18](https://www.sciencedirect.com/science/article/pii/S187705091830111X)</sup>。研究还为[世界语](https://www.edgepedia.org/zh/esperanto)（Esperanto）制作了形态学拼写检查词典，其黏着性质使词缀规则文件成为识别复杂词的机制<sup>[19](https://nlp.fi.muni.cz/raslan/2009/papers/15.pdf)</sup>；并为巴斯克语（Basque）等高屈折语言建立了将双层形态学描述转换为Hunspell格式的流程<sup>[20](https://ixa.ehu.eus/sites/default/files/dokumentuak/3334/pdf.pdf)</sup>。

## 神经与上下文拼写检查

[深度学习](https://www.edgepedia.org/zh/deep-learning)改变了拼写检查的架构和数据经济学。2024年一个针对斯洛文尼亚语的神经拼写检查器，将基于大型形态学词典的传统快速词级检查器与在人工插入了错误的大型语料上训练的语言模型进行了比较；合成数据构建被证明是关键组件，神经模型在精确率和召回率上均显著优于斯洛文尼亚语所有现有拼写检查器<sup>[6](https://arxiv.org/abs/2410.23514)</sup>。

**零样本多语言纠正。** 微软的Speller100于2021年部署在Bing中，将拼写纠正从约二十几种语言扩展到100多种。它将拼写纠正框定为字符级序列到序列去噪自编码器问题，受Facebook AI Research的BART启发但在字符级操作，噪声函数生成轮换、插入、删除和替换错误。由于噪声函数消除了对拼错查询语料的需求，普通爬取的网络文本足以用于预训练，而基于语系的零样本学习使模型能够纠正没有语言特定标注数据的语言。预训练任务在零训练数据的语言中，对首选候选达到了50%的纠正召回率<sup>[1](https://www.microsoft.com/en-us/research/blog/speller100-zero-shot-spelling-correction-at-scale-for-100-plus-languages/)</sup>。

**上下文模型。** BERT等预训练语言模型提供了单词纠正器所缺乏的上下文。将BERT上下文词嵌入与编辑距离算法相结合的实验表明，该组合能够有效纠正拼写错误<sup>[21](https://arxiv.org/abs/2101.03204)</sup>。大型语言模型也被直接应用：2025年一项研究发现，OpenAI的GPT-4o为纠正开放式调查回复中的拼写错误提供了一种灵活、低成本的方式，在处理上下文、同音词（如“capitol”与“capital”）以及通过指令定制方面具有优势<sup>[22](https://journals.sagepub.com/doi/10.1177/20531680241311510)</sup>。

## 应用

**搜索引擎。** 由于拼错的查询会匹配错误的文档并触发错误答案，拼写纠正位于Bing搜索栈的前端<sup>[1](https://www.microsoft.com/en-us/research/blog/speller100-zero-shot-spelling-correction-at-scale-for-100-plus-languages/)</sup>。搜索引擎还将查询纠正作为用户体验的一部分，将“britian spears”和“prittany spears”等变体视为“britney spears”的拼写错误<sup>[9](https://www-nlp.stanford.edu/IR-book/html/htmledition/spelling-correction-1.html)</sup>。

**写作工具与开发环境。** 文字处理器、浏览器和办公套件嵌入了带有用户词典的拼写检查器，用于专有名词和技术术语<sup>[5](https://hunspell.github.io/)</sup>。[Visual Studio](https://www.edgepedia.org/zh/visual-studio)的拼写检查器应用代码特定的启发式规则，在HelloWorld等标识符内部的大写字母处将标识符拆分为词，去除首尾数字和标点，并忽略三个字符或更少的片段<sup>[23](https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=visualstudio)</sup>。自动写作评估研究发现，在修改后，加入拼写和语法反馈在五个作文子量表（包括书写规范、用词和组织）上产生了小而显著的提升<sup>[24](https://www.sciencedirect.com/science/article/pii/S1075293522000046)</sup>。

**语音识别与下游自然语言处理。** 应用于端到端语音识别输出的上下文拼写纠正模型，相对于基础系统实现了高达51%的相对词错误率降低，优于传统的偏置方法<sup>[25](https://www.microsoft.com/en-us/research/publication/towards-contextual-spelling-correction-for-customization-of-end-to-end-speech-recognition-systems/?lang=zh-cn)</sup>。拼写检查器还作为信息检索、机器翻译和文本抽取的预处理步骤<sup>[26](https://discovery.dundee.ac.uk/ws/portalfiles/portal/161358770/A_Neuro-Symbolic_Approach_to_Address_Sandhi_and_Context-Sensitive_Errors_in_Tamil_PhD_Thesis.pdf)</sup>。

## References

1. [Speller100: Zero-shot spelling correction at scale for 100-plus languages, Microsoft Research](https://www.microsoft.com/en-us/research/blog/speller100-zero-shot-spelling-correction-at-scale-for-100-plus-languages/)
2. [Spellchecking by computer, Roger Mitton, Birkbeck](https://titan.dcs.bbk.ac.uk/~roger/spellchecking.html)
3. [Damerau, F. J. (1964). A technique for computer detection and correction of spelling errors, CiNii record](https://cir.nii.ac.jp/crid/1361137045892695424)
4. [Spelling correction and the noisy channel model, ACL proceedings](https://aclanthology.org/H05-1120.pdf)
5. [Hunspell: About](https://hunspell.github.io/)
6. [Klemen et al. (2024). Neural spell-checker: Beyond words with synthetic data generation, arXiv](https://arxiv.org/abs/2410.23514)
7. [Correcting Real-Word Spelling Errors: A New Hybrid Approach, arXiv](https://arxiv.org/abs/2302.06407)
8. [N-Gram Analysis Technique for Spelling Checker, NAiDRE record](https://nadre.ethernet.edu.et/record/19291/files/Hayu%20Bakele.pdf)
9. [Spelling correction, Introduction to Information Retrieval, Stanford](https://www-nlp.stanford.edu/IR-book/html/htmledition/spelling-correction-1.html)
10. [Norvig, P. How to Write a Spelling Corrector](https://www.norvig.com/spell-correct.html)
11. [Intelligent spelling correction, University of Toronto](https://www.cs.toronto.edu/~gh/research-pages/research-spelling-correction.html)
12. [Gamu et al. (2023). Morphology-Based Spell Checker for Dawurootsuwa Language, Scientific Programming](https://doi.org/10.1155/2023/7625785)
13. [Peterson, J. L. (1980). Computer Programs for Detecting and Correcting Spelling Errors](https://jklp.org/profession/papers/spell/paper.html)
14. [Ispell history, jklp.org](https://jklp.org/profession/papers/spell/ispell.html)
15. [Brill, E. and Moore, R. C. (2000). An Improved Error Model for Noisy Channel Spelling Correction, ACL](https://aclanthology.org/P00-1037/)
16. [Achieving Zero-COGS with Microsoft Editor Neural Grammar Checker, Microsoft Research](https://www.microsoft.com/en-us/research/?p=939033)
17. [Oflazer, K. (1994). Spelling Correction in Agglutinative Languages, arXiv](https://arxiv.org/abs/cmp-lg/9410004)
18. [The vocabulary and the morphology in spell checker, Procedia Computer Science](https://www.sciencedirect.com/science/article/pii/S187705091830111X)
19. [Morphology-Aware Spell-Checking Dictionary for Esperanto, RASLAN 2009](https://nlp.fi.muni.cz/raslan/2009/papers/15.pdf)
20. [Spelling Correction: from two-level morphology to open source, IXA](https://ixa.ehu.eus/sites/default/files/dokumentuak/3334/pdf.pdf)
21. [Misspelling Correction with Pre-trained Contextual Language Model, arXiv](https://arxiv.org/abs/2101.03204)
22. [Allamong et al. (2025). Spelling correction with large language models in survey responses, SAGE](https://journals.sagepub.com/doi/10.1177/20531680241311510)
23. [Learn about the Spell Checker, Visual Studio documentation](https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=visualstudio)
24. [Automated writing evaluation: Does spelling and grammar feedback support high-quality writing and revision?](https://www.sciencedirect.com/science/article/pii/S1075293522000046)
25. [Towards Contextual Spelling Correction for Customization of End-to-End Speech Recognition Systems, Microsoft Research](https://www.microsoft.com/en-us/research/publication/towards-contextual-spelling-correction-for-customization-of-end-to-end-speech-recognition-systems/?lang=zh-cn)
26. [A Neuro-Symbolic Approach to Address Sandhi and Context-Sensitive Errors in Tamil, PhD thesis](https://discovery.dundee.ac.uk/ws/portalfiles/portal/161358770/A_Neuro-Symbolic_Approach_to_Address_Sandhi_and_Context-Sensitive_Errors_in_Tamil_PhD_Thesis.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › 语言与视觉人工智能 › 自然语言处理 › NLP软件、人物与社区 › 专用NLP软件与应用

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/spell-checker

English original: https://www.edgepedia.org/spell-checker
