collocationScoreQuery,KorAPConnection-method {RKorAPClient}R Documentation

Query frequencies of a node and a collocate and calculate collocation association scores

Description

Computes various collocation association scores based on frequencyQuery()s for a target word and a collocate.

Usage

## S4 method for signature 'KorAPConnection'
collocationScoreQuery(
  kco,
  node,
  collocate,
  vc = "",
  lemmatizeNodeQuery = FALSE,
  lemmatizeCollocateQuery = FALSE,
  leftContextSize = 5,
  rightContextSize = 5,
  scoreFunctions = defaultAssociationScoreFunctions(),
  smoothingConstant = 0.5,
  observed = NA,
  ignoreCollocateCase = FALSE,
  withinSpan = "base/s=s"
)

Arguments

kco

KorAPConnection() object (obtained e.g. from new("KorAPConnection")

node

target word

collocate

collocate of target word

vc

string describing the virtual corpus in which the query should be performed. An empty string (default) means the whole corpus, as far as it is license-wise accessible.

lemmatizeNodeQuery

logical, set to TRUE if node query should be lemmatized, i.e. ⁠x -> [tt/l=x]⁠

lemmatizeCollocateQuery

logical, set to TRUE if collocate query should be lemmatized, i.e. ⁠x -> [tt/l=x]⁠

leftContextSize

size of the left context window

rightContextSize

size of the right context window

scoreFunctions

named list of score functions of the form function(O1, O2, O, N, E, window_size), see e.g. pmi

smoothingConstant

smoothing constant will be added to all observed values

observed

if collocation frequencies are already known (or estimated from a sample) they can be passed as a vector here, otherwise: NA

ignoreCollocateCase

logical, set to TRUE if collocate case should be ignored

withinSpan

KorAP span specification for collocations to be searched within

Value

tibble with query KorAP web request URL, all observed values and association scores

See Also

Other collocation analysis functions: association-score-functions, collocationAnalysis,KorAPConnection-method, synsemanticStopwords()

Examples

## Not run: 

new("KorAPConnection", verbose = TRUE) %>%
  collocationScoreQuery("Grund", "triftiger")

## End(Not run)

## Not run: 

new("KorAPConnection", verbose = TRUE) %>%
collocationScoreQuery("Grund", c("guter", "triftiger"),
   scoreFunctions = list(localMI = function(O1, O2, O, N, E, window_size) { O * log2(O/E) }) )

## End(Not run)

## Not run: 

library(highcharter)
library(tidyr)
new("KorAPConnection", verbose = TRUE) %>%
  collocationScoreQuery("Team", "agil", vc = paste("pubDate in", c(2014:2018)),
                        lemmatizeNodeQuery = TRUE, lemmatizeCollocateQuery = TRUE) %>%
                         pivot_longer(14:last_col(), names_to = "measure", values_to = "score") %>%
  hchart(type="spline", hcaes(label, score, group=measure)) %>%
  hc_add_onclick_korap_search()

## End(Not run)


[Package RKorAPClient version 0.8.1 Index]