Last active
March 25, 2025 16:13
-
-
Save Blayung/f7380fc78521140369f40b9efd07ede1 to your computer and use it in GitHub Desktop.
Russian to Polish transcription python script
This file contains hidden or 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
#!/bin/python3 | |
import os | |
russianToPolishMap = { | |
"а": "a", | |
"б": "b", | |
"в": "w", | |
"г": "g", | |
"д": "d", | |
"е": "ie", | |
"ё": "io", | |
"ж": "ż", | |
"з": "z", | |
"и": "i", | |
"й": "j", | |
"к": "k", | |
"л": "l", | |
"м": "m", | |
"н": "n", | |
"о": "o", | |
"п": "p", | |
"р": "r", | |
"с": "s", | |
"т": "t", | |
"у": "u", | |
"ф": "f", | |
"х": "ch", | |
"ц": "c", | |
"ч": "cz", | |
"ш": "sz", | |
"щ": "szcz", | |
"ъ": "\"", | |
"ы": "y", | |
"ь": "'", | |
"э": "e", | |
"ю": "iu", | |
"я": "ia", | |
"«": "\"", | |
"»": "\"" | |
} | |
for entry in os.listdir(): | |
if os.path.isdir(entry): | |
inputText = open(os.path.join(entry, "input.txt"), "r").read().lower() | |
outputText = [] | |
for letter in inputText: | |
try: | |
outputText.append(russianToPolishMap[letter]) | |
except KeyError: | |
outputText.append(letter) | |
open(os.path.join(entry, "output.txt"), "w").write("".join(outputText).replace(" czto ", " szto ")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment