Skip to contents

This function uses parallel processing to analyze documents faster.

Usage

parallel_analysis(
  text_data,
  analysis_function,
  text_column = "abstract",
  ...,
  n_cores = NULL
)

Arguments

text_data

A data frame containing text data.

analysis_function

Function to apply to each document.

text_column

Name of the column containing text to analyze.

...

Additional arguments passed to the analysis function.

n_cores

Number of cores to use for parallel processing. If NULL, uses all available cores minus 1.

Value

A data frame with analysis results.

Examples

if (FALSE) { # \dontrun{
# Define a simple analysis function
count_words <- function(text) {
  words <- unlist(strsplit(tolower(text), "\\s+"))
  return(length(words))
}

# Apply parallel processing
results <- parallel_analysis(article_data, count_words, text_column = "abstract")
} # }