pinyin-to-ipa

Command-line interface and Python library to transcribe pinyin to IPA. The tones are attached to the vowel of the syllable.

https://github.com/stefantaubert/pinyin-to-ipa

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.6%) to scientific vocabulary

Keywords

bopomofo chinese cyrillic international-phonetic-alphabet linguistics phonetics pinyin speech-recognition speech-synthesis transcription tts zhuyin
Last synced: 6 months ago · JSON representation ·

Repository

Command-line interface and Python library to transcribe pinyin to IPA. The tones are attached to the vowel of the syllable.

Basic Info
Statistics
  • Stars: 45
  • Watchers: 2
  • Forks: 10
  • Open Issues: 2
  • Releases: 2
Topics
bopomofo chinese cyrillic international-phonetic-alphabet linguistics phonetics pinyin speech-recognition speech-synthesis transcription tts zhuyin
Created about 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md

pinyin-to-ipa

CI codecov PyPI Python versions License: MIT \ PyPI Downloads Hugging Face 🤗 DOI

A Python library, web application, and command-line tool for transcribing Pinyin to IPA.
Tone markers are attached to the vowel of each syllable.

Getting started

Installation

sh pip install pinyin-to-ipa[app] --user

Usage as library

```py from pinyintoipa import pinyintoipa

print(pinyintoipa("hang4"))

OrderedSet([('x', 'a˥˩', 'ŋ'), ('h', 'a˥˩', 'ŋ')])

print(pinyintoipa("ng"))

OrderedSet([('ŋ',)])

```

Usage as web app

Start the web app from the command-line:

sh $ pinyin-to-ipa-app

Or visit 🤗 Hugging Face for a live demo.

Screenshot Hugging Face

Usage as CLI

sh $ pinyin-to-ipa-cli

```txt usage: pinyin-to-ipa-cli [-h] [-v] [--sep SEP] [--first] PINYIN

Command-line interface (CLI) to transcribe pinyin to IPA.

positional arguments: PINYIN pinyin

optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit --sep SEP separator between phonemes (default: ) --first return only first result (default: False) ```

Example

sh $ pinyin-to-ipa-cli "pang1" pʰa˥ŋ $ pinyin-to-ipa-cli "pang2" pʰa˧˥ŋ $ pinyin-to-ipa-cli "pang3" pʰa˧˩˧ŋ $ pinyin-to-ipa-cli "pang4" pʰa˥˩ŋ $ pinyin-to-ipa-cli "pang5" pʰaŋ $ pinyin-to-ipa-cli "pang" pʰaŋ $ pinyin-to-ipa-cli "hàng" xa˥˩ŋ ha˥˩ŋ $ pinyin-to-ipa-cli "hàng" --first xa˥˩ŋ $ pinyin-to-ipa-cli "hng" hŋ $ pinyin-to-ipa-cli "test" No IPA transcription available!

Phoneme set

Vowels

txt a ɛ e ə ɚ ɤ i o ɔ u ʊ y

Diphthongs

txt ai̯ au̯ aɚ̯¹ ei̯ ou̯

¹ These phonemes are not included if only the first transcription is used.

Consonants

txt f h¹ j k kʰ l m n ŋ p pʰ ɹ̩² ɻ² ɻ̩² s ʂ t tʰ ts tsʰ tɕ tɕʰ ʈʂ ʈʂʰ w x ɕ ɥ z̩¹² ʐ¹² ʐ̩¹²

² These consonants contain also tones.

Tones

Vowels and diphthongs contain one of these tones:

txt ˥ (first tone) ˧˥ (second tone) ˧˩˧ (third tone) ˥˩ (fourth tone) (none)

References

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).

txt Taubert, S. (2025). pinyin-to-ipa (Version 1.0.0) [Computer software]. https://doi.org/10.5281/zenodo.15229718

Owner

  • Name: Stefan Taubert
  • Login: stefantaubert
  • Kind: user
  • Location: Chemnitz, Germany
  • Company: Chemnitz University of Technology

Currently I am working on my PhD about the topic of speech synthesis at Chemnitz University of Technology.

Citation (CITATION.cff)

cff-version: 1.2.0
title: pinyin-to-ipa
abstract: A Python library, web application, and command-line tool for transcribing Pinyin to IPA. Tone markers are attached to the vowel of each syllable.
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Stefan
    family-names: Taubert
    affiliation: Chemnitz University of Technology
    orcid: 'https://orcid.org/0000-0002-4932-2874'
    website: 'https://stefantaubert.com'
version: 1.0.0
date-released: 2025-04-16
license: MIT
url: https://github.com/stefantaubert/pinyin-to-ipa
doi: 10.5281/zenodo.15229718

GitHub Events

Total
  • Release event: 1
  • Watch event: 15
  • Push event: 23
  • Fork event: 3
  • Create event: 1
Last Year
  • Release event: 1
  • Watch event: 15
  • Push event: 23
  • Fork event: 3
  • Create event: 1

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 3
  • Total pull requests: 0
  • Average time to close issues: 7 days
  • Average time to close pull requests: N/A
  • Total issue authors: 2
  • Total pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lars76 (2)
  • fishfree (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 724 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 3
  • Total maintainers: 1
pypi.org: pinyin-to-ipa

A Python library, web application, and command-line tool for transcribing Pinyin to IPA. Tone markers are attached to the vowel of each syllable.

  • Homepage: https://github.com/stefantaubert/pinyin-to-ipa
  • Documentation: https://pinyin-to-ipa.readthedocs.io/
  • License: MIT License Copyright (c) 2025 Stefan Taubert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 1.0.0
    published 10 months ago
  • Versions: 3
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 724 Last month
Rankings
Dependent packages count: 10.0%
Dependent repos count: 21.7%
Average: 26.7%
Forks count: 29.8%
Stargazers count: 31.9%
Downloads: 40.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

Pipfile.lock pypi
  • astroid ==2.12.13 develop
  • attrs ==22.2.0 develop
  • autoflake ==2.0.0 develop
  • autopep8 ==2.0.1 develop
  • bleach ==5.0.1 develop
  • build ==0.9.0 develop
  • cachetools ==5.2.0 develop
  • certifi ==2022.12.7 develop
  • cffi ==1.15.1 develop
  • chardet ==5.1.0 develop
  • charset-normalizer ==2.1.1 develop
  • colorama ==0.4.6 develop
  • commonmark ==0.9.1 develop
  • cryptography ==39.0.0 develop
  • dill ==0.3.6 develop
  • distlib ==0.3.6 develop
  • docutils ==0.19 develop
  • exceptiongroup ==1.1.0 develop
  • filelock ==3.9.0 develop
  • idna ==3.4 develop
  • importlib-metadata ==6.0.0 develop
  • importlib-resources ==5.10.2 develop
  • iniconfig ==1.1.1 develop
  • isort ==5.11.4 develop
  • jaraco.classes ==3.2.3 develop
  • jeepney ==0.8.0 develop
  • keyring ==23.13.1 develop
  • lazy-object-proxy ==1.9.0 develop
  • mccabe ==0.7.0 develop
  • more-itertools ==9.0.0 develop
  • ordered-set ==4.1.0 develop
  • packaging ==22.0 develop
  • pep517 ==0.13.0 develop
  • pinyin-to-ipa * develop
  • pkginfo ==1.9.4 develop
  • platformdirs ==2.6.2 develop
  • pluggy ==1.0.0 develop
  • pycodestyle ==2.10.0 develop
  • pycparser ==2.21 develop
  • pyflakes ==3.0.1 develop
  • pygments ==2.14.0 develop
  • pylint ==2.15.9 develop
  • pypinyin ==0.47.1 develop
  • pyproject-api ==1.4.0 develop
  • pytest ==7.2.0 develop
  • pytoolconfig ==1.2.4 develop
  • readme-renderer ==37.3 develop
  • requests ==2.28.1 develop
  • requests-toolbelt ==0.10.1 develop
  • rfc3986 ==2.0.0 develop
  • rich ==13.0.0 develop
  • rope ==1.6.0 develop
  • secretstorage ==3.3.3 develop
  • six ==1.16.0 develop
  • tomli ==2.0.1 develop
  • tomlkit ==0.11.6 develop
  • tox ==4.2.4 develop
  • twine ==4.0.2 develop
  • typing-extensions ==4.4.0 develop
  • urllib3 ==1.26.13 develop
  • virtualenv ==20.17.1 develop
  • webencodings ==0.5.1 develop
  • wrapt ==1.14.1 develop
  • zipp ==3.11.0 develop
  • ordered-set ==4.1.0
  • pypinyin ==0.47.1
Pipfile pypi
  • autoflake * develop
  • autopep8 * develop
  • build * develop
  • isort * develop
  • pinyin-to-ipa * develop
  • pycodestyle * develop
  • pylint * develop
  • pytest * develop
  • rope * develop
  • tox * develop
  • twine * develop
  • ordered-set >=4.1.0
  • pypinyin >=0.47.1, <0.48
pyproject.toml pypi
  • ordered-set >=4.1.0
  • pypinyin >=0.50