Skip to content

Instantly share code, notes, and snippets.

@pfactum pfactum/
Created Nov 2, 2016

What would you like to do?
#!/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
You can’t perform that action at this time.