Skip to main content

Command-line interface (CLI) to create a pronunciation dictionary by looking up pinyin transcriptions using pypinyin including the possibility of ignoring punctuation and splitting words on hyphens before transcribing them.

Project description

dict-from-pypinyin

PyPI PyPI MIT PyPI PyPI DOI

Command-line interface (CLI) to create a pronunciation dictionary by looking up pinyin transcriptions using pypinyin including the possibility of ignoring punctuation and splitting words on hyphens before transcribing them.

Installation

pip install dict-from-pypinyin --user

Usage

dict-from-pypinyin-cli

Example

# Create example vocabulary
cat > /tmp/vocabulary.txt << EOF
社会语言学?
㐻,
『㑐
鲜-亮。
『占斌?
『机具-机呀?
EOF

# Create dictionary from vocabulary
dict-from-pypinyin-cli \
  /tmp/vocabulary.txt \
  /tmp/result.dict \
  --split-on-hyphen

cat /tmp/result.dict

Output:

社会语言学?  shè huì yǔ yán xué ?
社会语言学?  shè huì yǔ yàn xué ?
社会语言学?  shè huì yǔ yín xué ?
社会语言学?  shè huì yù yán xué ?
社会语言学?  shè huì yù yàn xué ?
社会语言学?  shè huì yù yín xué ?
社会语言学?  shè kuài yǔ yán xué ?
社会语言学?  shè kuài yǔ yàn xué ?
社会语言学?  shè kuài yǔ yín xué ?
社会语言学?  shè kuài yù yán xué ?
社会语言学?  shè kuài yù yàn xué ?
社会语言学?  shè kuài yù yín xué ?
㐻,  nèi ,
『㑐  『 shū
鲜-亮。  xiān - liàng 。
鲜-亮。  xiān - liáng 。
鲜-亮。  xiǎn - liàng 。
鲜-亮。  xiǎn - liáng 。
『占斌?  『 zhàn bīn ?
『占斌?  『 zhān bīn ?
『占斌?  『 tiē bīn ?
『机具-机呀?  『 jī jù - jī ya ?
『机具-机呀?  『 jī jù - jī yā ?
『机具-机呀?  『 jī jù - jī xiā ?
『机具-机呀?  『 jī jù - wèi ya ?
『机具-机呀?  『 jī jù - wèi yā ?
『机具-机呀?  『 jī jù - wèi xiā ?
『机具-机呀?  『 wèi jù - jī ya ?
『机具-机呀?  『 wèi jù - jī yā ?
『机具-机呀?  『 wèi jù - jī xiā ?
『机具-机呀?  『 wèi jù - wèi ya ?
『机具-机呀?  『 wèi jù - wèi yā ?
『机具-机呀?  『 wèi jù - wèi xiā ?

Dependencies

  • pronunciation-dictionary >= 0.0.5
  • word-to-pronunciation >= 0.0.1
  • ordered-set >= 4.1.0
  • pypinyin >= 0.47.1, < 0.48
  • tqdm

License

MIT License

Acknowledgments

pypinyin

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – CRC 1410

Citation

If you want to cite this repo, you can use this BibTeX-entry generated by GitHub (see About => Cite this repository).

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

dict-from-pypinyin-0.0.1.tar.gz (103.5 kB view hashes)

Uploaded Source

Built Distribution

dict_from_pypinyin-0.0.1-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

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