Expand description
A faithful Rust port of the GBIF scientific name parser. parse_name turns a scientific name into
its structured atoms — genus, epithets, authorship, rank, nomenclatural code, notes, warnings —
as a model::ParsedName. Byte-for-byte cross-validated against the Java name-parser
(NameParserImpl) over 11,302 + 6.4M names (0 diffs). The same engine also ships as a native
CLI and as Java/Python/R bindings — see the repository README.
Modules§
- format
- Port of Java
org.gbif.nameparser.util.NameFormatter— renders aParsedNameback into a formatted scientific-name string. - model
- pipeline
- Java
org.gbif.nameparser.pipeline.Pipeline— orchestrates the staged parsing pipeline. Each stage mutates the shared [ParseContext]. - regexes
- Ported StripAndStash patterns. The Java sources carry ~20 possessive quantifiers (14 in
Preflight, 6 in StripAndStash); they’re dropped here because the
regexcrate is a linear-time automaton, so possessive/greedy is moot. - token
- unicode
- Java
org.gbif.nameparser.util.UnicodeUtils— ported subset:normalizeQuotes, plus the homoglyph-replacement table (HOMOGLYHPS/containsHomoglyphs/replaceHomoglyphs) used bypipeline::stripandstash’s step 13.decompose/foldToAscii/replaceSpecialCases/removeNonAscii/replaceNonAscii/unescapeUnicodeChars/decodeUtf8Garbage/containsDiacritics/findDiacriticsare NOT ported: no call site anywhere in this crate’s (now complete) pipeline reaches them, and the full-corpus Rust-vs-Java parity cross-validation (seeBENCHMARKS.md/cross-validation.md, 0 mismatches) confirms their absence isn’t a gap. - viral
- Java
org.gbif.nameparser.pipeline.ViralSuffix— recognises the standardized ICTV viral rank suffixes on a single word (genus, monomial, or higher-taxon name). Per MSL41 every virus genus ends in one of these, so the suffix alone is a reliable virus signal.
Enums§
- Parse
Result - The exceptionless result of
parse, mirroring Javaorg.gbif.nameparser.api.ParseResult: a structurallyParsedname or anUnparsableclassification (virus, hybrid formula, placeholder, BOLD BIN, …). Informal names — provisional, open-nomenclature and indetermined ones likeRhizobium sp. RMCC TR1811orAbies cf. alba— areParsednames of typeNameType::Informal;ParsedName::anchorgives the real taxon they hang off.
Functions§
- parse
- The primary exceptionless entry point (mirrors Java
NameParser.parse()): classifies a scientific name into theParseResult(Parsed | Unparsable) that every binding exposes, never throwing. Informal names areParsed, typedNameType::Informal. For the rawParsedName/error shape, useparse_name. - parse_
name - The lower-level raw parse: a scientific name — optionally alongside a separately supplied
authorship string, a requested
Rankand a requestedNomCode— into aParsedName, orErr(ParseError)when the input cannot be parsed into a meaningful name. Delegates topipeline::run.