Description Usage Arguments Value Examples
Keyness metrics for associations with specified key words; see https://en.wikipedia.org/wiki/Keyword_(linguistics)
1 | ttt_keyness(x, word = "school", window = 10, remove_keyword = FALSE)
|
x |
A quanteda 'tokens' list, obtained by 'tokens(corpus)'. |
word |
The key word for which associations with other words are to be calculated. |
window |
Passed to quanteda 'tokens_keep/remove' functions; the number of words surrounding each instance of 'word' to be considered in measures of assocation. |
remove_keyword |
If 'TRUE', remove the specified keyword from results, leaving only associations with that word not the word itself. |
A quanteda 'keyness' object listing words ('features') and associated keyness statistics.
1 2 3 4 5 6 7 8 9 10 11 12 | # prepare a corpus of quanteda tokens:
dat <- quanteda::data_corpus_inaugural
tok <- quanteda::tokens (dat, remove_numbers = TRUE, remove_punct = TRUE,
remove_separators = TRUE)
tok <- quanteda::tokens_remove(tok, quanteda::stopwords("english"))
# then use that to extract keyword associations:
x <- ttt_keyness (tok, "school")
head (x, n = 20)
x <- ttt_keyness (tok, "politic*")
head (x, n = 20) # first 3 words are political, politics, and parties
x <- ttt_keyness (tok, "politic*", remove_keyword = TRUE)
head (x, n = 20) # first 3 words are parties, petty, and voice
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.