Closed trinker closed 7 years ago
Add this function to termco. Then have get_text.default
in clustext refer to termco
p_load(termco)
discoure_markers <- list(
response_cries = c("\\boh\\b", "\\bah\\b", "\\baha", "\\bouch", "yuk"),
back_channels = c("uh[- ]huh", "uhuh", "yeah"),
summons = "\\bhey",
justification = "because"
)
model <- presidential_debates_2012 %>%
with(term_count(dialogue, grouping.var = TRUE, discoure_markers))
attributes(model)
get_text <- function(x, ...){
UseMethod("get_text")
}
get_text.term_count <- function(x, ...){
attributes(model)[['text.var']][['text.var']][which(classify(model)%in% unlist(...))]
}
get_text(model, 'summons')
get_text(model, 'response_cries')
get_text(model, c('summons', 'response_cries'))
something that does this or splits by tags etc.