Created
November 27, 2015 09:54
-
-
Save lasta/3d0923c3ab451295fe19 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
#! /bin/sh | |
# coding: utf-8 | |
""":" | |
exec python "$0" ${1+"$@"} | |
""" | |
# 直接入力をかな入力で入力されたと想定して変換します | |
# 濁音、半濁音には対応していません | |
import sys | |
translate_table = { | |
"1" : "ぬ", | |
"2" : "ふ", | |
"3" : "あ", | |
"4" : "う", | |
"5" : "え", | |
"6" : "お", | |
"7" : "や", | |
"8" : "ゆ", | |
"9" : "よ", | |
"0" : "わ", | |
"-" : "ほ", | |
"^" : "へ", | |
"\\" : "ー", | |
"!" : "ぬ", | |
'"' : "ふ", | |
"#" : "ぁ", | |
"$" : "ぅ", | |
"%" : "ぇ", | |
"&" : "ぉ", | |
"'" : "ゃ", | |
"(" : "ゅ", | |
")" : "ょ", | |
"0" : "を", | |
"=" : "ー", | |
"~" : "ゑ", | |
"|" : "ー", | |
"q" : "た", | |
"w" : "て", | |
"e" : "い", | |
"r" : "す", | |
"t" : "か", | |
"y" : "ん", | |
"u" : "な", | |
"i" : "に", | |
"o" : "ら", | |
"p" : "せ", | |
"@" : "゛", | |
"[" : "゜", | |
"Q" : "た", | |
"W" : "て", | |
"E" : "ぃ", | |
"R" : "す", | |
"T" : "か", | |
"Y" : "ん", | |
"U" : "な", | |
"I" : "に", | |
"O" : "ら", | |
"P" : "せ", | |
"`" : "゛", | |
"{" : "「", | |
"a" : "ち", | |
"s" : "と", | |
"d" : "し", | |
"f" : "は", | |
"g" : "き", | |
"h" : "く", | |
"j" : "ま", | |
"k" : "の", | |
"l" : "り", | |
";" : "れ", | |
":" : "け", | |
"]" : "む", | |
"A" : "ち", | |
"S" : "と", | |
"D" : "し", | |
"F" : "は", | |
"G" : "き", | |
"H" : "く", | |
"J" : "ま", | |
"K" : "の", | |
"L" : "り", | |
"+" : "れ", | |
"*" : "ヶ", | |
"}" : "」", | |
"z" : "つ", | |
"x" : "さ", | |
"c" : "そ", | |
"v" : "ひ", | |
"b" : "こ", | |
"n" : "み", | |
"m" : "も", | |
"," : "ね", | |
"." : "る", | |
"/" : "め", | |
"_" : "ろ", | |
"Z" : "っ", | |
"X" : "さ", | |
"C" : "そ", | |
"V" : "ゐ", | |
"B" : "こ", | |
"N" : "み", | |
"M" : "も", | |
"<" : "、", | |
">" : "。", | |
"?" : "・", | |
"_" : "ろ" | |
} | |
input_line = sys.argv[1] | |
def r2k(c) : | |
return translate_table[c] | |
print "".join(map(r2k, input_line)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment