pinyin-to-ipa


Namepinyin-to-ipa JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryCommand-line interface (CLI) and Python library to transcribe pinyin to IPA.
upload_time2024-02-09 14:30:08
maintainerStefan Taubert
docs_urlNone
authorStefan Taubert
requires_python<3.13,>=3.8
licenseMIT
keywords pronunciation dictionary chinese ipa pinyin language linguistics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pinyin-to-ipa

[![PyPI](https://img.shields.io/pypi/v/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)
[![PyPI](https://img.shields.io/pypi/pyversions/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)
[![MIT](https://img.shields.io/github/license/stefantaubert/pinyin-to-ipa.svg)](https://github.com/stefantaubert/pinyin-to-ipa/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/wheel/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)
[![PyPI](https://img.shields.io/pypi/implementation/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)
[![PyPI](https://img.shields.io/github/commits-since/stefantaubert/pinyin-to-ipa/latest/master.svg)](https://github.com/stefantaubert/pinyin-to-ipa/compare/v0.0.2...master)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10639971.svg)](https://doi.org/10.5281/zenodo.10639971)

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

## Installation

```sh
pip install pinyin-to-ipa --user
```

## Usage

```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!
```

Usage as library:

```py
from pinyin_to_ipa import pinyin_to_ipa

print(pinyin_to_ipa("hang4"))
# OrderedSet([('x', 'a˥˩', 'ŋ'), ('h', 'a˥˩', 'ŋ')])

print(pinyin_to_ipa("ng"))
# OrderedSet([('ŋ',)])
```

## Phoneme Set

Vowels:

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

Diphthongs:

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

Consonants:

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

Vowels and diphthongs contain one of these tones:

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

¹ These phonemes are not included if only the first transcription is used. \
² These consonants contain also tones.

## References

- [https://en.wikipedia.org/wiki/Help:IPA/Mandarin](https://en.wikipedia.org/wiki/Help:IPA/Mandarin)
- [https://en.wikipedia.org/wiki/Standard_Chinese_phonology](https://en.wikipedia.org/wiki/Standard_Chinese_phonology)
- [https://en.wikipedia.org/wiki/Pinyin](https://en.wikipedia.org/wiki/Pinyin)
- [https://de.wikipedia.org/wiki/Pinyin](https://de.wikipedia.org/wiki/Pinyin)
- Duanmu, San. 2007. The Phonology of Standard Chinese. 2nd ed. Oxford ; New York: Oxford University Press.
- Lin, Yen-Hwei. 2007. The Sounds of Chinese. Cambridge, UK ; New York: Cambridge University Press.

## Acknowledgments

[pypinyin](https://github.com/mozillazg/python-pinyin) \
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. (2024). pinyin-to-ipa (Version 0.0.2) [Computer software]. https://doi.org/10.5281/zenodo.10639971
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pinyin-to-ipa",
    "maintainer": "Stefan Taubert",
    "docs_url": null,
    "requires_python": "<3.13,>=3.8",
    "maintainer_email": "pypi@stefantaubert.com",
    "keywords": "Pronunciation,Dictionary,Chinese,IPA,Pinyin,Language,Linguistics",
    "author": "Stefan Taubert",
    "author_email": "pypi@stefantaubert.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/ce/f4532888ea269ba0d8f70f66b5cf0217bdb615bb600891a0ab0c4ed9dead/pinyin-to-ipa-0.0.2.tar.gz",
    "platform": null,
    "description": "# pinyin-to-ipa\n\n[![PyPI](https://img.shields.io/pypi/v/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)\n[![PyPI](https://img.shields.io/pypi/pyversions/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)\n[![MIT](https://img.shields.io/github/license/stefantaubert/pinyin-to-ipa.svg)](https://github.com/stefantaubert/pinyin-to-ipa/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/wheel/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)\n[![PyPI](https://img.shields.io/pypi/implementation/pinyin-to-ipa.svg)](https://pypi.python.org/pypi/pinyin-to-ipa)\n[![PyPI](https://img.shields.io/github/commits-since/stefantaubert/pinyin-to-ipa/latest/master.svg)](https://github.com/stefantaubert/pinyin-to-ipa/compare/v0.0.2...master)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10639971.svg)](https://doi.org/10.5281/zenodo.10639971)\n\nCommand-line interface (CLI) and Python library to transcribe pinyin to IPA.\nThe tones are attached to the vowel of the syllable.\n\n## Installation\n\n```sh\npip install pinyin-to-ipa --user\n```\n\n## Usage\n\n```txt\nusage: pinyin-to-ipa-cli [-h] [-v] [--sep SEP] [--first] PINYIN\n\nCommand-line interface (CLI) to transcribe pinyin to IPA.\n\npositional arguments:\n  PINYIN         pinyin\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -v, --version  show program's version number and exit\n  --sep SEP      separator between phonemes (default: )\n  --first        return only first result (default: False)\n```\n\n### Example\n\n```sh\n$ pinyin-to-ipa-cli \"pang1\" \np\u02b0a\u02e5\u014b\n$ pinyin-to-ipa-cli \"pang2\" \np\u02b0a\u02e7\u02e5\u014b\n$ pinyin-to-ipa-cli \"pang3\" \np\u02b0a\u02e7\u02e9\u02e7\u014b\n$ pinyin-to-ipa-cli \"pang4\" \np\u02b0a\u02e5\u02e9\u014b\n$ pinyin-to-ipa-cli \"pang5\" \np\u02b0a\u014b\n$ pinyin-to-ipa-cli \"pang\" \np\u02b0a\u014b\n$ pinyin-to-ipa-cli \"h\u00e0ng\" \nxa\u02e5\u02e9\u014b\nha\u02e5\u02e9\u014b\n$ pinyin-to-ipa-cli \"h\u00e0ng\" --first\nxa\u02e5\u02e9\u014b\n$ pinyin-to-ipa-cli \"hng\" \nh\u014b\n$ pinyin-to-ipa-cli \"test\" \nNo IPA transcription available!\n```\n\nUsage as library:\n\n```py\nfrom pinyin_to_ipa import pinyin_to_ipa\n\nprint(pinyin_to_ipa(\"hang4\"))\n# OrderedSet([('x', 'a\u02e5\u02e9', '\u014b'), ('h', 'a\u02e5\u02e9', '\u014b')])\n\nprint(pinyin_to_ipa(\"ng\"))\n# OrderedSet([('\u014b',)])\n```\n\n## Phoneme Set\n\nVowels:\n\n```txt\na\n\u025b\ne\n\u0259\n\u025a\n\u0264\ni\no\nu\n\u028a\ny\n```\n\nDiphthongs:\n\n```txt\nai\u032f\nau\u032f\na\u025a\u032f\u00b9\nei\u032f\nou\u032f\n```\n\nConsonants:\n\n```txt\nf\nh\u00b9\nj\nk\nk\u02b0\nl\nm\nn\np\np\u02b0\n\u0279\u0329\u00b2\n\u027b\u00b2\n\u027b\u0329\u00b2\ns\nt\nts\nts\u02b0\nt\u0255\nt\u0255\u02b0\nt\u02b0\nw\nx\n\u014b\n\u0255\n\u0265\n\u0282\n\u0288\u0282\n\u0288\u0282\u02b0\nz\u0329\u00b9\u00b2\n\u0290\u00b9\u00b2\n\u0290\u0329\u00b9\u00b2\n```\n\nVowels and diphthongs contain one of these tones:\n\n```txt\n\u02e5 (first tone)\n\u02e7\u02e5 (second tone)\n\u02e7\u02e9\u02e7 (third tone)\n\u02e5\u02e9 (fourth tone)\n(none)\n```\n\n\u00b9 These phonemes are not included if only the first transcription is used. \\\n\u00b2 These consonants contain also tones.\n\n## References\n\n- [https://en.wikipedia.org/wiki/Help:IPA/Mandarin](https://en.wikipedia.org/wiki/Help:IPA/Mandarin)\n- [https://en.wikipedia.org/wiki/Standard_Chinese_phonology](https://en.wikipedia.org/wiki/Standard_Chinese_phonology)\n- [https://en.wikipedia.org/wiki/Pinyin](https://en.wikipedia.org/wiki/Pinyin)\n- [https://de.wikipedia.org/wiki/Pinyin](https://de.wikipedia.org/wiki/Pinyin)\n- Duanmu, San. 2007. The Phonology of Standard Chinese. 2nd ed. Oxford\u202f; New York: Oxford University Press.\n- Lin, Yen-Hwei. 2007. The Sounds of Chinese. Cambridge, UK\u202f; New York: Cambridge University Press.\n\n## Acknowledgments\n\n[pypinyin](https://github.com/mozillazg/python-pinyin) \\\nFunded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) \u2013 Project-ID 416228727 \u2013 CRC 1410\n\n## Citation\n\nIf you want to cite this repo, you can use this BibTeX-entry generated by GitHub (see *About => Cite this repository*).\n\n```txt\nTaubert, S. (2024). pinyin-to-ipa (Version 0.0.2) [Computer software]. https://doi.org/10.5281/zenodo.10639971\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Command-line interface (CLI) and Python library to transcribe pinyin to IPA.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/stefantaubert/pinyin-to-ipa",
        "Issues": "https://github.com/stefantaubert/pinyin-to-ipa/issues"
    },
    "split_keywords": [
        "pronunciation",
        "dictionary",
        "chinese",
        "ipa",
        "pinyin",
        "language",
        "linguistics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0aebd46bd56a49b904fd7d1f10ee0b622912ec7c8b6f755ee67a308e8d76c5b",
                "md5": "a23d35f1f87189f9aceb283b82dd5d41",
                "sha256": "5a24382fcd7f40dcd8b3456553e3212c8640934fbbfcb32e2f29f5d02cb0c860"
            },
            "downloads": -1,
            "filename": "pinyin_to_ipa-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a23d35f1f87189f9aceb283b82dd5d41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.8",
            "size": 9944,
            "upload_time": "2024-02-09T14:30:06",
            "upload_time_iso_8601": "2024-02-09T14:30:06.916390Z",
            "url": "https://files.pythonhosted.org/packages/c0/ae/bd46bd56a49b904fd7d1f10ee0b622912ec7c8b6f755ee67a308e8d76c5b/pinyin_to_ipa-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fcef4532888ea269ba0d8f70f66b5cf0217bdb615bb600891a0ab0c4ed9dead",
                "md5": "4690bca9c977367aa9b3a45145510160",
                "sha256": "145342758e971efa19a5d5b07f911efe462bca6ceb4bf8480602658c2b4d4fd7"
            },
            "downloads": -1,
            "filename": "pinyin-to-ipa-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4690bca9c977367aa9b3a45145510160",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.8",
            "size": 52909,
            "upload_time": "2024-02-09T14:30:08",
            "upload_time_iso_8601": "2024-02-09T14:30:08.862231Z",
            "url": "https://files.pythonhosted.org/packages/4f/ce/f4532888ea269ba0d8f70f66b5cf0217bdb615bb600891a0ab0c4ed9dead/pinyin-to-ipa-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-09 14:30:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stefantaubert",
    "github_project": "pinyin-to-ipa",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pinyin-to-ipa"
}
        
Elapsed time: 0.21178s