% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/user-dict.R
\name{new_user_word}
\alias{new_user_word}
\alias{add_word}
\title{Add user word}
\usage{
new_user_word(worker, words, tags = "n", freq = NULL)

add_word(worker, words, tags = "n", freq = NULL)
}
\arguments{
\item{worker}{A \code{jieba_worker} object.}

\item{words}{A non-empty string or a non-empty character vector of new words.}

\item{tags}{A single tag or a character vector of tags. Defaults to \code{"n"}
for each supplied word. \code{NA} values are allowed and will be interpreted as missing tags.}

\item{freq}{Optional positive integer frequency or integer vector of
frequencies. Defaults to \code{NULL}. \code{NA} values are allowed and will be
interpreted as frequencies to infer from the current dictionary.}
}
\value{
\code{NULL}, invisibly. Called for its side effect of adding the supplied
words to \code{worker}, thereby modifying the state used by subsequent
operations with the same worker.
}
\description{
Add one or more custom words to a jieba worker.
}
\examples{
cutter <- worker()
segment("\u91cf\u5b50\u673a\u5668\u72d7", cutter)
new_user_word(cutter, "\u91cf\u5b50\u673a\u5668\u72d7", tags = "n", freq = 1000L)
segment("\u91cf\u5b50\u673a\u5668\u72d7", cutter)

cutter2 <- worker()
add_word(
  cutter2,
  c("\u8d85\u5bfc\u91cf\u5b50\u6bd4\u7279", "\u91cf\u5b50\u673a\u5668\u72d7"),
  tags = c(NA, "n"),
  freq = c(NA, 1000L)
)
segment("\u8d85\u5bfc\u91cf\u5b50\u6bd4\u7279", cutter2)

}
