本来是用的微信输入法来着。但是因为一些原因把设备同步关掉了,所以微信输入法也就没用了。正好最近看到了LMDG这个项目,用预训练好的模型权重来优化输入。于是也就试试Rime吧。
安装
brew就是好用,感觉社区还是挺活跃的,才开发几天的软件都能进到库里。我们需要安装鼠须管,就是macos版本的rime本体,以及配置管理器Plum,最后再用Plum安装一个还不错的配置方案白霜拼音。然后去上面提到的仓库中下载一个模型文件,移动到~/Library/Rime 中。同时为了方便,我们也可以下载lotem/rime-octagram-data 用于配置模型。
cd ~
brew install --cask squirrel
git clone --depth 1 https://github.com/rime/plum.git
cd plum
bash rime-install gaboolic/rime-frost:others/recipes/full
bash rime-install lotem/rime-octagram-data lotem/rime-octagram-data@hans 配置
打开~/Library/Rime 目录,这里存放的就是所有关于Rime的配置文件。其中需要注意的文件有default.yaml 和squirrel.yaml ,一个是默认输入方案的配置,另一个是整个输入法的配置,用于配置输入法的外观。
在default.yaml中,我们可以直接删除不用的部分配置
schema_list:
# 可以直接删除或注释不需要的方案,对应的 *.schema.yaml 方案文件也可以直接删除
- schema: rime_frost 以及快捷键,这里我们就忽略了。
然后运行
bash rime-install lotem/rime-octagram-data:customize:schema=rime_frost,model=hans Plum会自动生成一个rime_frost.custom.yaml内容如下
__patch:
# Rx: lotem/rime-octagram-data:customize:schema=rime_frost,model=hans {
- patch/+:
__include: grammar:/hans
# } 为了使用我们的模型权重而不是octagram的,修改grammer.yaml
hans:
grammar:
language: amz-v1n3m3-zh-hans # 把这个权重从原来的改成下载的模型权重名字。
translator/contextual_suggestions: true
translator/max_homophones: 7
translator/max_homographs: 7
hans_char:
grammar:
language: amz-v1n3m3-zh-hans
collocation_max_length: 2
collocation_min_length: 2
translator/contextual_suggestions: true
translator/max_homophones: 7
translator/max_homographs: 7 然后重新部署就行。
另外关于中英文切换,我使用的mac默认的ABC作为英文,关闭了rime的英文输入法。这样用起来习惯也不会变化。
需要通过 custom 去掉 engine/processors 中的 ascii_composer,然后再次重新部署就行。
效果
使用前
使用后