diff --git a/wtf_tradition/to_hankaku.py b/wtf_tradition/to_hankaku.py new file mode 100644 index 0000000..b2a28a4 --- /dev/null +++ b/wtf_tradition/to_hankaku.py @@ -0,0 +1,11 @@ +import argparse +import unicodedata +# TODO: normalizeなので半角カナが残らない + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("zenkaku") + args = parser.parse_args() + + hankaku = unicodedata.normalize("NFKD", args.zenkaku) + print(hankaku) diff --git a/wtf_tradition/to_zenkaku.py b/wtf_tradition/to_zenkaku.py new file mode 100644 index 0000000..cd38f92 --- /dev/null +++ b/wtf_tradition/to_zenkaku.py @@ -0,0 +1,16 @@ +""" +$ python to_zenkaku.py spam42ハム +spam42ハム +""" + +import argparse + +import jaconv + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("hankaku") + args = parser.parse_args() + + zenkaku = jaconv.h2z(args.hankaku, kana=True, ascii=True, digit=True) + print(zenkaku)