Metadata-Version: 2.4
Name: ime-utils
Version: 0.2.0
Summary: Chinese IME ciku (aka cell wordlist file) parsing tool
License-Expression: MIT
Requires-Python: >=3.10
Project-URL: Changelog, https://github.com/hantang/ime-utils/blob/mai/CHANGELOG.md
Project-URL: Documentation, https://github.com/hantang/ime-utils
Project-URL: Homepage, https://github.com/hantang/ime-utils
Project-URL: Issues, https://github.com/hantang/ime-utils/issues
Project-URL: Repository, https://github.com/hantang/ime-utils.git
Description-Content-Type: text/markdown

# IME-Utils

中文输入法词库文件（细胞词库）解析工具。

> Chinese IME ciku (aka cell wordlist file) parsing tool.

支持：

- [x] 搜狗拼音（`.scel`）
- [x] 百度拼音（`.bdict`）、百度输入法手机版（`.bcd`）
- [x] QQ 拼音（`.qcel`）、QQ 拼音旧版（6.0 以下词库，`.qpyd`）
- [x] 华宇拼音（紫光输入法）（`.uwl`）

## 使用

- 程序调用：

```python
# 安装
# pip install ime-utils
# uv pip install . # 本地

# 用例：
from ime_utils.parser import SogouParser, BaiduParser

parser = BaiduParser()
files = [
    "医学词汇.bdict",
    "电影明星.bdict",
    "体操基本术语.bdict",
]

for file in files[:]:
    save_file = f"out-{file}.txt"
    if parser.parse(file):
        parser.save_data(save_file, keep_error=False)
```

- 命令行调用

```shell
# 或者 python -m ime_utils -f file-names -o output

# 指定多个文件
ime-utils -f file-name1,file-name2 -o output
# 指定目录，保留解析异常词语
ime-utils -d file-dir -o text --keep-error
```
