wuhgit/CustomPinyinDictionary

Ubuntu 将词库转换为txt文件教程

Closed this issue · 2 comments

  1. 备份 sources.listcp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 编辑 sources.listnano /etc/apt/sources.list
  3. 将文件里的内容全部替换成以下内容:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse

  1. 更新源:apt update
  2. 安装 libime-binapt install libime-bin
  3. 还原 sources.listcp /etc/apt/sources.list.bak /etc/apt/sources.list
  4. 下载 CustomPinyinDictionary_Fcitx_<版本号>.tar.gz 并解压,得到词库文件 CustomPinyinDictionary_Fcitx.dict
  5. 进入词库文件所在目录,将词库转换为txt文件:libime_pinyindict -d CustomPinyinDictionary_Fcitx.dict CustomPinyinDictionary_Fcitx.txt

若命令受限于权限而无法执行,请在命令之前加上sudo

  1. 备份sources.listcp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 编辑sources.listnano /etc/apt/sources.list
  3. 将文件里的内容全部替换成以下内容:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
  1. 更新来源:apt update
  2. 安装libime-binapt install libime-bin
  3. 还原sources.listcp /etc/apt/sources.list.bak /etc/apt/sources.list
  4. 下载CustomPinyinDictionary_Fcitx_<版本号>.tar.gz并解压,获取词库文件CustomPinyinDictionary_Fcitx.dict
  5. 进入词库文件所在目录,将词库转换为txt文件:libime_pinyindict -d CustomPinyinDictionary_Fcitx.dict CustomPinyinDictionary_Fcitx.txt

root@ubuntu:/home/dict# libime_pinyindict -d CustomPinyinDictionary_Fcitx.dict CustomPinyinDictionary_Fcitx.txt terminate called after throwing an instance of 'std::invalid_argument' what(): Invalid pinyin version. Aborted
报错了