LINUX.ORG.RU

Unicode, корейский язык, Hangul композиция/декомпозиция

 


0

1

Есть тут корейцы? (шучу) Есть тут те, кто хорошо разбирается в юникоде. Ткните пальцем в алгоритм композиции/декомпозиции корейских символов. И еще, вдруг кто знает, может есть имплементация этого дела.

Чисто любопытно :)

★★★★★

Я не специалист по корейскому, но по-моему, то, что ты ищешь, — это раздел 3.12 «Conjoining Jamo Behavior». Там приведена примерная реализация на Java. Ещё отдельный раздел 18.9 «Hangul» (со ссылками на 3.12). А также, возможно, UAX #29 «Unicode Text Segmentation», раздел 8 (Hangul Syllable Boundary Determination).

proud_anon ★★★★★
()
Ответ на: комментарий от proud_anon

Во, спасибо уже ближе. По сути речь идет о:

The Unicode Standard contains both the complete set of precomposed modern Hangul syllable blocks and a set of conjoining Hangul jamo. The conjoining Hangul jamo can be used to to represent all of the modern Hangul syllable blocks

Modern Hangul syllable blocks can be expressed with either two or three jamo, either in the form consonant + vowel or in the form consonant + vowel + consonant. There are 19 possible leading (initial) consonants (choseong), 21 vowels (jungseong), and 27 trailing (final) consonants (jongseong). Thus there are 399 possible two-jamo syllable blocks and 10,773 possible three-jamo syllable blocks, giving a total of 11,172 modern Hangul syllable blocks. This collection of 11,172 modern Hangul syllables encoded in this block is known as the Johab set.

Вот я хочу найти алгоритм разбора precomposed Hangul syllable в последовательность Hangul jamo ну и композиции обратно.

invy ★★★★★
() автор топика
Последнее исправление: invy (всего исправлений: 2)
Ответ на: комментарий от proud_anon

Вроде оно, спасибо:

static final int
 SBase = 0xAC00,
 LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7,
 LCount = 19, VCount = 21, TCount = 28,
 NCount = VCount * TCount, // 588
 SCount = LCount * NCount; // 11172

public static String decomposeHangul(char s) {
 int SIndex = s - SBase;
 if (SIndex < 0 || SIndex >= SCount) {
  return String.valueOf(s);
 }
 StringBuffer result = new StringBuffer();
 int L = LBase + SIndex / NCount;
 int V = VBase + (SIndex % NCount) / TCount;
 int T = TBase + SIndex % TCount;
 result.append((char)L);
 result.append((char)V);
 if (T != TBase) result.append((char)T);
  return result.toString();
}

invy ★★★★★
() автор топика
Последнее исправление: invy (всего исправлений: 1)
Ответ на: комментарий от theNamelessOne

Дык выше всё правильно написали.

Можно добавить что есть неиспользуемые и бессмысленные сочетания, но в таблицах это учтено.

realloc ★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.