ttt_keyness_annual: ttt_keyness_annual

Description Usage Arguments Value Note Examples

Description

Keyness metrics for associations with specified key words, evaluated on an annual basis; see https://en.wikipedia.org/wiki/Keyword_(linguistics)

Usage

1
2
ttt_keyness_annual(x, word = "school", window = 10,
  remove_keyword = FALSE, quiet = 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.

quiet

If 'FALSE', displays a progress bar which might be helpful because this function may take a long time to run.

Value

A list of quanteda 'keyness' objects listing words ('features') and associated keyness statistics; one list item per year (where able to be calcualted).

Note

Only those years for which 'x' contains the nominated 'word' will return entries, and thus the return length of this function may be less than the number of years in the corpus.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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:
## Not run: 
x <- ttt_keyness_annual (tok, "school")
x <- ttt_keyness_annual (tok, "school", remove_keyword = TRUE)

## End(Not run)

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