Matching names against a reference spends most of its time preparing the
reference: finding the genus of every name, parsing the names and building
the keys used for comparison. ts_optimize_ref() does the first of
these once, and the other two lazily, one genus at a time, the first time a
query needs that genus. Pass the result to ts_match_names()
or ts_resolve_names() in place of the reference; repeated
calls (for example many batches of queries, or an interactive session
against a large reference such as WFO or GBIF) then skip work that has
already been done.
ts_optimize_ref(ref, strip_qualifiers = FALSE)Character vector of reference names (with authors), or a
dataframe of taxonomic data in Darwin Core format (see
ts_resolve_names()). A dataframe can be used for both
ts_match_names() and ts_resolve_names() (as
ref); a character vector only for the former.
Logical; remove standalone open-nomenclature
qualifiers (cf., aff., ...) from the reference names before parsing.
See ts_parse_names(). Default: FALSE. The setting used
here applies to the reference; the strip_qualifiers argument of the
matching functions then applies to the query only.
A ts_reference object.
Results are identical to those obtained by passing the reference directly. The object holds the parsed names of every genus used so far, so it grows with use, up to the size of the whole parsed reference.
data(filmy_taxonomy)
ref <- ts_optimize_ref(filmy_taxonomy)
ref
#> <ts_reference> 2727 names in 67 genera
#> genera parsed so far: 0
# Reuse for several calls
ts_match_names("Gonocormus minutum", ref, simple = TRUE)
#> # A tibble: 1 × 3
#> query reference match_type
#> <chr> <chr> <chr>
#> 1 Gonocormus minutum Gonocormus minutus (Bl.) Bosch auto_fuzzy_canon
ts_resolve_names("Gonocormus minutum", ref)
#> # A tibble: 1 × 7
#> query resolved_name matched_name resolved_status matched_status match_type
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 Gonocorm… Crepidomanes… Gonocormus … accepted name synonym auto_fuzz…
#> # ℹ 1 more variable: dist <int>