shirkhan
the python tool for shirkhan
currently using with project u-open-imla
Usage
安装
pip install shirkhan
更新
pip install --upgrade shirkhan
删除
pip uninstall shirkhan
from shirkhan import decode, encode, syllabify
encode("xxxx")
decode("yyy")
word = "شىرخان"
print(syllabify(word))
shirkhan 专用脚本库的更多功能示例:
分音节
from shirkhan import syllabify
print(syllabify('شىرخان'))
# output ['شىر', 'خان']
元音辅音组合的向量
from shirkhan import SWord
target_word = "شىرخان"
print(SWord(target_word).tokenize())
# output 010010
组合向量分组
from shirkhan import SWord, do_group
target_word = "شىرخان"
token = SWord(target_word).tokenize()
retoken = token[::-1] # 反转
print(do_group(retoken))
# output [['0', '1'], ['0', '0', '1'], ['0']]
分音原始内容
from shirkhan import SWord, position_transform, embed_delimiter
target_word = "شىرخان"
token = SWord(target_word).tokenize()
retoken = token[::-1]
print(position_transform(target_word, embed_delimiter(retoken)))
# output شىرxخان
更多使用案例请看 examples目录中的脚本
开发,贡献指南
- 本地安装项目,安装时指定可编辑方式安装,这样可以边使用边看效果,甚至调整逻辑时不需要频繁修改源码后重新安装
pip install --editable shirkhan_lib_path // 这个目录指定到有setup.py为止即可
Metadata
Release files for shirkhan 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shirkhan-0.0.4.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shirkhan-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.5 kB
Release files / shirkhan-0.0.4.tar.gz
| Download URL | shirkhan-0.0.4.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a03e34d39c627410e8da5bbfb5edfb386ad8d22505a6ff9331571cc113e650c
|
|
BLAKE2b-256 checksum How to use checksums |
a033ad26da11020fe17eb86eeea75df1e31348a0a22b05699162b3fff0a84b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.0
|
Release files / shirkhan-0.0.4-py3-none-any.whl
| Download URL | shirkhan-0.0.4-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77ee7bcceb029ccda29da091ef7b28e1ed4c39cbb8d49488b4348d8bfaccae5d
|
|
BLAKE2b-256 checksum How to use checksums |
343329ee1728509c1f603136e8df7e1d8707c7523638e286e248f962cfac7acf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.0
|