Rime添加dota2詞庫

我平時主要玩 Dota2 和 CS2,畢竟常年霸榜 steam,玩家人數最多,最高在線人數百萬級別,請覈查https://store.steampowered.com/charts/mostplayed,與人鬥其樂無窮。

每次玩的時候,總能遇到些奇葩,比如從頭打野到遊戲結束、不插眼、刷了送的。這個時候,打字友情提示下很有必要,想贏的。

退一步講,萬一要文鬥,打字快也不落下風😅。

所以輸入法需要攜帶 Dota2 詞庫,這樣比較節約時間,比如輸入“死靈法師”速度就會變快。

1. 安裝輸入法

fcitx5 比 ibus 自定義更加方便,noto-fonts-emoji 添加 emoji 支持。

1sudo pacman -S fctix5-rime
2sudo pacman -S noto-fonts-emoji

選用霧凇拼音,好像最近又冒出了很多類似霧凇拼音的,懶得折騰了,目前滿足需求。

1paru -S rime-ice-pinyin-git

2. 霧凇拼音自定義設置

操作過程如下:

 1➜  ~ cd .local/share/fcitx5
 2➜  fcitx5 ls
 3rime/  themes/
 4➜  fcitx5 pwd
 5/home/mephisto/.local/share/fcitx5
 6➜  fcitx5 cd rime
 7➜  rime pwd
 8/home/mephisto/.local/share/fcitx5/rime
 9➜  rime ls
10build/  cn_dicts/  default.custom.yaml  installation.yaml  luna_pinyin.userdb/  rime_ice.custom.yaml  rime_ice.userdb/  sync/  user.yaml
11➜  rime cat default.custom.yaml
12patch:
13  # 僅使用「霧凇拼音」的默認配置,配置此行即可
14  __include: rime_ice_suggestion:/
15➜  rime cat rime_ice.custom.yaml
16# rime_ice.custom.yaml
17patch:
18  # 顯式定義 menu,覆蓋 default.yaml 的繼承值
19  menu:
20    page_size: 10
21
22  # 添加你的詞典
23  import_tables/@next: cn_dicts/dota2
24➜  rime head -n 20 cn_dicts/dota2.dict.yaml
25# Rime dictionary
26# encoding: utf-8
27#
28# Sogou Pinyin Dict - 搜狗細胞詞庫
29#
30#   https://pinyin.sogou.com/dict/
31#
32# 包括:
33#
34# * dota2
35#
36
37---
38name: dota2
39version: "1.0"
40sort: by_weight
41use_preset_vocabulary: true
42import_tables:
43  - rime_ice        # ← 如果你用的是霧凇拼音,就寫 rime_ice;若用朙月拼音則寫 luna_pinyin

這裏必須說明下,fctix5-rime 讀取的是 /home/mephisto/.local/share/fcitx5/rime 下的配置,放入~/.config/fcitx5/rime 不會起作用。

有點不符合規範,爲此折騰測試很久,最後認輸。theme 放在 /home/mephisto/.local/share/fcitx5/themes 還能理解。

導致的結果是不好放入 github 的 dotfiles 倉庫管理。

3. 詞庫操作

搜索dota2詞庫,搜索引擎會指向搜狗拼音的詞庫,下載下來後,是個.scel 文件。

1➜  scel git:(master) file dota2.scel
2dota2.scel: data

用這個工具 https://github.com/lewangdev/scel2txt 轉換詞庫,當然也有別的詞庫轉換工具,這個夠用。

將從搜狗官方詞庫網站下載的 *.scel 文件放入 scel 文件夾,然後運行

1python3 scel2txt.py

目標文件就會在 out 目錄中生成,再把文件複製到 /home/mephisto/.local/share/fcitx5/rime/cn_dicts

參考下面的示例,字典文件的頭部要改動下,因爲現在用的 rime_ice

 1➜  rime pwd
 2/home/mephisto/.local/share/fcitx5/rime
 3➜  rime ls
 4build/  cn_dicts/  default.custom.yaml  installation.yaml  luna_pinyin.userdb/  rime_ice.custom.yaml  rime_ice.userdb/  sync/  user.yaml
 5➜  rime head -n 25 cn_dicts/dota2.dict.yaml
 6# Rime dictionary
 7# encoding: utf-8
 8#
 9# Sogou Pinyin Dict - 搜狗細胞詞庫
10#
11#   https://pinyin.sogou.com/dict/
12#
13# 包括:
14#
15# * dota2
16#
17
18---
19name: dota2
20version: "1.0"
21sort: by_weight
22use_preset_vocabulary: true
23import_tables:
24  - rime_ice        # ← 如果你用的是霧凇拼音,就寫 rime_ice;若用朙月拼音則寫 luna_pinyin
25...
26
27艾歐	ai ou
28矮人直升機	ai ren zhi sheng ji
29矮子	ai zi
30暗夜魔王	an ye mo wang

4. 重啓驗證

命令行重啓:fcitx5 -rd,讓配置生效。

有圖有真相,輸入 hycms 能打出幻影長矛手,另外,下圖所示標號爲 0 的候選詞,能看出支持 emoji

rime-dota2-dict-emoji

導入其它詞庫原理相通,先下載詞庫,轉爲 rime 要求的格式,最後修改配置重啓。

最後修改於: Saturday, December 13, 2025

相關文章:

翻譯: