iOS 日文手写输入代码 请帮忙
我有一系列关于为 iOS 编写代码的问题,包括日语的手写识别。我是初学者,所以要温柔,假设我很愚蠢......
我想用平假名(日语音标)呈现一个日语单词,然后让用户手写适当的汉字(中文字符)。然后,在内部将其与正确的字符进行比较。然后,用户获得反馈(无论正确与否)。
我的问题围绕手写输入。 我知道通常如果使用中文键盘,这种类型的输入是可能的。
我怎样才能在不使用键盘本身的情况下建立类似的东西?是否已经有这方面的库函数(我觉得一定有,因为中文键盘上可以输入)?
此外,汉字与汉字并不完全相同。日本人自己发明了一些独特的字符。我如何才能将这些包含在我的手写识别中?
I have a series of questions about writing code for iOS and including handwritten recognition of japanese. I am a beginner, so be gentle and assume I am stupid ...
I'd like to present a japanese word in hiragana (japanese phonetic alphabet), then have the user handwrite the appropriate kanji (chinese character). Then, this is internally compared to the correct character. Then, user gets feedback (if they were correct or not).
My questions here revolve around the handwritten input.
I know normally if one uses the chinese keyboard this type of input is possible.
How can I institute something similar, without using the keyboard itself? Are there already library functions for this (I feel there must be since that input is available on the chinese keyboard)?
Also, Kanji aren't exactly the same as chinese characters. There are unique characters that japanese people invented themselves. How would I be able to include these in my handwriting recognition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们在大学时也做过类似的练习。
由于汉字的笔画顺序已明确定义,并且只有 8(?)种不同的笔画。基本上每个汉字都是一个有序的笔画序列。像te(手)一样,顺序是“短的向后落笔”,然后是两次“从左到右的笔画”,最后是“长的向下笔画,底部有小尖端”。有数据库可以为您提供此信息。
现在问题几乎减少到识别正确的笔划。您仍然会遇到一些含糊之处,您必须考虑某些笔划与其他笔划的空间关系。
编辑:对于笔画识别,我们将徒手书写对齐到 45 度(键盘上的小圆圈符号在哪里?)角度,从而将其转换为沿这些方向之一的向量序列。我们假设方向 0 是从下到上,方向 1 是从右下到左上,方向 2 是从右到左,依此类推逆时针方向。
那么te(手)的第一笔将是[23]+(有些人写它向下,有些人写水平)
第二次和第三次击球将是6+
最后一个是 4+[123](就像小提示一样,每个作者都使用不同的方向)
这种粗略的捕捉实际上足以让我们识别汉字。也许还有更复杂的方法,但这个简单的解决方案成功识别了大约 90% 的汉字。它不能只识别一位教授的笔迹,但问题是除了他自己之外,没有人能读懂他的笔迹。
编辑2:重要的是,您的用户“打印”汉字而不是用书法书写,因为在书法中,许多笔划被合并为一个。就像在书法中用“稻田”部首写汉字一样,这个部首会变成完全不同的东西。或者带有大量水平破折号的部首(如“speech”iu 的部首)就变成了一条长长的蜿蜒的线。
We worked on a similar exercise back at University.
As the order of the strokes is well defined with kanji and there are only 8 (?) different strokes. Basically each Kanji is a well-ordered sequence of strokes. Like te (hand) is the sequence "The short falling backward stroke" and then twice the "left to right stroke" and finally "The long downward stroke with the little tip at the bottom". There are databases that give you this information.
Now the problem is almost reduced to identify the correct stroke. You will still run into some ambiguities where you have to take into consideration in which spatial relation some strokes are to some others.
EDIT: For stroke recognition we snapped the free hand writing to 45 degrees (Where is the little circle symbol on the keyboard?) angles, thus converting it into a sequence of vectors along one of these directions. Let's assume that direction zero is from bottom to top, direction 1 bottom right to top left, 2 from right to left and so on CCW.
Then the first stroke of te (手) would be [23]+ (as some write it falling and some horizontal)
The second and third stroke would be 6+
and the last would be 4+[123] (as with the little tip, every writer uses a different direction)
This coarse snapping was actually enough for us to recognize kanjis. Maybe there are more sofisticated ways, but this simple solution managed to recognize about 90% of kanjis. It couldn't grasp only the handwriting of one professor, but the problem was that also no human except himself could read his handwriting.
EDIT2: It is important that your user "prints" the Kanji and doesn't write in calligraphy, since in calligraphy many strokes are merged into one. Like when writing a kanji with the radical of "rice field" in calligraphy, this radical morphs into something completely different. Or radicals with a lot of horizontal dashes (like the radical of "speech" iu) just become one long wriggly line.