Learn R Programming

dhlabR (version 1.0.6)

get_concordance: Retrieve Concordance for Words in Documents

Description

This function obtains the concordance for specified words within given documents.

Usage

get_concordance(pids, words, window = 20, limit = 10)

Value

A data frame containing the concordance results for each word in the specified documents. Returns NULL if the API request fails or no results are found.

Arguments

pids

A vector or data frame containing document IDs.

words

A string of words (tokens) for which the concordance will be retrieved. For multiple tokens use keyword OR

window

An optional numeric value specifying the number of characters before and after the matching word (default is 20).

limit

An optional numeric value specifying the maximum number of results to return (default is 5000).

Examples

Run this code
document_ids <- c("URN:NBN:no-nb_digibok_2008051404065", "URN:NBN:no-nb_digibok_2010092120011")
tokens <- "Norge"
window <- 20
limit <- 1000
result <- get_concordance(document_ids, tokens, window, limit)

Run the code above in your browser using DataLab