NAME

Encode::Korean - Perl extension for Encoding of Korean: Transliterator Generator

SYNOPSIS

  use Encode::Korean::TransliteratorGenerator;

  my $coder = Encode::Korean::TransliteratorGenerator->new();

  $coder->consonants(@CONSONANTS);
  $coder->vowels(@VOWELS);
  $coder->sep($SEP);
  $coder->make();

  while($utf_input = <>) {
	print $coder->encode(decode 'utf8', $utf_input);
  }

DESCRIPTION

This module provide a generic Korean transliterator class. You can define your own rules and create your own transliterator object.

The transliteration based encoding modules uses this class. See Encode::Korean.

How to define a custom transliteration set

@CONSONANT  : array of 19 consonant letters
@VOWEL      : array of 21 vowel letters
$EL         : jongseong l
$ELL        : consecutive l's 
$NAUGHT     : soundless choseong ieung
$SEP        : syllable separator
$MODE       : CamelCase, greedy_sep, smart_sep 

eg. South Korean Standard

@CONSONANT = qw(g kk n d tt r m b pp s ss ng j jj ch k t p h);
@VOWEL = qw(a ae ya yae eo e yeo ye o wa wae oe yo u wo we wi yu eu ui i);
$EL = "l";
$ELL = "ll";
$NAUGHT = "'";
$SEP = "-";

TRANSLITERATION MODES

Transliteration modes for ambiguous syllable boundary resolution.

1. Use CamelCase

Makes syllables capitalized. Ignores $NAUGHT and $SEP. Not yet implemented at all.

eg. 하나 -> HaNa, 한아 -> HanA

2. Greedy Separator

Insert $SEP between syllables. Implemented. The object can produces (when encode) transliteration with greedy separator mode and recognize (decode) it.

eg. 하나 -> ha.na, 한아 -> han'a, where $SEP = '.'; $NAUGHT = "'";
eg. 하나 -> ha.na, 한아 -> han.a, where $SEP = '.'; $NAUGHT = undef;

3. Smart Separator

Insert $SEP when syllable boundaries are ambiguous in transliteration. Partially implemented. The object can recognize (decode) it but does not produce it.

If $NAUGHT is defined and is not null:

  insert $NAUGHT for the soundless head (choseong ieung)
  insert $SEP between consonant groups.

  eg. 하나 -> hana, 한아 -> han'a
  eg. 앉자 -> anc.ca, 안짜 -> an.cca

else :

  insert $SEP for the soundless head and between consonant groups.

  eg. 하나 -> hana,    한아 -> han.a
  eg. 앉자 -> anc.ca,  안짜 -> an.cca 
      앉하 -> anc.ha,  안차 -> an.cha
  eg. 갂아 -> kakk.a,  각가 -> kak.ka, 가까 -> kakka
      각까 -> kak.kka, 갂가 -> kakk.ka
      갂까 -> kakk.kka

SEE ALSO

AUTHOR

You Hyun Jo, <you at cpan dot org>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by You Hyun Jo

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.