python - 是否可以在附魔中传递多个字典?
问题描述
有什么办法可以在附魔中使用多个字典。这就是我所做的,
import enchant
d = enchant.Dict("en_US")
d.check("materialise")
>> False
但如果我使用enchant.Dict("en_UK")
,我会得到True
。组合多个字典的最佳方法是什么,以便它True
无论返回materialise
还是materialize
作为输入参数返回?
解决方案
我可能来晚了,但这个问题也引起了我的兴趣。
因此,在 Python 的 enchant 中使用多种英语方言的解决方案如下:
import enchant
'''
Use "en" simply to cover all available dialects and word usages of the English language
'''
d = enchant.Dict("en")
d.check("materialise") # UK (en_GB)
>>> True
d.check("materialize") # USA (en_US)
>>> True
希望这对我们未来的读者有所帮助:)
推荐阅读
- azure-application-insights - Kusto / Azure Application Insights - 如何将数据与前几周的同一天进行比较?
- javascript - 有没有办法代表浏览器发出 POST 请求
- excel - 验证员工姓名
- r - 如何复制数据框中的列?
- spring - 断开连接时停止消费者(Spring Boot + Kafka)
- bioinformatics - 在snakemake中跨多个子目录的多个文件上运行python脚本
- azure - Azure 门户无法在设备上加载
- godot - 如何在我的 Godot 游戏中添加《洛克人》、《塞尔达传说》和《银河战士》等游戏中的滑动过渡?
- angular - Angular 数据共享架构
- android - Android存根共享意图找不到匹配的意图