Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pyspa-bot: phonics, lower, upper command
# phonics
ph = {"a": "アッ", "b": "バッ", "c": "カッ", "d": "ダッ", "e": "", "f": "フッ", "g": "グッ", "h": "ハッ", "i": "", "j": "ジャ", "k": "クッ", "l": "", "m": "", "n": "", "o": "", "p": "パッ", "q": "カッ", "r": "", "s": "", "t": "", "u": "ウッ", "v": "ヴッ", "w": "ウッ", "x": "クス", "y": "ヤッ", "z": ""}
arr = []
for a,b in ph.items():
arr.append(f'rsub("{a}", "{b}",')
result = ''.join(arr) + "{@1}"" + ')' * len(arr)
result
# upper
d = {}
for c in range(97,123):
d[chr(c)] = chr(c-32)
arr = []
for a,b in d.items():
arr.append(f'rsub("{a}", "{b}",')
result = ''.join(arr) + "{@1}" + ')' * len(arr)
result
# lower
d = {}
for c in range(97,123):
d[chr(c-32)] = chr(c)
arr = []
for a,b in d.items():
arr.append(f'rsub("{a}", "{b}",')
result = ''.join(arr) + "{@1}" + ')' * len(arr)
result
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.