This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, re | |
latinization = [] | |
prelatin = "абвгґдеєжзиіїйклмнопрстуфхцчшщьюяАБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯ" | |
postlatin = "abvgğdeěžzyiïjklmnoprstufhcčšşʹŭăABVGĞDEĔŽZYIÏJKLMNOPRSTUFHCČŠŞʹŬĂ" | |
for index in range(len(prelatin)): | |
latinization.append([prelatin[index], postlatin[index]]) | |
desoftinization = [] | |
predesoft = "dtzsclnDTZSCLN" | |
postdesoft = "ḋṫżṡċŀṅḊṪŻṠĊĿṄ" | |
for index in range(len(predesoft)): | |
desoftinization.append([predesoft[index] + "ʹ", postdesoft[index]]) | |
deapostrophization = [] | |
predeapostroph = "ăŭěïĂŬĔÏ" | |
postdeapostroph = "ӓüëïÄÜËÏ" | |
for index in range(len(predeapostroph)): | |
deapostrophization.append(["'" + predeapostroph[index], postdeapostroph[index]]) | |
deapostrophization.append(["’" + predeapostroph[index], postdeapostroph[index]]) | |
postvowelization = [] | |
vowels = "aouyieAOUYIEăŭěïĂŬĔÏ" | |
for i in range(len(vowels)): | |
for j in range(len(predeapostroph)): | |
postvowelization.append([vowels[i] + predeapostroph[j], vowels[i] + postdeapostroph[j]]) | |
postspaceization = [] | |
for index in range(len(predeapostroph)): | |
postspaceization.append([" " + predeapostroph[index], " " + postdeapostroph[index]]) | |
poststarting = [] | |
for index in range(len(predeapostroph)): | |
poststarting.append(["^" + predeapostroph[index], postdeapostroph[index]]) | |
for line in sys.stdin: | |
for item in latinization: | |
line = line.replace(item[0], item[1]) | |
for item in desoftinization: | |
line = line.replace(item[0], item[1]) | |
for item in deapostrophization: | |
line = line.replace(item[0], item[1]) | |
for item in postvowelization: | |
line = line.replace(item[0], item[1]) | |
for item in postspaceization: | |
line = line.replace(item[0], item[1]) | |
for item in poststarting: | |
line = re.sub(item[0], item[1], line) | |
print(line, end = "", flush = True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment