# Metaphone

**Metaphone** 是劳伦斯·菲利普斯（Lawrence Philips）于1990年12月发表的一种语音算法，它按照发音对英语单词进行编码，使发音相近的单词和姓名获得相同的编码键，从而在拼写不同的情况下仍能相互匹配。它的设计目的是取代1918年问世的旧式语音编码 [Soundex](https://www.edgepedia.org/zh/soundex)，它编码了更广泛的英语发音规则，生成的编码键长度可变，而非固定长度。<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup><sup> • </sup><sup>[2](https://www.gov.uk/government/publications/joined-up-data-in-government-the-future-of-data-linking-methods/glossary)</sup>

| 关键事实 | 详情 |
|---|---|
| 作者与发表 | 劳伦斯·菲利普斯，《Hanging on the Metaphone》，《Computer Language》，第7卷第12期，1990年12月，第39–43页<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup> |
| 用途 | 语音编码：发音相近的单词获得相同的键，从而对拼写不同的单词和姓名进行模糊匹配<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup> |
| 音素集 | 将字母表缩减为16个辅音音素：B F H J K L M N P R S T W X Y 0，其中0（零）代表“th”音<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup> |
| 键长 | 除非单词以元音开头，否则只编码前四个辅音音素；“Stephan”编码为STFN<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup> |
| 后继版本 | Double Metaphone（2000年）针对歧义发音返回一个主键和一个次键；在10万个最常见的美国姓氏中，约10%会产生两个键<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup> |
| 第三代 | Metaphone 3于2009年10月发布，号称比Double Metaphone准确性和灵活性大幅提高，但不是自由软件<sup>[4](https://aspell.sourceforge.net/metaphone/)</sup> |
| 典型用途 | 拼写检查器、搜索界面、去重程序、家谱网站和记录链接<sup>[4](https://aspell.sourceforge.net/metaphone/)</sup><sup> • </sup><sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC3688507/)</sup> |

## 算法原理

Metaphone属于一类称为语音编码或“谐音”算法的算法，是模糊匹配的一种启发式形式。该算法以单词或姓名为输入，返回一个编码键，发音相近的单词应得到相同的键，从而允许合理程度的模糊性。由于只编码前四个辅音音素（除非首字母是元音），“Stephan”变为STFN；而“Steven”和“Stefan”发音相近，因此这些拼写也能被找到；Soundex对英语拼写的特殊之处知之甚少，无法匹配它们。<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

美国国家医学图书馆的Lexical Tools实现详细记录了该算法：它首先对输入进行预处理，去除非字母字符并将字符串转为大写，然后应用首字母例外规则：以KN、GN、PN、AE或WR开头的单词去掉第一个字符，首字母X变为S，词首的WH变为W。剩余的词项按照典型英语口语的语音规则缩减为1到6个字符的编码（可配置）。<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup> 16个符号的输出字母表中包括代表“sh”音的X和代表“th”的0（零）。<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup><sup> • </sup><sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

## 起源与设计目标

菲利普斯1990年在《Computer Language》杂志上发表Metaphone，明确将其作为Soundex的替代品——Soundex是第一个为匹配拼写不同的姓名而设计的算法。Soundex简单，但在菲利普斯看来，它常常无法返回与搜索字符串发音相近的备选结果。Metaphone编码了Soundex未涵盖的许多英语发音常见规则，例如字母“C”何时读作“S”、何时读作“K”。菲利普斯后来承认，Metaphone在相似性维度上提高了命中率，但由于他自己的设计决策，牺牲了一些模糊性。<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

此后十年间用户报告了若干缺陷。姓名Bryan（BRYN）无法匹配Brian（BRN），菲利普斯称之为设计缺陷；MacCafferey先生被编码为MKKF，这是一个明显的程序错误；而且由于Metaphone保留了Soundex保留首字母的做法（针对元音开头的单词），“Otto”无法匹配“Auto”。<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

## Double Metaphone

2000年6月，菲利普斯在《C/C++ Users Journal》上发表了Double Metaphone搜索算法，这是重做后的版本，对于可能有多种合理发音的单词和姓名，返回两个键——一个主键和一个次键。改动包括：所有元音开头的单词以“A”开头编码，去掉“Y”和“W”（它们总可以用元音拼写），不再分别编码“B”和“P”。<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

双键设计针对的是美国用法中积累的来自众多语言背景的姓名。例如，“Kuczewski”按美式发音（“Kuhzooski”）返回KSSK，按波兰式发音“Kutchefski”返回KXFS。第一个键给出在美国最可能听到的发音，第二个键给出母语发音。当前版本考虑了来自意大利语、西班牙语、法语以及多种日耳曼语和斯拉夫语的姓名的替代发音，外加少数英语例外，如“Thames”和“sugar”。它还包括对家谱研究有用的“词源”变体，使“Schm-”和“-wicz”等辅音组合匹配到其常见的英语化形式，从而让“Smith”匹配“Schmidt”、“Filipowicz”匹配“Philipowitz”、“Jablonski”匹配“Yablonsky”。在菲利普斯包含10万个最常见美国姓氏的样本数据库中，只有约10%的姓名产生一个以上的键；对于词典单词，这一比例可能小得多。<sup>[3](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)</sup>

第三代Metaphone 3于2009年10月宣布，由Anthropomorphic Software商业提供，号称比Double Metaphone准确性和灵活性大幅提高；与前两代不同，它不是自由软件。<sup>[4](https://aspell.sourceforge.net/metaphone/)</sup>

## 与其他语音算法的比较

后来大多数语音算法所基于的三种算法是Soundex、NYSIIS（纽约州识别与情报系统编码）和Metaphone。<sup>[6](https://digitalcommons.uri.edu/srhonorsprog/888/)</sup> 2020年[罗德岛大学](https://www.edgepedia.org/zh/university-of-rhode-island)本科生亚伦·施奈德赖特（Aaron Schneidereit）的一项研究用同音词、交换元音和交换字符对这三种算法进行了测试，模拟误读、常见拼写错误和因噪声丢失的字符。没有一种算法表现完美：Soundex在交换元音测试中表现完美，而Metaphone和NYSIIS不如它，但Metaphone在同音词上表现很好，略优于NYSIIS和Soundex。<sup>[6](https://digitalcommons.uri.edu/srhonorsprog/888/)</sup>

2016年一项针对英语单词和街道名称的性能评估得出结论：对于英语词典单词，Metaphone相对是更好的算法，而对于街道名称，NYSIIS更好。<sup>[7](https://www.scitepress.org/papers/2016/59263/59263.pdf)</sup> 在应用于Romanagari（用[拉丁字母](https://www.edgepedia.org/zh/latin-alphabet)书写的印地语词）时，2015年[印度理工学院坎普尔分校](https://www.edgepedia.org/zh/iit-kanpur)的一个项目发现，Soundex处理了高频词屈折变化的53.96%，而Double Metaphone为48.05%，NYSIIS为12.43%，促使作者在该任务中选择Soundex。<sup>[8](https://www.cse.iitk.ac.in/users/cs671/2015/_submissions/hrishirt/project/report.pdf)</sup>

英国政府数据链接术语表总结了实际区别：Metaphone以更广泛的英语发音规则扩展了Soundex，并允许长度可变的键，而Soundex使用固定长度的键；Double Metaphone通过为每个姓名返回主码和次码进一步改进了匹配，允许更大的歧义性。<sup>[2](https://www.gov.uk/government/publications/joined-up-data-in-government-the-future-of-data-linking-methods/glossary)</sup>

## 应用与实现

Metaphone算法广泛用于拼写检查器、搜索界面、去重程序和家谱网站。<sup>[4](https://aspell.sourceforge.net/metaphone/)</sup> 包括Metaphone在内的语音编码总体上是记录链接中常用的编码算法，记录链接是指将指向同一人或实体的数据库记录连接起来的任务。<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC3688507/)</sup> Oracle的企业数据质量文档指出，当发音相同的单词出现拼写差异时（例如通过电话采集信息时），Metaphone编码特别有用，并且在检查重复项时，Metaphone编码是原始值的良好替代。<sup>[9](https://docs.oracle.com/en/middleware/fusion-middleware/enterprise-data-quality/14.1.2/edqoh/metaphone.html)</sup>

多种语言都有实现。菲利普斯社区网站上收集的早期实现包括Basic、C、Perl、Java、4GL版本以及一个商业[ActiveX](https://www.edgepedia.org/zh/activex)控件；迈克尔·G·施韦恩（Michael G Schwern）的C库也被PHP 4使用。<sup>[4](https://aspell.sourceforge.net/metaphone/)</sup> Apache Commons Codec提供了Soundex、Metaphone和Double Metaphone的Java实现，其Metaphone类期望单个ASCII单词，字符为A到Z，不含标点或数字。<sup>[10](https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/language/Metaphone.html)</sup> Apache Commons文档还指出，PHP和Perl实现包含对最初发表算法的未记录改动。<sup>[10](https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/language/Metaphone.html)</sup> NLM的Lexical Tools使用该算法将医学输入词项缩减为语音编码。<sup>[1](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)</sup>

## 局限性

Metaphone是为英语设计的。丹尼尔·雅各布（Daniel Yacob）2004年关于将Double Metaphone应用于埃塞俄比亚文字的研究指出，虽然Metaphone在其原本针对的英语上非常成功，但不能直接应用于埃塞俄比亚语言；随着针对阿姆哈拉语书写习惯和常见输入法错误做出具体考虑，匹配结果会有所改善。<sup>[11](https://arxiv.org/abs/cs/0408052)</sup>

## References

1. [LVG Metaphone Algorithm, Lexical Tools, National Library of Medicine](https://lhncbc.nlm.nih.gov/LSG/Projects/lvg/current/docs/designDoc/UDF/metaphone/index.html)
2. [Metaphone/double metaphone, Glossary, GOV.UK Data Linking Methods](https://www.gov.uk/government/publications/joined-up-data-in-government-the-future-of-data-linking-methods/glossary)
3. [Lawrence Philips, "The Double Metaphone Search Algorithm", C/C++ Users Journal, June 2000](https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0006/philips/philips.htm)
4. [Lawrence Philips' Metaphone Algorithm, Aspell project site](https://aspell.sourceforge.net/metaphone/)
5. [The effect of data cleaning on record linkage quality, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC3688507/)
6. [Aaron Schneidereit, "Phonetic Algorithm Performance", University of Rhode Island Honors Program, December 2020](https://digitalcommons.uri.edu/srhonorsprog/888/)
7. ["Performance Evaluation of Phonetic Matching Algorithms on English Words and Street Names", SCITEPRESS, 2016](https://www.scitepress.org/papers/2016/59263/59263.pdf)
8. [Comparison of phonetic algorithms on Romanagari transliteration, IIT Kanpur CSE project report, 2015](https://www.cse.iitk.ac.in/users/cs671/2015/_submissions/hrishirt/project/report.pdf)
9. [Metaphone, Oracle Enterprise Data Quality 14.1.2 documentation](https://docs.oracle.com/en/middleware/fusion-middleware/enterprise-data-quality/14.1.2/edqoh/metaphone.html)
10. [Metaphone, Apache Commons Codec 1.22.1 API documentation](https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/language/Metaphone.html)
11. [Daniel Yacob, "Application of the Double Metaphone Algorithm to Amharic Orthography", arXiv cs/0408052, 2004](https://arxiv.org/abs/cs/0408052)

---
*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: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Numerical, string, and geometric algorithms › String algorithms

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/metaphone

English original: https://www.edgepedia.org/metaphone
