https://github.com/taishan1994/stroke2vec
获取中文的笔画向量
https://github.com/taishan1994/stroke2vec
Last synced: 6 months ago
JSON representation
获取中文的笔画向量
- Host: GitHub
- URL: https://github.com/taishan1994/stroke2vec
- Owner: taishan1994
- Created: 2021-09-22T11:17:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-22T11:26:17.000Z (about 4 years ago)
- Last Synced: 2025-03-25T16:51:32.350Z (7 months ago)
- Language: Python
- Size: 921 KB
- Stars: 23
- Watchers: 1
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stroke2vec
获取中文的笔画向量。
本项目提供了中文汉字的部首、笔画数、笔画信息,具体的汉字范围是中文unicode编码范围内的20902个汉字。相关的数据可以在data下找到。# 使用方法
```python
from pybihua import BiHua
bihua = BiHua()
char = '博'
res = bihua.get_char_with_radical_and_num_and_stroke(char)
print('字符:', char)
print('部首:', res['radical'])
print('笔画数:', res['num'])
print('笔画:', res['stroke_list'])
print(bihua.get_char_with_radical_and_num_and_strokeid('博'))
```
结果:
```python
字符: 博
部首: 十
笔画数: 12
笔画: ['横', '竖', '横', '竖', '横折', '横', '横', '竖', '点', '横', '竖钩', '点']
{'radical': '十', 'num': '12', 'strokeid_list': [1, 2, 1, 2, 6, 1, 1, 2, 0, 1, 21, 0]}
```
说明:
bihua.get_char_with_radical_and_num_and_stroke(char)返回一个字典,笔画是未经过映射的。bihua.get_char_with_radical_and_num_and_strokeid(char)返回的是一个字典,笔画是经过映射的,具体映射的文件在data下,有32个笔画。