
Load biomedical dictionaries with improved error handling
Source:R/text_preprocessing.R
load_dictionary.Rd
This function loads pre-defined biomedical dictionaries or fetches terms from MeSH/UMLS.
Usage
load_dictionary(
dictionary_type = NULL,
custom_path = NULL,
source = c("local", "mesh", "umls"),
api_key = NULL,
n_terms = 200,
mesh_query = NULL,
semantic_type_filter = NULL,
sanitize = TRUE,
extended_mesh = FALSE,
mesh_queries = NULL
)
Arguments
- dictionary_type
Type of dictionary to load. For local dictionaries, limited to "disease", "drug", "gene". For MeSH and UMLS, expanded to include more semantic categories.
- custom_path
Optional path to a custom dictionary file.
- source
The source to fetch terms from: "local", "mesh", or "umls".
- api_key
UMLS API key for authentication (required if source = "umls").
- n_terms
Number of terms to fetch.
- mesh_query
Additional query to filter MeSH terms (only if source = "mesh").
- semantic_type_filter
Filter by semantic type (used mainly with UMLS).
- sanitize
Logical. If TRUE, sanitizes the dictionary terms.
- extended_mesh
Logical. If TRUE and source is "mesh", uses PubMed search for additional terms.
- mesh_queries
Named list of MeSH queries for different categories (only if extended_mesh = TRUE).