12

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
xkdkxdxc
  • 511
  • 5
  • 9

5 Answers5

12

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.

stevendaniels
  • 2,992
  • 1
  • 27
  • 31
Tim
  • 9,171
  • 33
  • 51
3

In Python there is a library for that:

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

Disclaimer: I wrote it

cburgmer
  • 2,150
  • 1
  • 24
  • 18
  • thanks for the great package! Today I tried it with these changes: 1. pip install cjklib3; 2. "C:\Users\your_name\AppData\Local\Programs\Python\Python310\Lib\site-packages\cjklib\util.py" needs a change to "from collections.abc import MutableMapping" from "from collections import MutableMapping"; 3. "cjk = characterlookup.CharacterLookup('C')" rather than "cjk = CharacterLookup('C')" – Mark K Jun 06 '23 at 03:38
2

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.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
2

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.

Joe Pitz
  • 2,434
  • 3
  • 25
  • 30
1

UILocalizedIndexedCollation can be a total solution.

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

Jerry Juang
  • 147
  • 2
  • 2
  • first, call "UILocalizedIndexedCollation sectionForObject:collationStringSelector:" to get an index of section. then back to check which section this index mapping to in "UILocalizedIndexedCollation.sectionTitles" – Jerry Juang Mar 27 '14 at 17:43
  • This is actually an Apple Eco-system only solution. – smat88dd Aug 01 '22 at 08:22