% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tagging.R
\name{tagging_batch}
\alias{tagging_batch}
\title{Tag a batch of strings}
\usage{
tagging_batch(
  texts,
  jiebar,
  ...,
  format = c("vector", "data.frame", "legacy"),
  batch = c("list", "flatten")
)
}
\arguments{
\item{texts}{A non-empty character vector to tag.}

\item{jiebar}{A \code{jieba_worker} object created with \code{worker(type = "tag")}.}

\item{...}{Must be empty. This enforces that optional arguments such as
\code{format} and \code{batch} are supplied with explicit names.}

\item{format}{Output format for each single tagged result. Must be one of
\code{"vector"}, \code{"data.frame"}, or \code{"legacy"}.}

\item{batch}{Aggregation mode. Must be one of \code{"list"} or \code{"flatten"}.}
}
\value{
Tagging results in the requested format.
}
\description{
Convenience wrapper around \code{\link[=tagging]{tagging()}} for multi-string input. When \code{batch}
is not supplied, \code{tagging_batch()} always returns list output.
}
\details{
\code{tagging_batch()} is a convenience wrapper for explicit multi-string input.
The returned object depends on both \code{format} and \code{batch}:
\itemize{
\item \code{batch = "list"}: returns one single-string tagging result per input
string.
\item \code{batch = "flatten"}: concatenates all results into one. The shape is
decided by \code{format}: \code{"vector"}/\code{"legacy"} produce a named character
vector, while \code{"data.frame"} produces a combined data frame with a
\code{doc_id} column.
}

In the current release benchmarks on the bundled \emph{Fortress Besieged} and
\emph{Dream of the Red Chamber} texts, batch tagging is about \strong{2x to 5x faster}
than the comparable \code{jiebaR} workflow on many-string inputs. For very long
texts, the best throughput was usually reached by splitting into about \strong{32
to 128 chunks}, while much finer splitting still helped but was no longer
optimal.
}
\examples{
tagger <- worker(type = "tag")
texts <- c("\u8fd9\u662f\u4e00\u4e2a\u6d4b\u8bd5", "\u518d\u6765\u4e00\u6b21")
tagging_batch(texts, tagger)
tagging_batch(texts, tagger, format = "legacy", batch = "flatten")
}
