Learn R Programming

taxonbridge (version 1.0.5)

fuzzy_search: Match misspelled or partial scientific names

Description

Match misspelled or partial scientific names

Usage

fuzzy_search(x, term, sensitivity = 0, allow_term_removal = FALSE)

Arguments

x

A tibble created with load_taxonomies() or load_population() or load_sample().

term

A string consisting of a scientific name.

sensitivity

An integer representing character mismatch tolerance (defaults to intolerant i.e. sensitivity=0)

allow_term_removal

Allow searches against only the first word of a search query. Useful when "Genus sp." or "Genus indet." is the search phrase.

Value

A list of candidate match(es), if applicable.

Details

The sensitivity parameter sets the number of character mismatches that are tolerated for a match to be reported. The higher the sensitivity, the more matches will be found, but the less relevant they may be. The allow_term_removal parameter allows stripping the search query to only retain the characters before the first occurrence of a white space (i.e., only the first word of a search query is used during the search). However, fuzzy_search() will always search using the entire search query first and then only proceed to strip terms if no hits are found.

Examples

Run this code
# NOT RUN {
fuzzy_search(load_sample(), "Miacis deutschi")
fuzzy_search(load_sample(), "Miacis sp.", allow_term_removal = TRUE)
fuzzy_search(load_sample(), "Miacus deutschi", sensitivity = 1)
# }

Run the code above in your browser using DataLab