concordances {R.temis} | R Documentation |
concordances
Description
Print documents which contain one or more terms and return a sub-corpus with these documents.
Usage
concordances(corpus, dtm, terms, all = FALSE)
Arguments
corpus |
A |
dtm |
A |
terms |
One of more terms appearing in |
all |
Whether only documents containing all terms should be printed. By default, documents need to contain at least one of the terms. |
Details
Occurrences of the specified terms are highlighted. If stemming
or other transformations have been applied to original words using
combine_terms
, all original words which have been transformed
to the specified terms are highlighted.
Value
Corpus
object (invisibly).
Examples
file <- system.file("texts", "reut21578-factiva.xml", package="tm.plugin.factiva")
corpus <- import_corpus(file, "factiva", language="en")
dtm <- build_dtm(corpus)
concordances(corpus, dtm, "oil")
concordances(corpus, dtm, c("oil", "opec"))
concordances(corpus, dtm, c("oil", "opec"), all=TRUE)
# Also works when terms have been combined
dict <- dictionary(dtm)
dtm2 <- combine_terms(dtm, dict)
concordances(corpus, dtm2, "product")
[Package R.temis version 0.1.3 Index]