How to use the cltk.phonology.latin.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 / latin / transcription.py View on Github external
def _e_i_closer_before_vowel(self):
        # e and i become closer (̣) when followed by a vowel.
        out_phones = self.phones
        for n in range(len(self.phones)):
            p = self.phones[n]
            if (p.ipa == "ɛ" or p.ipa == "ɪ") and p.right.vow:
                out_phones[n] = Phone(p.ipa + "̣")
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _final_m_drop(self):
        # Final m nasalizes and lengthens nucleus and drops.
        out_phones = self.phones
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.left.vow and p.ipa == 'm' and p.right.bound:
                out_phones[n-1] = Phone(p.left.ipa + "̃ː")
                del out_phones[n]
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _uj_diph_maker(self):
        # Find accidental "ʊɪ" instances and treat as diphthong [uj].
        out_phones = self.phones
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.left.ipa == 'ʊ' and p.ipa == 'ɪ':
                out_phones[n-1] = Phone('u')
                out_phones[n] = Phone('j')
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _j_maker(self):
        # Assume word-initial or intervocalic i to be j
        out_phones = self.phones
        target = Phone("j")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.ipa == 'ɪ' and ((p.left.bound and p.right.vow)
                    or (p.left.vow and p.right.vow)):
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _uj_diph_maker(self):
        # Find accidental "ʊɪ" instances and treat as diphthong [uj].
        out_phones = self.phones
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.left.ipa == 'ʊ' and p.ipa == 'ɪ':
                out_phones[n-1] = Phone('u')
                out_phones[n] = Phone('j')
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _ns_nf_lengthening(self):
        # Lengthen vowel before ns or nf.
        out_phones = self.phones
        for n in range(len(self.phones)):
            p = self.phones[n]
            if (p.left.vow and "ː" not in p.left.ipa and p.ipa == "n̪" 
                    and (p.right.ipa == "s" or p.right.ipa == "f")):
                out_phones[n-1] = Phone(p.left.ipa + "ː")
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / 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 / latin / transcription.py View on Github external
def _long_vowel_catcher(self):
        # Replace ɪː with iː, ʊː with uː, and ɛː with eː.
        out_phones = self.phones
        target_dict = {'ɪː': 'iː', 'ʊː': 'uː', 'ɛː': 'eː',
                        'ɪ̃ː': 'ĩː', 'ʊ̃ː': 'ũː', 'ɛ̃ː': 'ẽː'}
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.ipa in target_dict.keys():
                out_phones[n] = Phone(target_dict[p.ipa])
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _wj_block(self):
        # Addendum to correct possible 'wj' sequences
        out_phones = self.phones
        target = Phone("ɪ")
        for n in range(len(self.phones)):
            p = self.phones[n]
            if p.left.ipa == 'w' and p.ipa == 'j':
                out_phones[n] = target
        self.phones = out_phones
        self._refresh()
github cltk / cltk / cltk / phonology / latin / transcription.py View on Github external
def _refresh(self):
        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("#")