A python library to check phonetic transcriptions
Cross-Linguistic Transcription Systems
This is an attempt to create a system that allows to translate and compare different phonetic transcription systems.
For starters, try this quick example:
>>> from __future__ import unicode_literals >>> from pyclts import TranscriptionSystem as TS >>> bipa = TS('bipa') # broad IPA >>> asjp = TS('asjpcode') # asjp transcription system >>> snd1 = bipa['ts'] >>> snd2 = asjp['c'] >>> snd1.name 'voiceless alveolar sibilant affricate consonant' >>> snd2.name 'voiceless alveolar sibilant affricate consonant' >>> bipa.translate('ts a ŋ ə', asjp) 'c E N 3' >>> asjp.translate('C a y', bipa) 'tʃ ɐ j'
You can see that internally, we represent the sounds
c, depending on the alphabet from which they are taken.
Another example is to parse a sound that is not yet in our database. We will try to create this sound automatically and infer its features from the set of diacritics and the base sound:
>>> sound = bipa['dʱʷ'] >>> sound.name 'labialized breathy voiced alveolar stop consonant' >>> sound.generated True >>> sound.alias True >>> print(sound) dʷʱ >>> print(sound.uname) LATIN SMALL LETTER D / MODIFIER LETTER SMALL W / MODIFIER LETTER SMALL H WITH HOOK >>> print(sound.codepoints) U+0064 U+02b7 U+02b1
You can see, since we represent breathy-voice phonation differently, we flag this sound as an alias. Also since it is not yet in our database explicitly coded, we flag it as a "generated" sound. In a similar way, you can generate sounds from their names:
>>> sound = bipa['pre-aspirated voiced aspirated bilabial stop consonant'] >>> print(sound) ʰbʰ >>> sound.generated True >>> sound.name 'pre-aspirated aspirated voiced bilabial plosive consonant'
Note that this sound probably does not exist in any language, but we generate it from the feature components. Note also that the
name that is automatically given for the sound automatically orders how the features are put together to form the sound identifier. In principle, our features bundles are unordered, but we try to decide for some explicit order of features to enhance comparison.
You can also use our transcription data to convert from one transcription system to a given dataset (note that backwards-conversion may not be possible, as transcription data is often limited):
>>> from pyclts import TranscriptionSystem, SoundClasses >>> bipa = TranscriptionSystem('bipa') >>> sca = SoundClasses('sca') >>> bipa.translate('f a: t ə r', sca) 'B A T E R'
But the translation can even be done in a much simpler way, by loading the transcription data directly:
>>> sca = SoundClasses('sca') >>> sca('v a t ə r') ['B', 'A', 'T', 'E', 'R']
Basic Structure of the Package
pyclts package offers three basic types of data generated and managed in Python code:
- transcription systems (
pyclts.transcriptionsystems.TranscriptionSystem), a system that can generate sounds
- transcription data (
pyclts.transcriptiondata.TranscriptionData): a dataset with a fixed number of sounds
- sound classes (
pyclts.soundclasses.SoundClasses): a dataset with a direct mapping from sounds to a concrete character (the sound class)
Transcription data is linked to our transcription system by the grapheme for the B(road) IPA transcription system, which serves as our default, and the name, which follows the IPA conventions with some modifications which were needed to make sure that we can represent sounds that we regularly find in cross-linguistic datasets.
||this refers to one-to-one character replacement with obviously wrong unicode lookalikes||
|alias||transcription system data (
||this refers to "free" IPA variants that are widely used and are therefore officially accepted for "broad ipa" or any other TS, but one variant is usually chosen as the preferred one||
||the unnormalized form as it is given to the TS||
||the normalized form which has not been resolved by an alias||```bipa['ʦ'].grapheme == 'ʦ'|
||the normalized form in which a potential alias is replaced by its "accepted" counterpart||
||the canonical representation of the feature system that defines a sound, with the sound class (consonant, cluster, vowel, diphthong) in the end, and the feature bundle following the order given in the
||If a sound is not yet know to a given TS, the algorithm tries to generate it by de-composing it into its base part and adding features to the left and to the right, based on the diacritics. If a sound has been generated, this is traced with help of the attribute. Normally, generated sounds need to be double-checked by the experts, as their grapheme representation may be erroneous. Thus, while the sound
||if a sound is being generated, the parsing algorithm first tries to identify the potential "base" of the sound, i.e., a sound that is already known and explicitly defined in a given transcription system. Based on this base sound, the grapheme is then constructed by following the diacritics to the left and to the right. If the so-constructed feature bundle already exists in the transcription system, the constructed sound is treated as an alias, if it does not exist, the sound is only marked as being generated.||