% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/orm_extract.R
\name{orm_extract}
\alias{orm_extract}
\title{Extract risk categories from bibliographic records}
\usage{
orm_extract(
  refs,
  dict = orm_dict(),
  fields = c("title", "abstract", "keywords"),
  lang = getOption("orisma.lang", "en"),
  verbose = getOption("orisma.verbose", TRUE)
)
}
\arguments{
\item{refs}{An \code{orisma_refs} object (output of \code{\link[=orm_load]{orm_load()}} or \code{\link[=orm_dedup]{orm_dedup()}}).}

\item{dict}{An \code{orisma_dict} object. Default: \code{\link[=orm_dict]{orm_dict()}} (ISO 45001 /
INSST / NIOSH).}

\item{fields}{Character vector. Which text fields to search. Default
\code{c("title", "abstract", "keywords")}.}

\item{lang}{Character. \code{"en"} or \code{"es"}.}

\item{verbose}{Logical. Print progress?}
}
\value{
A list (class \code{orisma_matrix}) containing:
\describe{
\item{\code{refs}}{Original \code{orisma_refs} tibble with added columns:
one binary column per risk category (\verb{cat_*}), \code{n_categories} (total
categories matched), and \code{has_worker_data} (logical).}
\item{\code{matrix}}{Pure binary matrix (records x categories) for
downstream analysis.}
\item{\code{dict}}{The dictionary used.}
\item{\code{categories}}{Category metadata tibble.}
}
}
\description{
\code{orm_extract()} scans the \strong{title}, \strong{abstract}, and \strong{keywords} of each
record against the active risk dictionary and builds a \strong{binary presence
matrix} (record x risk category). It also detects whether each study
contains direct worker exposure data - the key signal for computing the
\strong{WRDI} indicator.

Matching is case-insensitive and uses whole-word boundary detection to
avoid false positives (e.g. "laser" does not match "eyelaser").
}
\examples{
\dontrun{
refs   <- orm_load("my_references/")
deduped <- orm_dedup(refs)

# Use default dictionary
mx <- orm_extract(deduped)

# Use a customised dictionary
dict <- orm_dict()
dict <- orm_dict_add_terms(dict, "nanoparticles", c("nano-dust", "UFP"))
mx   <- orm_extract(deduped, dict = dict)

# Restrict to title + abstract only
mx <- orm_extract(deduped, fields = c("title", "abstract"))
}

}
