Python package for manipulating Chinese phonology.
Project description
Sinophone (三耨風)
sinophone
is a python package that helps to manipulate Chinese phonology. It is divided into two submodules, sinophone.phonetics
and sinophone.phonology
. The former is a general abstraction of IPA symbols and distinctive features which could well be applied to other languages, while the latter is designed specifically to suit the purpose of working with the phonologies of Chinese languages.
Install
pip install sinophone
Example of use
In the following example, I simulated a tiny portion of Shanghainese phonology. Observe how sinophone
can collocate phonemes to create a list of hypothetical syllables, and then pick out the ones that contradict the phonotactic constraint pc
. It also applied a phonological rule when printing the syllable in phonetic transcription as bʊ̃ŋ˥˥
, instead of the phonemic one, boŋ˥˥
.
from sinophone.phonetics import *
from sinophone.phonology import *
# Syllable 音節
kuaq = Syllable(
Initial("k"),
Final(
medial=Medial("ʷ"),
nucleus=Nucleus("ɐ"),
coda=Coda("ʔ"),
),
Tone("˥˥"),
)
kuaq # <Syllable [<Initial 'k'> <Final [<Medial 'ʷ'> <Nucleus 'ɐ'> <Coda 'ʔ'>]> <Tone '˥˥'>]>
lon = Syllable(Initial("l"), Final(nucleus=Nucleus("o"), coda=Coda("ŋ")), Tone("˨˧"))
bo = Syllable(Initial("b"), Final(nucleus=Nucleus("o")), Tone("˨˧"))
# PhonologicalRule 音韻規則
pr = PhonologicalRule(
Nucleus("o"),
IPAString("ʊ̃"),
SyllableFeatures({"Final": {IPAFeatureGroup("+nasal")}}),
)
pr # <PhonologicalRule "o -> ʊ̃ / {'Final': '+nasal'}">
# PhonotacticConstraint 音位排列制約
pc = PhonotacticConstraint(
SyllableFeatures(
{
"Initial": {IPAFeatureGroup("+stop +voiced")},
"Tone": {IPAFeatureGroup("+extra-high-level")},
}
),
PhonotacticAcceptability(False, False),
)
pc # <PhonotacticConstraint {'Initial': '+plosive +voiced', 'Tone': '+extra-high-level'}: {'existent': False, 'grammatical': False}>
# Phonology 音系
phonology = Phonology(
syllables={kuaq, bo, lon},
phonotactics={pc},
phonological_rules=[pr],
)
phonology.initials # {<Initial 'k'>, <Initial 'l'>, <Initial 'b'>}
# automatically collocate to create hypothetical syllables
phonology.collocations
# list of hypothetical syllables contradicting phonotactics
[
syllable.phonetic_ipa_str
for syllable in phonology.collocations
if phonology.render_syllable(syllable).acceptability
!= PhonotacticAcceptability(True, True)
] # [<IPAString 'bo˥˥'>, <IPAString 'bʷɐʔ˥˥'>, <IPAString 'bʊ̃ŋ˥˥'>]
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
Built Distribution
Hashes for sinophone-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae779663a92f37e3147fb854fb1dd540e0373feb708af729ac0e42cde48e1402 |
|
MD5 | 5f3e70fbf9ba05963a91c64d3495a118 |
|
BLAKE2b-256 | 388e1c3421333596f17aba9d38592c8f1470996da5556210d71bfae9ad033348 |