Programmatically determine number of strokes in a Chinese character?

▼魔方 西西 提交于 2020-01-01 04:29:07

问题


Does Unicode store stroke count information about Chinese, Japanese, or other stroke-based characters?


回答1:


A little googling came up with Unihan.zip, a file published by the Unicode Consortium which contains several text files including Unihan_RadicalStrokeCounts.txt which may be what you want. There is also an online Unihan Database Lookup based on this data.




回答2:


In Python there is a library for that:

>>> from cjklib.characterlookup import CharacterLookup
>>> cjk = CharacterLookup('C')
>>> cjk.getStrokeCount(u'日')
4

Disclaimer: I wrote it




回答3:


You mean, is it encoded somehow in the actual code point? No. There may well be a table somewhere you can find on the net (or create one) but it's not part of the Unicode mandate to store this sort of metadata.




回答4:


If you want to do character recognition goggle HanziDict.

Also take a look at the Unihan data site:

http://www.unicode.org/charts/unihanrsindex.html

You can look up stroke count and then get character info. You might be able to build your own look up.




回答5:


UILocalizedIndexedCollation can be a total solution.

https://developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalizedIndexedCollation_Class/UILocalizedIndexedCollation.html



来源:https://stackoverflow.com/questions/2398334/programmatically-determine-number-of-strokes-in-a-chinese-character

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