Skip to content

Proto-Slavic flavorzation #3

@noomorph

Description

@noomorph

@bt2901 suggests to add Proto-Slavic flavorization:

VOWELS = 'aeiouyęěǫъь'
CONSONANTS = 'bcdgjklmnprstvxzčďľňřśšťž'

def classify_yers(word):
    # See: https://en.wikipedia.org/wiki/Havlík%27s_law
    vowels_pos = [i for i, s in enumerate(word) if s in VOWELS]
    is_weak = True
    classified_vowels = []
    for i in reversed(vowels_pos):
        vowel = word[i]
        if vowel not in ["ь", "ъ"]:
            is_weak = True
        else:
            vowel = vowel if is_weak else vowel.upper()
            is_weak = not is_weak
        classified_vowels.append(vowel)
    word_as_arr = list(word)
    for i, v in zip(vowels_pos, reversed(classified_vowels)):
        word_as_arr[i] = v
    return "".join(word_as_arr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions