How to use the cltk.phonology.greek.transcription.Phone function in cltk

To help you get started, we’ve selected a few cltk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _nasal_place_assimilation(self):
        # Pronounce nasals/g as velar nasals when followed by velar.
        out_phones = self.phones
        target = Phone("ŋ")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if (p.nas or p.ipa == 'g') and p.right.vel:
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def __init__(self, ipa_str, root):
        self.string = unicodedata.normalize('NFC', ipa_str)
        # Appropriate directory in the reconstruction dictionary
        self.root = root  
        # list of contextual pronunciation alternations
        self.alts = self.root['alternations']

        # Turns string of IPA characters into list of Phones
        self.phones = [Phone(c) for c in 
            re.findall(r'.[̥́̂ʰ]?ː?', self.string)]
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _r_devoice(self):
        # Pronounce r as voiceless word-init or after another r.
        out_phones = self.phones
        target = Phone("r̥")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.left.bound and p.ipa == "r":
                out_phones[n] = target
            if p.left.ipa == "r" and p.ipa == "r":
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _refresh(self):
        # Assigns left and right contexts for every phone
        for n in range(len(self.phones)):
            p = self.phones[n]
            if n != 0:
                p.left = self.phones[n - 1]
            else:
                p.left = Phone("#")
            if n != len(self.phones) - 1:
                p.right = self.phones[n + 1]
            else:
                p.right = Phone("#")
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _s_voice_assimilation(self):
        # Pronounce s as voiced (z) when followed by voiced.
        out_phones = self.phones
        target = Phone("z")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.ipa == "s" and p.right.vce:
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _refresh(self):
        # Assigns left and right contexts for every phone
        for n in range(len(self.phones)):
            p = self.phones[n]
            if n != 0:
                p.left = self.phones[n - 1]
            else:
                p.left = Phone("#")
            if n != len(self.phones) - 1:
                p.right = self.phones[n + 1]
            else:
                p.right = Phone("#")
github cltk / cltk / cltk / phonology / greek / transcription.py View on Github external
def _g_nasality_assimilation(self):
        # Pronounce g as (velar) nasal when followed by nasal.
        out_phones = self.phones
        target = Phone("ŋ")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.ipa == "g" and p.right.nas:
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()