Skip to contents

Tailor weighting function to a lemma

Usage

weightLemma(
  cws,
  foc_param_fun = function(m) stringr::str_split(m, "\\.")[[1]][[1]],
  weight_param_fun = function(m) stringr::str_split(m, "\\.")[[1]][[2]],
  sup_weight_fun = function(weightparam) stringr::str_ends(weightparam, "weight"),
  ...
)

Arguments

cws

Dataframe with one row per token per context word, output of setupConcordancer.

foc_param_fun

Function that takes the name of a model and returns a character string with first-order filters (to be used as foc_param in getContext and thus filterFoc).

weight_param_fun

Function that takes the name of a model and returns a character string with weighting filters (to be used as weight_param in getContext and thus filterWeight).

sup_weight_fun

Function that takes the output of weight_param_fun as input and returns TRUE if weighting values should be added as superindices and FALSE if they should not. To be fed to filterWeight.

...

Arguments to be passed to getContext.

Value

Function that takes a token ID, a list of context words and a model name as input and calls getContext.