Skip to main content

Query the pinyin of Chinese characters.

Project description

汉字拼音查询包 (Hanzi-Pinyin)

GitHub Repository License PyPI version

描述

hanzi_pinyin 是一个用于查询汉字拼音(罗马化)的包。它提供了获取简体和详细拼音表示的工具。

安装

你可以使用 pip 来安装这个包:

pip install hanzi_pinyin

使用方法

导入包

你可以按以下方式从包中导入函数:

from hanzi_pinyin import pinyin, detailed_pinyin, alls

函数

pinyin(char: str) -> List[str] | None

返回给定汉字的拼音表示列表,不带声调。

示例:

result = pinyin('汉')  # ['han']
print(result)

detailed_pinyin(char: str) -> List[str] | None

返回给定汉字的详细拼音表示列表,包括声调。

示例:

result = detailed_pinyin('汉')  # ['hàn']
print(result)

alls() -> Dict[str, List[str]]

返回整个汉字到含声调拼音映射的字典。

示例:

dict_ = alls()
print(dict_['汉'])  # ['hàn']

数据来源

本包中的数据来源为:汉语国学

爬取脚本可见 fetcher.ts

许可证

本包采用 MIT 许可证。

贡献

欢迎贡献!请提交问题或拉取请求。

作者

  • Neooier

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hanzi_pinyin-0.2.8.tar.gz (189.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hanzi_pinyin-0.2.8-py3-none-any.whl (223.5 kB view details)

Uploaded Python 3

File details

Details for the file hanzi_pinyin-0.2.8.tar.gz.

File metadata

  • Download URL: hanzi_pinyin-0.2.8.tar.gz
  • Upload date:
  • Size: 189.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for hanzi_pinyin-0.2.8.tar.gz
Algorithm Hash digest
SHA256 a2fbd338360652fb0229cd6c4895a53b2b9917bcb22c9aa964ee1f83068e5e68
MD5 5c2f699d881b6e915ebdb4efb9a355a1
BLAKE2b-256 c8fb60ba9177c9c36c15d7abcbe8a6872cf1ec27a9769af6179d66b09c31cf58

See more details on using hashes here.

File details

Details for the file hanzi_pinyin-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: hanzi_pinyin-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 223.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for hanzi_pinyin-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c6c2049a408a87e0fd3fa821b1ae51b1c9fabd6c6152b73f5cdd5ca3ef02996c
MD5 8977239895791c1e0bd2d953a7b539de
BLAKE2b-256 42d83c806742899684b71702e5bf1ca33c3b0aeb1591c7b391b8f13cb2454b46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page