将特定单词添加到 PyEnchant 词典

Add specific words to PyEnchant dictionary

我不想向 PyEnchant 添加新词典,而是想向词典中添加单个单词并提供如何更正它们的建议。例如我有代码

import enchant
enchantdict = enchant.Dict("de_GE")
suggested_words = [enchantdict.suggest(word) for word in ['Kunden','Nr','201']]

其中 "Nr" 是 "Nummer" 的简写(英语中的意思是 "Number")。我想添加到 PyEnchant 字典中,它能够在看到 "Nr" 时建议 "Nummer"。我该怎么做?

您似乎在寻找 enchantdict.store_replacement('Nr', 'Nummer')。在 documentation 中有解释,并不难找到。