Skip to contents

Retrieve and summarize abstracts from the current issue of a selected Nature Portfolio journal using a local LLM and save the output as CSV and/or HTML. Optionally filter the articles by a set of whitelist terms.

Usage

summarize_journal(journal, filename, outdir, model,save_csv,save_html,verbose, whitelist)

Arguments

journal

A character string indicating the name of the supported Nature journal (e.g., "Nature Biotechnology").

filename

A character string specifying the base filename for saving the report. Default is "natchat_summary".

outdir

A character string specifying the directory to save output files. Default is current working directory ".".

model

A character string specifying the local Ollama model to use for summarization (e.g., "llama3:instruct").

save_csv

Logical. Save the results as a CSV file? Default is TRUE.

save_html

Logical. Save the results as an HTML file? Default is TRUE.

verbose

Logical. Should informative messages be printed to the console? Default is TRUE.

whitelist

Optional character vector of terms used to filter articles based on title and abstract. Default is NULL (no filtering).

Value

Invisibly returns a list of file paths (if saved). Generates summarized article metadata and optionally saves it to disk.

Details

This function is a convenience wrapper around get_articles(), add_prompt(), add_summary(), and save_report(). It scrapes the current issue, optionally filters articles using a whitelist of terms, summarizes abstracts using a local LLM, and exports the result.

Examples

if (FALSE) { # \dontrun{
summarize_journal(
  journal = "Nature Medicine",
  model = "llama3",
  whitelist = c("CRISPR", "gene therapy"),
  save_csv = TRUE,
  save_html = TRUE
)
} # }