Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proto-Slavic flavorzation #3

Open
noomorph opened this issue Apr 15, 2023 · 0 comments
Open

Proto-Slavic flavorzation #3

noomorph opened this issue Apr 15, 2023 · 0 comments

Comments

@noomorph
Copy link
Contributor

@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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant