Skip to contents

`sim2trad()` uses the dictionary `STCharacter.txt` distributed via [`OpenCC`](https://opencc.byvoid.com/) to convert Simplified Chinese to Traditional Chinese.

Usage

sim2trad(char, all = FALSE)

Arguments

char

A character vector of Simplified Chinese characters.

all

If `TRUE`, all possible match results of Traditional Chinese characters are returned. If `FALSE`, only the first match is returned. Default: `FALSE`.

Value

If `all` is `FALSE`, a character vector with the same length as input `char`. Otherwise, a list of character vector with the same length as input `char`. The returned character vector or list is always named using input `char`.

Note

Currently, wuge package did not use `OpenCC` library. Instead, a simple character-level mapping is used.

Examples

sim2trad(c("千万", "鼠标"))
#>   千万   鼠标 
#> "千萬" "鼠標" 
sim2trad(c("千万", "鼠标"), all = TRUE)
#> $千万
#> [1] "千萬" "韆万"
#> 
#> $鼠标
#> [1] "鼠標"
#>