Hunspell(Python 3)如何处理UMLAUT

Hunspell(Python 3)如何处理UMLAUT,python,python-3.x,utf-8,hunspell,Python,Python 3.x,Utf 8,Hunspell,我在OSX上使用CyHunspell和Python3.6(IDLE)检查单词拼写是否正确。它适用于大多数单词,但如果有像ä这样的德语Umlauts就不行了。所以我想编码可能是个问题。我已经试过几本字典,因为图书馆的一本是ISO8859-1。我试过UTF-8,但也不起作用。我还将LibreOffice文件转换为ISO8859-1,但行为仍然相同 我的代码: import os from hunspell import Hunspell hunspell_path = os.path.dirname

我在OSX上使用CyHunspell和Python3.6(IDLE)检查单词拼写是否正确。它适用于大多数单词,但如果有像ä这样的德语Umlauts就不行了。所以我想编码可能是个问题。我已经试过几本字典,因为图书馆的一本是ISO8859-1。我试过UTF-8,但也不起作用。我还将LibreOffice文件转换为ISO8859-1,但行为仍然相同

我的代码:

import os
from hunspell import Hunspell
hunspell_path = os.path.dirname(os.path.abspath(__file__)) + "/dictionaries"
h = Hunspell("de_DE_utf8", hunspell_data_dir=hunspell_path)
print(h.spell("Beispiel")) # TRUE - should be TRUE
print(h.spell("überall")) # FALSE - should be TRUE
print(h.spell("über")) # TRUE - should be TRUE
我不明白的是“尤伯”是真的

这三个词都在“de_de_utf8.dic”中:


你知道我该怎么解决这个问题吗?我在其他问题中找到了一些关于UTF-8和Python的信息,但它们通常是关于读取文件的。

我尝试过,但使用了不同的词典: 在那里它似乎工作得很好。 不过,在Ubuntu 16.04上的Python3.5上尝试过这一点

import os
from hunspell import Hunspell

dict_path = .....
h = Hunspell("de_DE_frami", hunspell_data_dir=dict_path)
print(h.spell("Beispiel"))
print(h.spell("über"))
print(h.spell("überall"))
print(h.spell("Über"))
True
True
True
True
import os
from hunspell import Hunspell

dict_path = .....
h = Hunspell("de_DE_frami", hunspell_data_dir=dict_path)
print(h.spell("Beispiel"))
print(h.spell("über"))
print(h.spell("überall"))
print(h.spell("Über"))
True
True
True
True