【问题标题】:Add specific words to PyEnchant dictionary将特定单词添加到 PyEnchant 字典
【发布时间】:2018-02-06 09:50:46
【问题描述】:

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

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

其中“Nr”是“Nummer”(在英语中是“数字”的意思)的缩写。我想在 PyEnchant 字典中添加这样的内容,当它看到“Nr”时能够建议“Nummer”。我该怎么做?

【问题讨论】:

    标签: python dictionary spell-checking pyenchant


    【解决方案1】:

    您似乎正在寻找enchantdict.store_replacement('Nr', 'Nummer')documentation里有解释,不是那么难找。

    【讨论】:

    • 很公平。既然你这么说,那就很明显了——我以前没认出来。
    猜你喜欢
    • 2017-10-11
    • 2016-06-15
    • 2014-02-05
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    相关资源
    最近更新 更多