3

I am currently working on adding a Japanese Input Method Editor to a software project. I have completed the Romanji character mapping to allow users to type out Hiragana based on the the roman character input.

Example Romanji to Hiragana Mapping

  • LYA=ゃ
  • CHA=ちゃ

At this point, only a series of Hiragana characters can be entered. Is there a public domain / open source Japanese dictionary that the IME can reference to search words? I am still familiarizing myself to Japanese, so any insight you can provide would be appreciated. Thanks!

migrated from japanese.stackexchange.com Aug 1 '16 at 23:55

This question came from our site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language.

  • I suggest moving this question to opendata.stackexchange.com – Nicolas Raoul Aug 3 '16 at 6:16
  • I never could understand why computer input questions like this aren't allowed on the main site, the response has always been like it'd make the site impure or something...there's really only a few of these sorts of questions that are possible anyway, it's not like JLSE would be overrun by them and the expertise in Japanese is here. But, I'm not inclined to fight the tide, off it goes to whereever :D – cypher Aug 3 '16 at 7:11
1

Yes there are, together with the open source IME engines FreeWNN, Anthy and Google's mozc among others.

However, I strongly recommend that you don't do this. Japanese input methods are probably some of the most complicated+difficult to implement input methods in use today, and it's likely that you won't be able to do it unless you have a team behind you who is familiar with the Japanese language.

Even the data files themselves are quite complicated, and what some of the tokens in those files mean is frequently non-obvious. I doubt you would be able to make one which doesn't have considerable conversion and performance issues unless you were strong in Japanese linguistics and data processing (I speak from experience - I tried and failed making one myself, although I learnt a lot in the process :)

Depending on what you want to do, it may be a better idea to use one of those existing three engines. I don't know much about programming bindings to those engines, but I eventually went with communicating with Anthy via its command line interface anthy-agent in a separate thread, which I think works reasonably well.


Here's some background information (to the extent I can remember, some of this is likely in need of correction) in case you're interested. I originally tried to parse Canna's dictionary, which has a number of different directories:

pubdic/

Directory with *.p files in it that have base dictionary words. Of the format [hiragana] [converted] [grammar class] [word frequency], where the grammar classes are defined in the below grammar/ directory.

か 課 #JS 0
か 日 #JS 0
か 価 #JS 1
...

grammar/

Has information about grammar classes, which can link to other grammar points/classes recursively. gram.goto has the format:

T15+    T_GOKAN
T15+    KAKUJOSHI Kno
T15-    Kde

where the + indicates a positive link, and the - indicates a negative link that shouldn't be followed. @... in the right column can indicate to include another grammar point, and ...- in the right column can disinclude another grammar point (although the latter doesn't seem to be used).

gram.code and main.code look like the following, and the gram.goto file links to it. I can't remember exactly how it works I'm afraid, the *.t files in this directory also link together with this file.

Sto     _       と              /* 文末一般に接続 */
Stoka   _   とか      /* 格助詞が後ろに来ない */
Stokoro _       ところ          /* 終,体,助[た]+: 行ったところ */
        ga      ところが        /*                行ったところが */
        de      ところで        /*                行ったところで */

shion/ and words/

Has more dictionary words, which also link to the grammar classes. *.ctd/*.t files are of the format [hiragana] [grammar class](*[relative frequency]) [converted], with the relative frequency being optional and not in all files:

あいえんか #T35*76 愛煙家
あいおい #T35*76 相生
あいか #T35*76 哀歌
あいかぎ #T35*76 合鍵

Again though, I think some of the grammar tokens have a special meaning which is hardcoded in Canna itself, and you really need to have a good knowledge of Japanese+ability to go through their source code to be able to make sure it all works correctly (which I was lacking at the time of my attempt).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .