【问题标题】:How can convert a dictionary file (.dic) with an affix file (.aff) to create a list of words?如何将字典文件 (.dic) 与词缀文件 (.aff) 转换以创建单词列表?
【发布时间】:2011-01-04 19:13:58
【问题描述】:

我正在查看一个字典文件(“.dic”)及其相关的“aff”文件。我正在尝试做的是将“aff”文件中的规则与“dic”文件中的单词结合起来,以创建字典文件中包含的所有单词的全局列表。

这些文件背后的文档很难找到。有谁知道我可以学习的资源吗?

是否有任何代码已经可以做到这一点(我是否重复了我不需要的工作)?

谢谢!

【问题讨论】:

    标签: dictionary


    【解决方案1】:

    根据Pillowcase,这里是一个使用示例:

    # Download dictionary
    wget -O ./dic/es_ES.aff "https://raw.githubusercontent.com/sbosio/rla-es/master/source-code/hispalabras-0.1/hispalabras/es_ES.aff"
    wget -O ./dic/es_ES.dic "https://raw.githubusercontent.com/sbosio/rla-es/master/source-code/hispalabras-0.1/hispalabras/es_ES.dic"
    
    # Compile program
    wget -O ./dic/unmunch.cxx "https://raw.githubusercontent.com/hunspell/hunspell/master/src/tools/unmunch.cxx"
    wget -O ./dic/unmunch.h "https://raw.githubusercontent.com/hunspell/hunspell/master/src/tools/unmunch.h"
    g++ -o ./dic/unmunch ./dic/unmunch.cxx
    
    # Generate dictionary
    ./dic/unmunch ./dic/es_ES.dic ./dic/es_ES.aff 2> /dev/null > ./dic/es_ES.txt.bk
    sort ./dic/es_ES.txt.bk > ./dic/es_ES.txt # Opcional
    rm ./dic/es_ES.txt.bk # Opcional
    

    【讨论】:

    • 太棒了!我为那些想要unmunched 西班牙语词典但无法访问 linux 终端的人分享生成的文件(未排序):es_ES.txt
    【解决方案2】:

    您需要一个名为 munch.exe 的实用程序来将 aff 规则应用于 dic 文件。

    【讨论】:

      【解决方案3】:

      这些可能是Hunspell 字典文件。不幸的是,创建“全局”或未使用的词表的命令仅完全支持简单的 .aff 和 .dic 文件。

      来自the documentation

      unmunch: list all recognized words of a MySpell dictionary
      

      语法:

      unmunch dic_file affix_file
      

      试试看会发生什么。要为一个单词生成所有单词形式,请查看here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-07-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-02-07
        • 2016-11-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多