Created
April 18, 2019 08:25
-
-
Save shiumachi/c89102e7e7f2a98c802fc37e5c58e99e to your computer and use it in GitHub Desktop.
pyspa-bot: phonics, lower, upper command
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
# 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