将Chrome(hunspell)中的两个BDIC文件合并为一个 [英] Combine two BDIC files from Chrome (hunspell) into one

查看:56
本文介绍了将Chrome(hunspell)中的两个BDIC文件合并为一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个来自Google Chrome拼写检查器(基于hunspell)的BDIC(二进制字典?)文件.我想将所有单词的这两个文件合并为一个BDIC.

I have two BDIC (binary dictionary?) files from Google Chrome spell checker (based on hunspell). I want to combine this two files into one single BDIC for all words.

这是

Here is a reader/writer (chromium/src/third_party/hunspell/google/bdict_reader.h) of this format from Chrome sources (LGPL/C++)

如何将两个文件与C ++或命令行实用程序合并?

How can I combine two files with C++ or command-line utility?

推荐答案

合并两个hunspell词典很容易,有 https://github.com/arty-name/hunspell-merge ,可以帮助您将任意数量的源词典合并在一起.

Merging two hunspell dictionaries is easy, there are tools like https://github.com/arty-name/hunspell-merge that can help you merge any number of source dictionaries together.

创建Chrome可以理解的 bdict 文件比较棘手.Chrome使用这种格式进行优化,并在内部使用 convert_dict 工具将 aff dic 文件转换为 bdict .我无法在线找到此工具,因此仅剩下一个选项,即从Chromium来源构建它.Google有一个非常简单的设置,如果执行得当,您可以构建此工具.首先,您必须遵循 http://dev.chromium.org/developers/操作方法/获取代码以获取代码并在您的平台上设置环境.之后执行 ninja -C out \ Debug convert_dict ,如果完成且没有错误,请在 out/Debug 文件夹下找到您的 convert_dict 可执行文件.

Creating bdict file that Chrome understands is trickier. Chrome uses this format for optimizations and uses convert_dict tool internally to convert aff and dic files to bdict. I couldn't find this tool online so it left only one option, building it from Chromium sources. Google has a pretty straight forward setup that if executed carefully will let you build this tool. First you have to follow http://dev.chromium.org/developers/how-tos/get-the-code to obtain the code and setup your environment base on your platform. After that execute ninja -C out\Debug convert_dict and if completed without errors, find your convert_dict executable under out/Debug folder.

据我所知,您无法向Chrome添加自定义语言,因此您必须替换其中一种预定义的语言.我建议安装一种您不懂的语言,并将其用于合并后的一种.可以在Chrome用户配置文件文件夹中找到 bdict 文件.

You cannot add custom language to Chrome (as far as I know) so you have to replace one of the predefined ones. I suggest installing one of the languages you don't understand and use it for your merged one. The bdict files can be found in Chrome user profile folder.

这篇关于将Chrome(hunspell)中的两个BDIC文件合并为一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆