Getting more data from the Japanese IME

一曲冷凌霜 提交于 2019-12-06 12:02:29

问题


In my c# form I have a data grid view where I want to input both kanji and kana version of a word or sentence, putting them in different columns. For example:

転寝 | うたたね
寝坊 | ねぼう

What I want to achieve is having the second column automatically filled when I commit on the first one. I know there are dictionaries containing kanji readings but for sentences it gets complicated, and also there are many kanji with more than one reading. What I know is that the IME has both informations because while typing I first use hiragana and then convert it to kanji so, is there a way to get the original input of the user?


回答1:


Unfortunately I'm pretty sure you can't get anymore information from the IME. As I understand it, they are designed in such a way to not enter in anything before the user has selected the correct kana/kanji.

I had a play with a WinForms app hooking up any events that looked promising and came back with nothing. The input is handled by the OS and handed back to the application once the selection is made.

I would suggest doing what you don't want to do and grabbing JMDict or something similar and building an internal database containing the furigana. On top of this you could implement your own IME in .NET that accepts English character input and acts as a traditional IME does.

Alternatively you could change your application to be web based and use an existing javascript IME library like this one which will allow you to grab the hiragana before it is converted.



来源:https://stackoverflow.com/questions/6095535/getting-more-data-from-the-japanese-ime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!