krt can extract candidate resources from a manuscript
with a deterministic regex engine (the default, fully offline) or an
optional LLM.
txt <- "We stained with anti-TH (RRID:AB_390204) from Millipore (Cat# AB152)
and analyzed images in Fiji (RRID:SCR_002285). Data: GEO GSE12345."
scan_identifiers(txt)
#> value field type confidence
#> 1 AB_390204 rrid Antibody high
#> 2 SCR_002285 rrid Software/code high
#> 3 AB152 catalog_number <NA> medium
#> 4 GSE12345 accession Dataset highres <- extract_krt(txt)
as.data.frame(res$krt)[, c("resource_type", "display_name", "rrid")]
#> resource_type display_name rrid
#> 1 Antibody AB_390204 RRID:AB_390204
#> 2 Software/code SCR_002285 RRID:SCR_002285
#> 3 Other AB152 <NA>
#> 4 Dataset GSE12345 <NA>The result is a normalized, validated krt_tbl plus a
validation report; every extraction is provenance-stamped with the
engine used.
read_input_text() handles PDF, JATS/NISO XML, DOCX, and
plain text, and detect_existing_krt() parses a Key
Resources Table already present in the document.
The LLM engine is opt-in and requires a provider and API key. It is
non-deterministic, so it is never the default, and its output is
funneled through the same normalize and validate steps the regex engine
uses before you see a candidate table. (Direct importers such as
import_krt() only read and structure the file; normalize
and validate them yourself when you need to.)
cfg <- krt_llm("openai", model = "gpt-4o-mini") # reads OPENAI_API_KEY
res <- extract_krt("path/to/manuscript.pdf", engine = "llm", llm = cfg)You can register a custom or local provider: