nk2028 / yitizi

Input a Chinese character. Output all the variant characters of it.
Creative Commons Zero v1.0 Universal
18 stars 1 forks source link

Add a function to get the orthodox characters (正字) #8

Open ayaka14732 opened 3 years ago

ayaka14732 commented 3 years ago

It would be great to add a function to get the orthodox characters (正字) of a character.

>>> f('畱')  # TODO: Get a better name
['留']
>>> f('留')
['留']
>>> f('為')
['爲']  # OpenCC standard
>>> f('苧')
['苧', '薴']  # The order should not matter
>>> f('a')
[]  # No data

As the OpenCC standard “separate as much as possible” (能分則不合), there would be little difficulty in determine the orthodox characters.

sgalal commented 3 years ago

Related: https://github.com/BYVoid/OpenCC/issues/493