Help us shape the future of Go! Take the 2026 Go Developer Survey

rime-export

command module
v0.0.0-...-888e4ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 10 Imported by: 0

README

rime-export

将 Rime 输入法的 table.bin 二进制词典导出为岁寒输入法可导入的文本词库。

安装

go install github.com/NateScarlet/rime-export

使用

export_table input/main.table.bin output/export.txt

不提供 output.txt 时输出到 stdout。

输出格式

拼音 pin|yin 权重

即岁寒输入法格式3,UTF-8 编码,按权重降序排列。

依赖

  • Go 1.26+
  • go-marisa — marisa trie 读取库

原理

程序直接解析 table.bin 的二进制结构:

  1. 读取 Metadata 定位 syllabary、index tree 和 marisa string table
  2. 用 marisa trie 解析字符串表
  3. 遍历 4 层索引树(HeadIndex → TrunkIndex×2 → TailIndex)收集全部词条
  4. 将搜狗双拼编码转为全拼输出

词典中的编码形如 dj[kd/hg[xd(丹恒),[ 前是双拼,[ 后是辅助码(被丢弃)。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL