Exemple #1
0
    def __init__(self, low_vowels=None, mid_vowels=None, high_vowels=None, flaps=None, laterals=None, nasals=None,
                 fricatives=None, plosives=None, language=None, break_geminants=False):
        
        self.break_geminants = break_geminants
        
        if language == 'middle english':
            hierarchy = [[] for _ in range(len(set(ME_Syllabifier.values())))]

            for k in ME_Syllabifier:
                hierarchy[ME_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])
        
        elif language == 'old english':
            hierarchy = [[] for _ in range(len(set(OE_Syllabifier.values())))]

            for k in OE_Syllabifier:
                hierarchy[OE_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == 'middle high german':
            hierarchy = [[] for _ in range(len(set(MHG_Syllabifier.values())))]

            for k in MHG_Syllabifier:
                hierarchy[MHG_Syllabifier[k]-1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == "old_norse":
            self.set_hierarchy(OLD_NORSE_HIERARCHY)
            self.set_vowels(OLD_NORSE_HIERARCHY[0])

        else:

            self.low_vowels = [] if low_vowels is None else low_vowels
            self.mid_vowels = [] if mid_vowels is None else mid_vowels
            self.high_vowels = [] if high_vowels is None else high_vowels
            self.vowels = self.low_vowels + self.mid_vowels + self.high_vowels

            self.flaps = [] if flaps is None else flaps
            self.laterals = [] if laterals is None else laterals
            self.nasals = [] if nasals is None else nasals
            self.fricatives = [] if fricatives is None else fricatives
            self.plosives = [] if plosives is None else plosives
            self.consonants = self.flaps + self.laterals + self.fricatives + self.plosives

            # Dictionary indicating sonority hierarchy
            self.hierarchy = {key: 0 for key in self.low_vowels}
            self.hierarchy.update({key: 1 for key in self.mid_vowels})
            self.hierarchy.update({key: 2 for key in self.high_vowels})
            self.hierarchy.update({key: 3 for key in self.flaps})
            self.hierarchy.update({key: 4 for key in self.laterals})
            self.hierarchy.update({key: 5 for key in self.nasals})
            self.hierarchy.update({key: 6 for key in self.fricatives})
            self.hierarchy.update({key: 7 for key in self.plosives})
Exemple #2
0
    def __init__(self, low_vowels=None, mid_vowels=None, high_vowels=None, flaps=None, laterals=None, nasals=None,
                 fricatives=None, plosives=None, language=None, break_geminants=False):
        
        self.break_geminants = break_geminants
        
        if language == 'middle english':
            hierarchy = [[] for _ in range(len(set(ME_Syllabifier.values())))]

            for k in ME_Syllabifier:
                hierarchy[ME_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])
        
        elif language == 'old english':
            hierarchy = [[] for _ in range(len(set(OE_Syllabifier.values())))]

            for k in OE_Syllabifier:
                hierarchy[OE_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == 'middle high german':
            hierarchy = [[] for _ in range(len(set(MHG_Syllabifier.values())))]

            for k in MHG_Syllabifier:
                hierarchy[MHG_Syllabifier[k]-1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == "old_norse":
            self.set_hierarchy(OLD_NORSE_HIERARCHY)
            self.set_vowels(OLD_NORSE_HIERARCHY[0])

        else:

            self.low_vowels = [] if low_vowels is None else low_vowels
            self.mid_vowels = [] if mid_vowels is None else mid_vowels
            self.high_vowels = [] if high_vowels is None else high_vowels
            self.vowels = self.low_vowels + self.mid_vowels + self.high_vowels

            self.flaps = [] if flaps is None else flaps
            self.laterals = [] if laterals is None else laterals
            self.nasals = [] if nasals is None else nasals
            self.fricatives = [] if fricatives is None else fricatives
            self.plosives = [] if plosives is None else plosives
            self.consonants = self.flaps + self.laterals + self.fricatives + self.plosives

            # Dictionary indicating sonority hierarchy
            self.hierarchy = {key: 0 for key in self.low_vowels}
            self.hierarchy.update({key: 1 for key in self.mid_vowels})
            self.hierarchy.update({key: 2 for key in self.high_vowels})
            self.hierarchy.update({key: 3 for key in self.flaps})
            self.hierarchy.update({key: 4 for key in self.laterals})
            self.hierarchy.update({key: 5 for key in self.nasals})
            self.hierarchy.update({key: 6 for key in self.fricatives})
            self.hierarchy.update({key: 7 for key in self.plosives})
Exemple #3
0
    def __init__(self,
                 low_vowels=None,
                 mid_vowels=None,
                 high_vowels=None,
                 flaps=None,
                 laterals=None,
                 nasals=None,
                 fricatives=None,
                 plosives=None,
                 language=None,
                 break_geminants=False):

        self.break_geminants = break_geminants
        self.invalid_onsets = []
        self.invalid_ultima = []

        if language == 'middle_english':
            hierarchy = [[] for _ in range(len(set(ME_Syllabifier.values())))]

            for k in ME_Syllabifier:
                hierarchy[ME_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

            self.invalid_ultima = [
                'a', 'ae', 'æ', 'e', 'ea', 'eo', 'i', 'o', 'u', 'y'
            ]

        elif language == 'old_english':
            hierarchy = [[] for _ in range(len(set(OE_Syllabifier.values())))]

            for k in OE_Syllabifier:
                hierarchy[OE_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == 'middle_high_german':
            hierarchy = [[] for _ in range(len(set(MHG_Syllabifier.values())))]

            for k in MHG_Syllabifier:
                hierarchy[MHG_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == "old_norse":
            self.set_hierarchy(old_norse_hierarchy)
            self.set_vowels(old_norse_hierarchy[0])

        elif language == "old_norse_ipa":
            self.set_hierarchy(ipa_old_norse_hierarchy)
            self.set_vowels(ipa_old_norse_hierarchy[0])

        else:

            self.low_vowels = [] if low_vowels is None else low_vowels
            self.mid_vowels = [] if mid_vowels is None else mid_vowels
            self.high_vowels = [] if high_vowels is None else high_vowels
            self.vowels = self.low_vowels + self.mid_vowels + self.high_vowels

            self.flaps = [] if flaps is None else flaps
            self.laterals = [] if laterals is None else laterals
            self.nasals = [] if nasals is None else nasals
            self.fricatives = [] if fricatives is None else fricatives
            self.plosives = [] if plosives is None else plosives
            self.consonants = self.flaps + self.laterals + self.fricatives + self.plosives

            # Dictionary indicating sonority hierarchy
            self.hierarchy = {key: 0 for key in self.low_vowels}
            self.hierarchy.update({key: 1 for key in self.mid_vowels})
            self.hierarchy.update({key: 2 for key in self.high_vowels})
            self.hierarchy.update({key: 3 for key in self.flaps})
            self.hierarchy.update({key: 4 for key in self.laterals})
            self.hierarchy.update({key: 5 for key in self.nasals})
            self.hierarchy.update({key: 6 for key in self.fricatives})
            self.hierarchy.update({key: 7 for key in self.plosives})
Exemple #4
0
    def __init__(self, low_vowels=None, mid_vowels=None, high_vowels=None, flaps=None, laterals=None, nasals=None,
                 fricatives=None, plosives=None, language=None, break_geminants=False):
        
        self.break_geminants = break_geminants
        self.invalid_onsets = []
        self.invalid_ultima = []
        
        if language == 'middle_english':
            hierarchy = [[] for _ in range(len(set(ME_Syllabifier.values())))]

            for k in ME_Syllabifier:
                hierarchy[ME_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

            self.invalid_ultima = ['a', 'ae', 'æ', 'e', 'ea', 'eo', 'i', 'o', 'u', 'y']
        
        elif language == 'old_english':
            hierarchy = [[] for _ in range(len(set(OE_Syllabifier.values())))]

            for k in OE_Syllabifier:
                hierarchy[OE_Syllabifier[k] - 1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == 'middle_high_german':
            hierarchy = [[] for _ in range(len(set(MHG_Syllabifier.values())))]

            for k in MHG_Syllabifier:
                hierarchy[MHG_Syllabifier[k]-1].append(k)

            self.set_hierarchy(hierarchy)
            self.set_vowels(hierarchy[0])

        elif language == "old_norse":
            self.set_hierarchy(old_norse_hierarchy)
            self.set_vowels(old_norse_hierarchy[0])
            
        elif language == "old_norse_ipa":
            self.set_hierarchy(ipa_old_norse_hierarchy)
            self.set_vowels(ipa_old_norse_hierarchy[0])

        else:

            self.low_vowels = [] if low_vowels is None else low_vowels
            self.mid_vowels = [] if mid_vowels is None else mid_vowels
            self.high_vowels = [] if high_vowels is None else high_vowels
            self.vowels = self.low_vowels + self.mid_vowels + self.high_vowels

            self.flaps = [] if flaps is None else flaps
            self.laterals = [] if laterals is None else laterals
            self.nasals = [] if nasals is None else nasals
            self.fricatives = [] if fricatives is None else fricatives
            self.plosives = [] if plosives is None else plosives
            self.consonants = self.flaps + self.laterals + self.fricatives + self.plosives

            # Dictionary indicating sonority hierarchy
            self.hierarchy = {key: 0 for key in self.low_vowels}
            self.hierarchy.update({key: 1 for key in self.mid_vowels})
            self.hierarchy.update({key: 2 for key in self.high_vowels})
            self.hierarchy.update({key: 3 for key in self.flaps})
            self.hierarchy.update({key: 4 for key in self.laterals})
            self.hierarchy.update({key: 5 for key in self.nasals})
            self.hierarchy.update({key: 6 for key in self.fricatives})
            self.hierarchy.update({key: 7 for key in self.plosives})