metadata {

authority_id: iso
id: 1996-method2
language: iso-639-2:kor
source_script: Hang
destination_script: Latn
name: "ISO/TR 11941:1996 Information and documentation -- Transliteration of Korean script into Latin characters (Method 2)"
url: https://www.iso.org/standard/20564.html
creation_date: 1996
adoption_date:
description: Establishes a system for the transliteration of the characters of Korean script into Latin characters. Intended to provide a means for international communication of written documents.

notes: ""

}

tests {

# Tests from https://www.eki.ee/wgrs/rom2_ko.pdf
test "꽃이", "ggoc'i" # Bad OCR
test "강에", "gang'e"
test "앉아라", "anj'ara"
test "아까", "a'gga"
test "흰떡", "hyin'ddeog"
#- source: "유쾌하다" not present in method2
#  expected: "yu'khwaehata"
# Tests from https://github.com/interscript/interscript/files/5249245/ISO-TR-11941-1996.pdf
test "애기", "aegi"
test "방", "bang"
test "아이", "a'i"
test "고양이", "go'yang'i"
test "굽이", "gub'i"
test "밖에", "bagg'e"
test "박게", "bagge"
test "바께", "ba'gge"
test "간게", "gange"
test "안자라", "anjara"
test "오빠", "o'bba"
test "어찌", "eo'jji"
test "아씨", "a'ssi"

}

dependency “var-kor”, import: true dependency “var-kor-Hang-Hang-jamo”, as: hangjamo

stage {

run map.hangjamo.stage.main

# Marks A, B, C
sub "ᄋ", "", not_before: jamo # Word initially
sub "ᄋ", "'" # See notes 2, 3 and 4.
sub "ᆼ", "ng" # At the end of a syllable.

# Note 4: add apostrophe before 5 double consonants at initial position
#         unless start of the word
sub none, "'", before: jamo, after: double_cons_jamo
# Note 4: (only method 1) same but with 4 aspirated
#- pattern: "(?<=\\p{Hangul})([ᄏᄐᄑᄎ])"
#  result: "'\\1"

parallel {
  # Consonants differing between method1 and method2
  sub any("ᄀᆨ"), "g"
  sub any("ᄏᆿ"), "k"
  sub any("ᄁᆩ"), "gg"
  sub any("ᄃᆮ"), "d"
  sub any("ᄐᇀ"), "t"
  sub any("ᄄퟍ"), "dd"
  sub any("ᄇᆸ"), "b"
  sub any("ᄑᇁ"), "p"
  sub any("ᄈퟦ"), "bb"
  sub any("ᄌᆽ"), "j"
  sub any("ᄎᆾ"), "c"
  sub any("ᄍퟹ"), "jj"
  # End

  # Composite differing consonants (cons. https://en.wikipedia.org/wiki/ISO/TR_11941 )
  sub any("ᆪ"), "gs"
  sub any("ꥤ"), "rg" # D. R at the beginning of a syllable
  sub any("ᆰ"), "lg"
  sub any("ᆴ"), "lt"
  sub any("ꥩ"), "rb" # D. R at the beginning of a syllable
  sub any("ᆲ"), "lb"
  sub any("ᆵ"), "lp"
  sub any("ᅜᆬ"), "nj"
  sub any("ᄡᆹ"), "bs"
  # End

  # Other consonants
  sub any("ᄉᆺ"), "s"
  sub any("ᄊᆻ"), "ss"
  sub any("ᄒᇂ"), "h"
  sub any("ᄂᆫ"), "n"
  sub any("ᄅ"), "r" # D. R at the beginning of a syllable.
  sub any("ᆯ"), "l"
  sub any("ᄆᆷ"), "m"
  # End

  # Other composite consonants (cons. https://en.wikipedia.org/wiki/ISO/TR_11941 )
  sub any("ꥬ"), "rs" # D. R at the beginning of a syllable
  sub any("ᆳ"), "ls"
  sub any("ꥨ"), "rm" # D. R at the beginning of a syllable
  sub any("ᆱ"), "lm"
  sub any("ᄚ"), "rh" # D. R at the beginning of a syllable
  sub any("ᆶ"), "lh"
  sub any("ᅝᆭ"), "nh"
  # End

  # Vowels
  sub "ᅡ", "a"
  sub "ᅥ", "eo"
  sub "ᅩ", "o"
  sub "ᅮ", "u"
  sub "ᅳ", "eu"
  sub "ᅵ", "i"
  sub "ᅢ", "ae"
  sub "ᅦ", "e"
  sub "ᅬ", "oe"
  sub "ᅣ", "ya"
  sub "ᅧ", "yeo"
  sub "ᅭ", "yo"
  sub "ᅲ", "yu"
  sub "ᅤ", "yae"
  sub "ᅨ", "ye"
  sub "ᅪ", "wa"
  sub "ᅯ", "weo"
  sub "ᅱ", "wi"
  sub "ᅫ", "wae"
  sub "ᅰ", "we"
  sub "ᅴ", "yi"
  # End
}

}