STFIWF.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:2016CCF-sougou 作者: prozhuchen 项目源码 文件源码
def strip_accents_unicode(s):
    """Transform accentuated unicode symbols into their simple counterpart

    Warning: the python-level loop and join operations make this
    implementation 20 times slower than the strip_accents_ascii basic
    normalization.

    See also
    --------
    strip_accents_ascii
        Remove accentuated char for any unicode symbol that has a direct
        ASCII equivalent.
    """
    normalized = unicodedata.normalize('NFKD', s)
    if normalized == s:
        return s
    else:
        return ''.join([c for c in normalized if not unicodedata.combining(c)])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号