Skip to content

Instantly share code, notes, and snippets.

@abishekk92
Last active October 3, 2016 16:03
Show Gist options
  • Save abishekk92/8dae47f445513feec15d98024b59b7be to your computer and use it in GitHub Desktop.
Save abishekk92/8dae47f445513feec15d98024b59b7be to your computer and use it in GitHub Desktop.
Your name in Japanese or so said the WhatsApp forward.
# English to Japanese Dicitionary
jp_eng_str = "A= ka, B= tu, C= mi, D= te, E= ku, F= lu, G= ji, H= ri, I= ki, J= zu, K= me, L= ta, M= rin, N= to, O= mo, P= no, Q= ke, R= shi, S= ari, T= chi, U= do, V= ru, W= mei, X= na, Y= fu, Z= zi"
jp_eng_dict = dict(map(lambda a : a.strip().split("="), jp_eng_str.lower().split(",")))
#Convert an English word to a Japanese word.
to_jp = lambda word : "".join(map(lambda a : jp_eng_dict.get(a, '').strip(), word.lower())).title()
#Convert an English word to a Japanese name.
to_jp_name = lambda name : " ".join(map(to_jp, name.split(" ")))
#example: to_jp_name("Donald Trump")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment