Romanize Korean hangul script in accordance with the official 'Revised Romanization of Korean'

Viewed 103

I wish to romanize Korean place names from hangul script. Function stringi::stri_trans_general supports hangul romanization, but apparently not in accordance with the widely applied and official Revised Romanization of Korean scheme.

The code below reveals some of the potential conversion issues:

library(stringi)
Sys.setlocale(category="LC_ALL", locale="Korean")

#Read hangul "서울특별시 종로구 사직동" pasted in win10 notepad file because directly pasting in console doesn't work
x <- readLines("hangul.txt", encoding="UTF-8")

#Try the two different tranform identifiers I have found in stri_trans_list for hangul-to-latin
stri_trans_general(x, "Hangul-Latin")
[1] "seoulteugbyeolsi jonglogu sajigdong"
stri_trans_general(x, "Hang-Lat")
[1] "seoulteugbyeolsi jonglogu sajigdong"

According to the Revised Romanization of Korean, the output should be "seoulteuKbyeolsi jongNogu sajiKdong" instead of "seoulteuGbyeolsi jongLogu sajiGdong" (my uppercase for emphasis). How can the desired romanisation be achieved in R, with stringi or otherwise?

1 Answers

The manual says that stri_trans_general uses the ICU library to do transliteration, and the ICU manual says that it uses "Korean Ministry of Culture & Tourism Transliteration with the clause 8 variant for reversibility". I don't know how different that is from the scheme you want, but it is possible in the very recent development version 1.6.2.9004 of stringi to modify the transliteration.

To get this version, use

remotes::install_github("gagolews/stringi")

This will require compiling, so you may need to install some extra tools to use it. It takes a while to run...

Once you have it, you can do things like this (from the revised help page for stri_trans_general):

x <- "\uC11C\uC6B8\uD2B9\uBCC4\uC2DC\u0020\uC885\uB85C\uAD6C\u0020\uC0AC\uC9C1\uB3D9"
stringi::stri_trans_general(x, "Hangul-Latin")
## [1] "seoulteugbyeolsi jonglogu sajigdong"
# Deviate from the ICU rules of Romanisation of Korean,
# see https://en.wikipedia.org/wiki/%E3%84%B1
id <- "
    :: NFD;
    \u11A8 > k;
    \u11AE > t;
    \u11B8 > p;
    \u1105 > r;
    :: Hangul-Latin;
"
stringi::stri_trans_general(x, id, rules=TRUE)
## [1] "seoulteukbyeolsi jongrogu sajikdong"
Related