Created
November 8, 2019 16:10
-
-
Save tamuhey/c7147890b77d9b1fe7b64c75300db0d4 to your computer and use it in GitHub Desktop.
拗音を促音に変換する
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
import string | |
LOWER = "ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮ" | |
UPPER = "あいうえおつやゆよわアイウエオツヤユヨワ" | |
MAP = str.maketrans(dict(zip(LOWER, UPPER))) | |
def ja_upper(text: str) -> str: | |
return text.translate(MAP) | |
assert ja_upper("きょう") == "きよう" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment