10

Input:

日本が好きです.

Output:

Nippon ga sukidesu.

Phonetical reading is unfortunately not available through Google Translate API.

jogojapan
  • 68,383
  • 11
  • 101
  • 131
Arman
  • 1,074
  • 3
  • 20
  • 40
  • 2
    It's very hard to get this correct/the way you want, since readings are ambiguous. Your example may as well be read as *"nihon ga suki desu"*... – deceze Apr 29 '11 at 03:23
  • Agreed, it is hard, but online tools such as http://www.romaji.org, http://nihongo.j-talk.com/kanji/ do exist. If only had they had API =) – Arman Apr 29 '11 at 10:55
  • 1
    @deceze absolutely, in fact, it should be read as "nihon..." for any normal usage. You might find a few 80-year old people or politicians in Japan to say "Nippon" but otherwise it's extinct. – PandaWood Apr 29 '11 at 21:03

2 Answers2

17

KAKASI is a good, simple tool for what you want to do:

% echo "日本が好きです。" | iconv -f utf8 -t eucjp | kakasi -i euc -Ha -Ka -Ja -Ea -ka
nippongasukidesu.

% echo "日本が好きです。" | iconv -f utf8 -t eucjp | kakasi -i euc -w | kakasi -i euc -Ha -Ka -Ja -Ea -ka
nippon ga suki desu .

Or another solution is to use Yahoo! JAPAN's Japanese Language Processing API. But it might be difficult to use because you need to sign up for Yahoo! JAPAN and register for the API key before using it and the documents are only available in Japanese.

yibe
  • 3,939
  • 2
  • 24
  • 17
  • Does anyone know how to use it with Android Java? Thanks – Bo. Aug 04 '11 at 11:00
  • 1
    @Bo. This is the topic of another question: http://stackoverflow.com/questions/8904249/kanji-to-romaji-converter-java-open-source – Nicolas Raoul Jan 18 '12 at 02:08
  • Thanks for these commands, I was having a hard time understanding kakasi's --help. How come you have to pipe 2 commands in order to use the `-w` option ? – Sébastien May 05 '13 at 17:19
  • @yibe how to pass the romaji `nippon ga suki desu .` and convert back to the `日本が好きです。`? – loretoparisi Feb 15 '16 at 16:04
  • @yibe I have tried the Yahoo! API but not sure how to do this using the conversion endpoint i.e. http://developer.yahoo.co.jp/webapi/jlp/jim/v1/conversion.html – loretoparisi Feb 17 '16 at 17:34
0

Phonetical reading is unfortunately not available through Google Translate API.

Google translate does have that feature - Copy and paste that string into the box, and click "Read Phonetically" which is directly underneath the input text field. It will show you your exact output. It can also verbally read that string to you if you click "Listen".

http://translate.google.com/#

jiman
  • 270
  • 1
  • 3
  • 8
  • 2
    True, it's available in Google Translate, but not available through Google Translate API. I need to convert to romaji about 500,000 sentences, so looking for tools I can use in my conversion script. Sorry for not making it clear. – Arman Apr 29 '11 at 03:23