1

我正在尝试使用 Python3 中的 unidecode 库来删除俄语单词(西里尔字母)中的重音符号。unidecode 库适用于其他示例,但不适用于俄语单词。任何帮助将不胜感激。

不是去掉“e”字母上的重音,而是俄语单词变成“ND3/4D3/4D+-NDuID1/2D,N”,这不是我们想要的……

Python 3.3.0 (default, Oct 24 2012, 14:30:03)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> # -*- coding: utf-8 -*-
...
>>> from unidecode import unidecode
>>> print(unidecode(u"Cœur"))
CAur
>>> print(unidecode(u"сообще́ния"))
ND3/4D3/4D+-NDuID1/2D,N
>>>
4

1 回答 1

1

我在 Mac OSX 上试过。

$ echo $LANG
en_US.utf-8
$ python3
Python 3.3.2 (default, Aug 22 2013, 12:33:42)
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unidecode import unidecode
>>> print(unidecode(u"Cœur"))
Coeur
>>> print(unidecode(u"сообще́ния"))
soobshcheniia

您可以尝试设置 LANG 变量。

于 2013-09-30T16:57:13.033 回答