Skip to content

Commit

Permalink
update: README.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcel committed Jul 31, 2023
1 parent ba4170e commit 81a6bbe
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@
# RimeToGboardDictionary
# RGDictConverter

## 简介

本脚本可将 Rime `xxx.userdb.txt` (测试于 [Weasel](https://github.com/rime/weasel)) 转换为 Gboard `PersonalDictionary.zip` 格式, 便于将词库导入 gboard.
本脚本可将 Rime `xxx.userdb.txt` (测试于 [Weasel](https://github.com/rime/weasel)) 转换为 Gboard `PersonalDictionary.zip` 格式, 便于将词库导入 Gboard.

## 脚本依赖

- Python 3.10.9
- OpenCC 1.1.1
- tqdm 4.64.1
- OpenCC 1.1.1
- tqdm 4.64.1

## 使用方法

### 命令行

1. 安装 python 以及依赖:

```shell
pip3 install -r requirements.txt
pip install -r requirements.txt
```

2. 运行脚本, 按照提示将你的待转换的 `userdb.txt` 拖拽入命令行.
2. (可选) userdb.txt 文件内容是 rime 默认为繁体中文, 如果是简体中文的 userdb.txt, 则需注释一行代码 `userdb_data = trans_to_simp(userdb_data)`:

```python
def main():
# 获取 rime userdb.txt 用户词典
userdb_data = read_file()

# (可选)将繁体字的userdb.txt内容转成简体字
userdb_data = trans_to_simp(userdb_data)

# 匹配自定义短语
words_list = find_words(userdb_data)

# 新建列表存储短语
new_words_list = generate_gboard_format_data(words_list)

3. 按照提示, 输入 `userdb.txt``PersonalDictionary.zip` 的文字简繁类型.
# 生成 gboard 个人词典
generate_gboardDic(words_list=new_words_list)
```

3. 运行脚本, 按照提示将你的待转换的 `userdb.txt` 拖拽入命令行.

4. 回车, 等待数秒, `.zip` 压缩文件将自动生成.

5.`.zip` 压缩文件导入手机存储中, 在 gboard 设置 - 字典 - 个人字典 - 中文 (简体) - 点击右上角 *导入* - 选择 `.zip` 压缩文件.

### 应用程序

1. [下载](https://github.com/cgcel/RGDictConverter/releases) 应用程序, 保存至本地
2. 打开 RGDictConverter.exe, 按照提示将待转换的 `*.userdb.txt` 拖入窗口, 或直接输入文件地址
3. 按照后续提示输入繁简类型后回车
4.[上述](#命令行) 第5步操作一致


## License

Copyright 2023 GC Chen
Expand Down

0 comments on commit 81a6bbe

Please sign in to comment.