Computes the per-row priority scores used to rank backbone candidates for a
name (smaller is better): smallest fuzzy distance (dist_score), then
taxonomic status (status_score: accepted, then a synonym homotypic with its
accepted name, then a name the backbone keeps but has not reviewed, then any
other synonym, then a misapplication), SPECIES over
higher ranks (rank_score), the epithet-preserving accepted target
(epithet_score, the homotypic basionym among same-name homonym synonyms,
e.g. Pinus abies -> Picea abies), and finally nomenclatural validity
(valid_score). Used by the matching engine's best-match selection and, in
the taxifydb build pipeline, to collapse each backbone key to the single
accepted name taxify() resolves it to.
Arguments
- candidates
A data.frame with
taxonomicStatusandtaxonRank, and optionallyis_synonym(the backbone's normalized synonym flag),fuzzy_dist(fuzzy proximity),nomenclaturalStatus(validity),matched_name_stdandaccepted_name(epithet preservation), plusauthorshipandaccepted_authorship(homotypy). Two scores read the candidate'sn_occurrences(records filed under its key, a column only the GBIF backbone carries), both 0 throughout when the column is absent and both outside the tier: which key holds the data is not a statement about which taxon the name denotes.data_scoreis 0 for a key with at least one record that keeps the name as its own concept (accepted, doubtful or unplaced; never a synonym, whose accepted ID is another taxon) and 1 otherwise (no records, no count, or a synonym); it orders afterdist_scoreand beforestatus_score.occ_scoreis minus the count,Infwhere it is missing; it orders afterepithet_score, so it only separates keys the concept scores leave level.year_scoreis the year the name was published (theyearcolumn, else the first year inname_published_in;Infwhere unknown, 0 throughout when both columns are absent); it orders afterepithet_scoreand beforeocc_score, so the earliest of several same-name homonyms wins before the count is read.
Value
A list with the numeric vectors dist_score, data_score,
year_score, occ_score and
status_score, integer vectors rank_score, valid_score, epithet_score, and the
character tier signature ("dist/status/rank/epithet") per row, in input
order.
Details
dist_score orders first because candidates for a fuzzy query are different
backbone names: the closest one is the best reading of the input, and the
remaining scores then choose among the rows carrying that name. It is 0
throughout when fuzzy_dist is absent, which is every exact-match path.
The returned tier covers the four concept scores only. valid_score orders
the pick but stays out of the tier: a nomenclaturally valid name can be a
synonym of a different species than an illegitimate one carrying the same
string, so validity must not make that conflict look resolved. Sort with
candidate_order() rather than re-listing the columns.
A synonym counts as homotypic when its own basionym author is the accepted
name's parenthetical author and the accepted name keeps its final epithet
(Lycopsis orientalis L. -> Anchusa arvensis subsp. orientalis (L.)
Nordh.). That outranks a record the backbone keeps unplaced under the same
string, which is a different type: a homonym, not the name the placed
record carries (#81).