R/stopwords.R

stopwords <- {
    function(kind = "en") {
        kind <- as.character(kind)

        resolved <- map_IETF_Snowball(kind)
        base <- if (is.na(resolved))
            kind
        else if (identical(resolved, "porter"))
            "english"
        else
            resolved
        s <- system.file("stopwords", paste0(base, ".dat"),
                         package = "tm")
        if (identical(s, ""))
            stop(paste("no stopwords available for '", base, "'", sep = ""))
        readLines(s, encoding = "UTF-8")
    }
}

Try the tm package in your browser

Any scripts or data that you put into this service are public.

tm documentation built on April 7, 2021, 3:01 a.m.