# NOT RUN {
use("polmineR")
P <- partition("GERMAPARLMINI", date = ".*", p_attribute = "word", regex = TRUE)
y <- cooccurrences(P, query = "Arbeit")
# generics defined in the polmineR package
x <- count("REUTERS", p_attribute = "word")
name(x) <- "count_reuters"
name(x)
get_corpus(x)
# Standard generic methods known from data.frames work for objects inheriting
# from the textstat class
head(y)
tail(y)
nrow(y)
ncol(y)
dim(y)
colnames(y)
# Use brackets for indexing
# }
# NOT RUN {
y[1:25]
y[,c("word", "ll")]
y[1:25, "word"]
y[1:25][["word"]]
y[which(y[["word"]] %in% c("Arbeit", "Sozial"))]
y[ y[["word"]] %in% c("Arbeit", "Sozial") ]
# }
# NOT RUN {
sc <- partition("GERMAPARLMINI", speaker = "Angela Dorothea Merkel")
cnt <- count(sc, p_attribute = c("word", "pos"))
cnt_min <- subset(cnt, pos %in% c("NN", "ADJA"))
cnt_min <- subset(cnt, pos == "NE")
# Get statistics in textstat object as data.table
count_dt <- corpus("REUTERS") %>%
subset(grep("saudi-arabia", places)) %>%
count(p_attribute = "word") %>%
as.data.table()
# }
Run the code above in your browser using DataLab