% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/to_pinyin.R
\name{to_pinyin}
\alias{to_pinyin}
\title{Convert Chinese Characters to Hanyu Pinyin}
\usage{
to_pinyin(x, sep = "_", tone = TRUE, polyphone = FALSE, other_replace = NULL)
}
\arguments{
\item{x}{A character vector.}

\item{sep}{Separator between syllables. Default is \code{"_"}.}

\item{tone}{If \code{TRUE} (default), returns Pinyin with numeric tones (e.g.
\code{qiu1}). If \code{FALSE}, returns toneless Pinyin (e.g. \code{qiu}).}

\item{polyphone}{If \code{FALSE} (default), each character is converted
independently using its most common reading. If \code{TRUE}, a built-in phrase
table is used to resolve common polyphones via greedy longest-match
segmentation.}

\item{other_replace}{How to handle non-Chinese characters. \code{NULL} means
leave them as-is. A single character string replaces them.}
}
\value{
A character vector of the same length as \code{x}.
}
\description{
Converts a character vector of Chinese strings into Pinyin romanization.
The function is fully vectorized and uses the Unicode Unihan database
(\code{kMandarin}) as its authoritative source.
}
\examples{
to_pinyin("\u6625\u7720\u4e0d\u89c9\u6653")
to_pinyin("Hello \u4e16\u754c", sep = " ", other_replace = "?")
to_pinyin("\u94f6\u884c\u884c\u957f", polyphone = TRUE)
}
