简体   繁体   English

如何将日语文本音译为 ASCII (Ruby)

[英]How to transliterate Japanese text to ASCII (Ruby)

I've done some research and can't find any way to transliterate Japanese.我做了一些研究,找不到任何音译日语的方法。

Stringex would have been the best bet, but it's a known issue that it treats Japanese as Mandarin. Stringex 本来是最好的选择,但众所周知,它将日语视为普通话。 I've verified this happens even when there are obvious Japanese characters present (ie kana).我已经验证即使存在明显的日语字符(即假名)也会发生这种情况。 Same for Unidecoder. Unidecoder 也一样。

I realise it's a hard problem as Kanji phonetics are ambiguous, but this is for URL slugs so it doesn't have to be perfect.我意识到这是一个困难的问题,因为汉字语音是模棱两可的,但这是针对 URL slug 的,所以它不必是完美的。

I've never tried it, but you could try this:我从来没有尝试过,但你可以试试这个:

https://github.com/makimoto/romaji https://github.com/makimoto/romaji

"Romaji" is basically the name for system the Japanese themselves use to write in Roman/Latin characters. “罗马字”基本上是日本人自己用罗马/拉丁字符书写的系统名称。 I am not certain if transliterations targetted at romaji for Japanese speakers will be what you need if you are targetting non-Japanese speakers, but it seems like it might be good.如果您的目标是非日语使用者,我不确定针对日语使用者的罗马字音译是否会满足您的需求,但似乎它可能很好。

So you could try romaji in your google searching, that's what I did.所以你可以在你的谷歌搜索中尝试romaji ,这就是我所做的。 Since ruby, of course, originated in Japan, I figured there'd be something around for it.当然,由于 ruby​​ 起源于日本,我认为它会有一些东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM