% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/filter.R
\name{filter_segment}
\alias{filter_segment}
\title{Filter segmentation results}
\usage{
filter_segment(input, filter_words, keep_na = TRUE)
}
\arguments{
\item{input}{A character vector or a list of character vectors.}

\item{filter_words}{A character vector of words to remove.}

\item{keep_na}{Whether to keep \code{NA} values in the returned result. The
default \code{TRUE} matches \code{jiebaR::filter_segment()}.}
}
\value{
An object with the same shape as \code{input}, with matching words
removed.
}
\description{
Remove selected words from a segmented character vector or from each element
of a list of segmented character vectors.
}
\details{
This is a modern reimplementation of \code{jiebaR::filter_segment()} with the
same core filtering behavior under the default settings.

In the reproducible benchmark, this version is about \strong{110x} to \strong{140x}
faster than \code{jiebaR::filter_segment()} on the tested workloads.
}
\examples{
filter_segment(c("abc", "def", " ", "."), c("abc"))
filter_segment(c("a", NA, "b", "a"), c("b"), keep_na = FALSE)
input <- list(
  c("\u6211", "\u662f", "\u6d4b\u8bd5"),
  c("\u6d4b\u8bd5", "\u6587\u672c", "\u6211")
)
filter_segment(input, "\u6211")
}
