Version: | 1.1.6 |
Date: | 2019-05-01 |
Title: | Convert Chinese Characters into Pinyin, Sijiao, Wubi or Other Codes |
Maintainer: | Peng Zhao <pzhao@pzhao.net> |
Depends: | R (≥ 3.1.0) |
Imports: | splitstackshape, data.table |
Description: | Convert Chinese characters into Pinyin (the official romanization system for Standard Chinese in mainland China, Malaysia, Singapore, and Taiwan. See https://en.wikipedia.org/wiki/Pinyin for details), Sijiao (four or five numerical digits per character. See https://en.wikipedia.org/wiki/Four-Corner_Method.), Wubi (an input method with five strokes. See https://en.wikipedia.org/wiki/Wubi_method) or user-defined codes. |
License: | MIT + file LICENSE |
URL: | https://github.com/pzhaonet/pinyin |
BugReports: | https://github.com/pzhaonet/pinyin/issues |
RoxygenNote: | 6.1.1 |
NeedsCompilation: | no |
Packaged: | 2019-05-02 08:40:57 UTC; Peng.Zhao |
Author: | Peng Zhao [aut, cre], Qu Cheng [ctb] |
Repository: | CRAN |
Date/Publication: | 2019-05-02 11:40:08 UTC |
Convert the Chinese headers of bookdown .Rmd files into Pinyin
Description
Convert the Chinese headers of bookdown .Rmd files into Pinyin
Usage
bookdown2py(folder = "py", remove_curly_bracket = TRUE, other_replace = NULL, dic = NA)
Arguments
folder |
character. The folder in which the files are to be converted. |
remove_curly_bracket |
logical. Whether to remove existing curly brackets in the headers. |
other_replace |
NULL or character. Define how to convert non-Chinese characters in mychar. NULL means 'let it be'. |
dic |
See |
Value
new .Rmd files with Pinyin headers.
Examples
bookdown2py(dic = NA)
Rename files according to a given dictionary
Description
Rename files according to a given dictionary
Usage
file.rename2py(folder = "py", dic = NA)
Arguments
folder |
character. The folder in which the files are to be renamed. |
dic |
See |
Value
files with new names.
Examples
file.rename2py(dic = NA)
Convert the characters in an entire files according to a given dictionary
Description
Convert the characters in an entire files according to a given dictionary
Usage
file2py(folder = "py", backup = TRUE, sep = " ", other_replace = NULL,
encoding = "UTF-8", dic = NA)
Arguments
folder |
character. The folder in which the files are to be converted. |
backup |
logical. Whether the original files should be saved as backups. |
sep |
character. Seperation between the converted pinyin. |
other_replace |
NULL or character. Define how to convert non-Chinese characters in mychar. NULL means 'let it be'. |
encoding |
character. The encoding of the input files. 'UTF-8' by default. |
dic |
See |
Value
files converted to Pinyin.
Examples
file2py(dic = NA)
Title insert a character(s) before all lattin letters in a string
Description
Title insert a character(s) before all lattin letters in a string
Usage
insert(oldchar, insertchar = ",")
Arguments
oldchar |
the old string |
insertchar |
the character(s) to insert |
Value
a new string
Load a customized dictionary.
Description
Load a customized dictionary.
Usage
load_dic(dic_file = NA, select = 1)
Arguments
dic_file |
The path of a dictionary file. |
select |
The option to choose from the dictionary. |
Value
A dictionary
Examples
load_dic()
Former version of py()
Description
Former version of py()
Usage
pinyin()
Value
a message
Examples
pinyin()
Convert strings of Chinese characters into Pinyin.
Description
Convert strings of Chinese characters into Pinyin.
Usage
py(char = "", sep = "_", other_replace = NULL, dic = pydic())
Arguments
char |
a string vector |
sep |
character. Seperation between the converted pinyin. |
other_replace |
NULL or character. Define how to convert non-Chinese characters in mychar. NULL means 'let it be'. |
dic |
the preloaded pinyin library using the |
Value
pinyin of the given Chinese string.
Examples
py(dic = NA)
Convert a string of Chinese characters into Pinyin.
Description
Convert a string of Chinese characters into Pinyin.
Usage
py_single(char = "", sep = "_", other_replace = NULL, dic = pydic())
Arguments
char |
character. A Chinese character or string to convert to pinyin |
sep |
character. Seperation between the converted pinyin. |
other_replace |
NULL or character. Define how to convert non-Chinese characters in mychar. NULL means 'let it be'. |
dic |
the preloaded pinyin library using the |
Value
pinyin of the given Chinese string.
Load a Pinyin library
Description
Load a Pinyin library
Usage
pydic(method = c("quanpin", "tone", "toneless"), multi = FALSE,
only_first_letter = FALSE, dic = c("pinyin", "pinyin2"))
Arguments
method |
character. The value can be:
|
multi |
logical. Whether display multiple pronounciations of a Chinese character or only the first pronounciation. |
only_first_letter |
logical. Wheter only the first letter in pinyin. |
dic |
character. Choose the dictionary. |
Value
character. a Pinyin library.
Examples
pydic()
split a string and extract the nth string
Description
split a string and extract the nth string
Usage
strsplit2(x, sep = " ", nth = 1)
Arguments
x |
The string to split |
sep |
The separated character |
nth |
The nth string to extract |
Value
a new string