StarCC-Py
简繁转换 簡繁轉換 Python implementation of StarCC, the next generation of Simplified-Traditional Chinese conversion framework
安裝 Installation
pip install starcc
用法 Usage
簡轉繁 Simplified to Traditional
不轉換用詞 Without phrase conversion:
from StarCC import PresetConversion
convert = PresetConversion(src='cn', dst='hk', with_phrase=False) # change to `dst='tw'` for Taiwan mode
print(convert('阴天,山容便黯澹无聊,半隐入米家的水墨里去。'))
# 陰天,山容便黯澹無聊,半隱入米家的水墨裏去。
轉換用詞 With phrase conversion:
from StarCC import PresetConversion
convert = PresetConversion(src='cn', dst='tw', with_phrase=True)
print(convert('KB 大桥也被视为帕劳人的后花园。'))
# KB 大橋也被視為帛琉人的後花園。
繁轉簡 Traditional to Simplified
不轉換用詞 Without phrase conversion:
from StarCC import PresetConversion
convert = PresetConversion(src='hk', dst='cn', with_phrase=False) # change to `dst='tw'` for Taiwan mode
print(convert('盆地並不會永久被水覆蓋,而是反覆蒸發循環。'))
# 盆地并不会永久被水覆盖,而是反复蒸发循环。
轉換用詞 With phrase conversion:
from StarCC import PresetConversion
convert = PresetConversion(src='tw', dst='cn', with_phrase=True)
print(convert('在搜尋欄位使用萬用字元。'))
# 在搜索字段使用通配符。
高級用法 Advanced Usage
在簡轉繁時使用外部分詞 Use external segmentation tools when converting from Simplified to Traditional
此功能已預設開啓 This function is enabled by default
from StarCC import PresetConversion
convert = PresetConversion(src='cn', dst='hk', with_phrase=False, use_seg=True)
convert('拥有 116 年历史') # Correct: 擁有 116 年歷史
convert = PresetConversion(src='cn', dst='hk', with_phrase=False, use_seg=False)
convert('拥有 116 年历史') # Wrong: 擁有 116 年曆史
轉換模式一覽 Supported conversion modes
cn: Simplified Chinese (Mainland China)hk: Traditional Chinese (Hong Kong)tw: Traditional Chinese (Taiwan)cnt: Traditional Chinese (Mainland China)jp: Japanese Shinjitai
The support of cnt is currently experimental.
Metadata
Release files for starcc 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| starcc-0.0.5.tar.gz | 7.6 kB | Without provenance | Details for starcc-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starcc-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for starcc-0.0.5-py3-none-any.whl |
Total release size: 491.5 kB
Release files / starcc-0.0.5.tar.gz
| Download URL | starcc-0.0.5.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b4373ebff22c97010ab4a872daacf94d28bd626874c06ee145249a15f4709df
|
|
BLAKE2b-256 checksum How to use checksums |
f80fadc675a54b41a3eb6f8866ac7af471940240c117461d063a37045b854d24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Release files / starcc-0.0.5-py3-none-any.whl
| Download URL | starcc-0.0.5-py3-none-any.whl |
|---|---|
| Size | 483.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebdc24225cae17a1211e13e2b9cee444ba8ae83cdfa1846b0bcb180b3f53cee1
|
|
BLAKE2b-256 checksum How to use checksums |
e9f8ab675730a509e301243193d47921068b543817d5f81ddcbf297d026d87b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Security for starcc 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.