Skip to main content

a package converts short Chinese-character strings(titles of books, articles or journals) to pinyin.

Project description

readMe.md

1 Description: This is a simple and short command-line tool that converts short Chinese-character strings(titles of books, articles or journals) to pinyin. It's purpose is to facilitate generating Chinese citations or bibiliograph in the English setting.

2 Internal Steps

It first tokenizes the Chinese strings using Jieba, and then output the corresponding pinyin via pypinyin's lazy_pinyin.

  • input: Chinese characters (it accepts both traditional and simplified Chinese)
  • output: pinyin strings

There are two possible outputs:

    1. the sentence style, which means only the first letter of the first word is capitalized.
    1. the headline style, in which the first letters of all tokens are capitalized. The default is the sentence style. You can use --head to output in the headline style

3 usage:

    1. command line:

    pinyinlize <Chinese_text> [--head]

    eg:

    pinyinlize "清代基層地方官人事嬗遞現象之量化分析"

    output: "Qingdai jiceng difangguan renshi shandi xianxiang zhi lianghua fenxi"

    1. in python scripting

    from pinyinlize.main_script import to_pinyin

    The method to_pinyin has two parameters, the first the text_string, the second is True or False value. The default is True. It determines if the output is formated in sentence style. If sent_style is set to False, it will output headline style

    eg :

    to_pinyin("清代基層地方官人事嬗遞現象之量化分析", sent_style=False)

    output: "Qingdai Jiceng Difangguan Renshi Shandi Xianxiang Zhi Lianghua Fenxi"

4 Installation

pip install pinyinlize

5 future plans To include a API call to Crossref and an option to output DOI or bibtex for the article or book input.

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

pinyinlize-0.2.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pinyinlize-0.2.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pinyinlize-0.2.1.tar.gz.

File metadata

  • Download URL: pinyinlize-0.2.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for pinyinlize-0.2.1.tar.gz
Algorithm Hash digest
SHA256 09aa7122fdef4027976d47bc3db14b7f939cc2ebe6f80fcaa21c52b74462431f
MD5 419fdb455ed34b8a632844eea3fdc4cd
BLAKE2b-256 2162ea6f82011a89363dece5e59d5072b22fafb03a2f12925aa47057b79a44dd

See more details on using hashes here.

File details

Details for the file pinyinlize-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pinyinlize-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for pinyinlize-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc1e9a6bb2b67222448980a2531d3c8152c531d2cedd3763762a8ef2c3c8127c
MD5 31c54fadd03572505c5d05d6ef12b368
BLAKE2b-256 5f448138848e1b88eb579d548ccbfd92f430f2c5a08dfb920f41deb88324372e

See more details on using hashes here.

Supported by

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