ttt_keyness: ttt_keyness

Description Usage Arguments Value Examples

Description

Keyness metrics for associations with specified key words; see https://en.wikipedia.org/wiki/Keyword_(linguistics)

Usage

1
ttt_keyness(x, word = "school", window = 10, remove_keyword = FALSE)

Arguments

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.

Value

A quanteda 'keyness' object listing words ('features') and associated keyness statistics.

Examples

 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

mpadge/texttimetravel documentation built on Nov. 14, 2020, 11:31 a.m.