从日语 IME 获取更多数据
在我的 C# 表单中,我有一个数据网格视图,我想在其中输入单词或句子的汉字和假名版本,并将它们放在不同的列中。例如:
転寝 | うたたね
寝坊 | ねぼう
我想要实现的是当我提交第一列时自动填充第二列。 我知道有一些词典包含汉字读法,但对于句子来说它会变得复杂,而且还有很多汉字有不止一种读法。 我所知道的是,IME 具有这两种信息,因为在打字时我首先使用平假名,然后将其转换为汉字,所以有没有办法获取用户的原始输入?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,我很确定您无法从 IME 获取更多信息。据我了解,它们的设计方式是在用户选择正确的假名/汉字之前不输入任何内容。
我尝试了一个 WinForms 应用程序,它可以连接任何看起来很有希望的事件,但最终却一无所获。输入由操作系统处理,并在做出选择后返回给应用程序。
我建议做你不想做的事情,获取 JMDict 或类似的东西,并构建一个包含注音假名的内部数据库。除此之外,您可以在 .NET 中实现自己的 IME,它接受英文字符输入并像传统 IME 一样工作。
或者,您可以将您的应用程序更改为基于网络的,并使用现有的 javascript IME 库像这个,这将允许您在转换之前获取平假名。
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.