Learn R Programming

pinyin (version 1.1.2)

file2py: Convert entire files into Pinyin

Description

Convert entire files into Pinyin

Usage

file2py(folder = "py", backup = TRUE, method = c("quanpin", "tone", "toneless"), 
    sep = " ", nonezh_replace = NULL, only_first_letter = FALSE, multi = FALSE, 
    encoding = "UTF-8")

Arguments

folder

character. The folder in which the files are to be converted.

backup

logical. Whether the original files should be saved as backups.

method

character. The value can be:

  • 'quanpin', for the standard form of pinyin (tones above letters),

  • 'tone', for tones expressed with numbers,

  • 'toneless', without tones

sep

character. Seperation between the converted pinyin.

nonezh_replace

NULL or character. Define how to convert non-Chinese characters in mychar. NULL means 'let it be'.

only_first_letter

logical. Wheter only the first letter in pinyin.

multi

logical. Whether display multiple pronounciations of a Chinese character or only the first pronounciation.

encoding

character. The encoding of the input files. 'UTF-8' by default.

Value

files converted to Pinyin.

Examples

Run this code
# NOT RUN {
mydir <- paste0(tempdir(), "/py")
dir.create(mydir)
file.create(paste0(mydir, "/test.txt"))
writeLines(text = "test\n", paste0(mydir, "/test.txt"))
file2py(mydir)
# }

Run the code above in your browser using DataLab