ksx1026.sorting module

Hangul sorting functions defined in KS X 1026-1



determine a weight for a Wanseong Hangul Syllable Block, a Hangul Letter or Hangul-embedded Symbol

Parameters:hc (char) – Single character string
ksx1026.sorting.getHangulWeightLVT(L, V, T, _type=0)[source]

for the Syllable-Initial, Syllable-Peak and Syllable-Final Letters, determine a weight.

_type: 0 is assigned to a Johab Hangul Syllable Block or Wanseong Hangul Syllable Block. 1 is assigned when there is only a Syllable-Final Letter. 2 is assigned to a Halfwidth Hangul Letter. 3 is assigned to a Hangul Compatibility Letter. 4 is assigned to a Parenthesized Hangul Letter/Syllable Block. 5 is assigned to a Circled Hangul Letter/Syllable Block.

  • L (char) – Single character string
  • V (char) – Single character string
  • T (char) – Single character string
  • _type (int) – inteager (0, 1, 2, 3, 4, 5)
ksx1026.sorting.sortKey(text, hangul_first=True)[source]

key function for sorted

  • text (string) – A string for weight
  • hangul_first (bool) – Boolean