wuhgit / CustomPinyinDictionary

自建拼音输入法词库,百万常用词汇量,适配 Fcitx5 (Linux / Android) 及 Gboard (Android + Magisk or KernelSU) 。
1.78k stars 40 forks source link

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

Closed QPYIDRWIMG closed 7 months ago

QPYIDRWIMG commented 7 months ago
  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


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

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

Reweng commented 6 months ago
  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 报错了