Command-line interface (CLI) and Python library to transcribe pinyin to IPA.
Project description
pinyin-to-ipa
Command-line interface (CLI) and Python library to transcribe pinyin to IPA. The tones are attached to the vowel of the syllable.
Installation
pip install pinyin-to-ipa --user
Usage
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
$ 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!
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
a
aɚ̯
ai̯
au̯
e
ei̯
f
h
i
j
k
kʰ
l
m
n
o
ou̯
p
pʰ
s
t
ts
tsʰ
tɕ
tɕʰ
tʰ
u
w
x
y
ŋ
ɕ
ə
ɚ
ɛ
ɤ
ɥ
ɹ̩
ɻ
ɻ̩
ʂ
ʈʂ
ʈʂʰ
ʊ
z̩
ʐ
ʐ̩
Vowels and diphthongs contain one of these tones:
˥ (first tone)
˧˥ (second tone)
˧˩˧ (third tone)
˥˩ (fourth tone)
(none)
Dependencies
ordered-set >= 4.1.0
pypinyin = ">=0.47.1, <0.48"
License
MIT License
References
- https://en.wikipedia.org/wiki/Help:IPA/Mandarin
- https://en.wikipedia.org/wiki/Standard_Chinese_phonology
- https://en.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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pinyin-to-ipa-0.0.1.tar.gz
(22.7 kB
view hashes)
Built Distribution
Close
Hashes for pinyin_to_ipa-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1a2b389cc2e320764668d4a38bfb6a658a57ad4521ce73d6e673177ea43951c |
|
MD5 | af3e93647433e89b21ab82baddc8707c |
|
BLAKE2b-256 | b3d3b85bfaebce7e1586ff805c883d3687ce2704fef56577292a51ee9a478755 |