python有soundex函数吗? [英] Is there a soundex function for python?

查看:61
本文介绍了python有soundex函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

python 是否有 soundex 函数,如果没有,您将如何编写 soundex 代码?

Is there a soundex function for python and if not how would you go about making a soundex code?

Soundex
Code    Letters 
1   B, F, P, V  
2   C, G, J, K, Q, S, X, Z  
3   D, T    
4   L   
5   M, N    
6   R   
SKIP   A, E, H, I, O, U, W, Y, H, W, and Y

例如:

杰克逊 = J250

华盛顿 = W252

克莱门特 = C455

Clement = C455

Ashcraft = A261

Ashcraft = A261

Wu = W000

推荐答案

是的,你可以使用 Fuzzy 这是一个实现一些语音算法的 python 库.

Yes , you can use Fuzzy which is a python library implementing some phonetic algorithms.

sudo pip install fuzzy

>>> import fuzzy
>>> soundex = fuzzy.Soundex(4)
>>> soundex("Jackson")
'J250'
>>> soundex("Washington")
'W252'
>>> soundex("Clement")
'C453'
>>> soundex("Ashcraft")
'A261'
>>> soundex("Wu")
'W000'

这篇关于python有soundex函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆