The elements of the Co occurrence matrix indicate how many times two words co-occur in a (sliding) word window of a given size.

coom(corpus, window = 5L, normalize = TRUE)

# S3 method for corpus
coom(corpus, window = 5L, normalize = TRUE)

Arguments

corpus

A corpus as returned by corpus.

window

Size of the sliding word window.

normalize

Whether to normalize the counts by the distance between word positions.

Plot

The plot method returns an object of class echarts4r.

Examples

# NOT RUN {
init_textanalysis()

# create corpus
doc <- string_document("A simple document.")
doc2 <- string_document("Another simple document.")
crps <- corpus(doc, doc2)

# matrix & plot
matrix <- coom(crps)
plot(matrix)
# }