Skip to content

Infer a code only from evidence of one code (#60) - #184

Merged
mdoering merged 18 commits into
mainfrom
fix/60-code-inference
Oct 19, 2026
Merged

mdoering merged 18 commits into
mainfrom
fix/60-code-inference

Conversation

@mdoering

@mdoering mdoering commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Closes #60.

Without a code from the caller, the parser now sets a nomenclatural code only from evidence that belongs to one code. It no longer guesses from the shape of the authorship.

What still sets a code

  • A rank that exists in only one code, from the marker or from the caller's rank.
  • A named hybrid (notho marker or ×Genus) → BOTANICAL.
  • Sanctioning by Fries or Persoon, also on the species authorship → BOTANICAL.
  • Candidatus, Approved Lists or a revived name (ex Author year) → BACTERIAL.
  • nomen oblitum / nomen protectum → ZOOLOGICAL.
  • The virus shape → VIRUS, and cultivar epithets, cv., Group or grex → CULTIVARS, as before.

What no longer sets a code

Evidence

Measured on a ChecklistBank sample stratified by declared code (945k rows), parsed without a code hint:

  • A year → ZOOLOGICAL was wrong for about 98% of the botanical names that carry a year (481k) and for all the bacterial ones (77k).
  • (Bas) Comb and ex cannot tell botanical from bacterial names.
  • The signals that remain are about 99% right.

Across the full corpus, about 32.7M of 67.5M names lose an inferred code. That removes about 626k wrong codes; about 13.8M correct ones go with them.

Side effects follow the output code

With no code:

  • a bare trinomial, r. or st. is INFRASPECIFIC_NAME, not SUBSPECIES (about 563k names);
  • Genus (Sub) is INFRAGENERIC_NAME, not SUBGENUS (about 28k), and still renders in brackets;
  • m. is INFRASUBSPECIFIC_NAME, not MORPH (about 3.7k);
  • labels keep subsp.;
  • anon. renders as Anon..

Follow-ups in the same branch

  • Boletus edulis Bull. : Fr. subsp. edulis: the sanctioned species author before a rank marker now parses.
  • An antigenic formula after a binomial is the phrase, for example Escherichia coli O157:H7 str. K7140 → phrase O157:H7 str. K7140, rank STRAIN (1,444 names).
  • Only Fries or Persoon is a sanctioning author, stored as Fr. or Pers. whichever form was written (Fries, fr., Persoon). R.E.Fr. does not count. Any other colon tail, such as page numbers or HIV strain codes, stays in unparsed (7,301 of 1.26M names with a colon).
  • An unranked infrageneric name without a code renders in brackets, so Agaricus tr. Hypholoma Fr. → Agaricus (Hypholoma) Fr. (32 format golden rows).
  • docs/parsing-examples.md regenerated.

Compatibility

  • No api, ABI or model change: the code field stays and only its values change.
  • Consumers that relied on year → ZOOLOGICAL now get no code, and should pass a code hint where they know the code.
  • Tests, the parse and format goldens, and the Python, Java, R and CLI binding tests were re-baselined. Tests about zoological or botanical behaviour now pass a code hint.

Infrageneric names

A review of infrageneric names now that the code is often missing. The overview lives in the new "Infrageneric names by code" section of docs/parsing-examples.md. It parses each example with no code, ZOOLOGICAL and BOTANICAL, and is regenerated with the doc.

  • Genus trib./subtrib. X is an unranked subdivision of the genus (Fries's tribus, ICN Art. F.4.1), not a tribe that drops the genus (174 names). It is a tribe only next to a family-group name. tribus is a tribe only there too, and otherwise stays an epithet (Erionota tribus Evans, 1941).
  • Brackets without a marker only for an unranked infrageneric name of any code, and a zoological subgenus. Every other rank shows its marker.
  • A ZOOLOGICAL hint makes a subgenus only of a bare Genus (X), never of a name whose marker says it is unranked (unr., [unranked], nothogrex, trib.).
  • A rank of another code than the one given keeps the caller's code, with the CODE_MISMATCH warning, instead of being overridden.
  • A subgenus is written subg. as in botany (ICN Art. 21), or subgen. under the bacterial code, which also puts it inside a species' brackets (Prokaryotic Code 2025, Rule 10c). 15 format golden rows change only in the marker.
  • Rule 10c citations parse: Acetobacter (subgen. Gluconoacetobacter Yamada and Kondo 1985) liquefaciens. The subgenus author is dropped with a Removed: warning (17 names).
  • A zoological div. within a genus is unranked, like Parse zoological section names - Balanus (sect. Ortho-balanus) Hoek, 1913 #171 sections (6 names, all insects or scorpions).

Also adds VERSIONS.md, a brief history of major changes back to the Java parser.

The shape of an authorship no longer sets the nomenclatural code. A year, a
comma, a bracketed basionym, an ex-author, filius or a 1753-57 year is citation
style that sources follow across codes: TAXREF cites its plants `Coode &
Cullen, 1965`, LPSN its bacteria `Lee et al. 2004`, and bacteria share the
botanists' `(Basionym) Combination` and `ex`. Measured on the ChecklistBank
names that declare a code, a year made ~98% of the botanical and all bacterial
names with a year ZOOLOGICAL. The vote tally is gone; a code is set only by:

- a code-exclusive rank, from its marker or the caller (sect., pv., ab., ...)
- a named hybrid, or sanctioning by Fries or Persoon (BOTANICAL)
- Candidatus, Approved Lists, a revived name (BACTERIAL)
- a virus shape (VIRUS), a cultivar (CULTIVARS)
- nomen oblitum / protectum (ZOOLOGICAL)

nom. illeg./inval./cons./... no longer set BOTANICAL: cyanobacteria and the
ICNP carry them too. A comma-year still makes a bracketed section an unranked
infrageneric name (#171), but no longer sets ZOOLOGICAL.

Output that followed the inferred code now stays neutral: a bare trinomial is
INFRASPECIFIC_NAME, `Genus (Sub)` INFRAGENERIC_NAME, `m.` INFRASUBSPECIFIC_NAME,
labels keep their `subsp.` marker, a botanical autonym keeps its author where
written. The zoological ex-swap is unaffected (1 of 1,862 corpus ex rows
changes). Dead vote-only state removed (filius, initials-first, manuscript-ex,
coded diacritics, species code state).

CLB verbatim corpus, estimated from a 945k sample stratified by declared code:
~32.7M of 67.5M names lose an inferred code. Of names with a declared code,
~626k wrong codes go (524k botanical and 78k bacterial names had ZOOLOGICAL)
and ~13.8M right ones. Ranks: ~563k SUBSPECIES -> INFRASPECIFIC_NAME, ~28k
SUBGENUS -> INFRAGENERIC_NAME, ~3.7k MORPH -> INFRASUBSPECIFIC_NAME.

Tests: ~880 inferred code/rank assertions re-baselined; tests about zoological
rendering pass a code hint. Goldens re-baselined (2,405 parse rows lose a code,
129 change rank; 31 format rows).

Closes #60
`Boletus edulis Bull. : Fr. subsp. edulis` read `Fr.subsp.edulis` as the
sanctioning author and lost the subspecies. The colon of Fries or Persoon now
continues the species author span before a rank marker, and that species
author's sanctioning is botanical evidence too. No such row in the CLB corpus.

Refs #60
`Escherichia coli O157:H7 str. K7140` read `O157` as an author and
`H7 str.K7140` as his sanctioning author, a botanical code before #60. The
serotype's antigenic formula, perhaps after its pathotype (`STEC`), and what
follows it are the phrase, with the strain rank after a strain marker, as
`Escherichia coli str. K-12` is. CLB verbatim corpus: 1,444 of 2,534
candidate rows change, all to the antigenic formula phrase.

Refs #60
)

With no code inferred from a year, `Calathus (Lindrothius) Kurnakov, 1961`
rendered as `Calathus infragen. Lindrothius`, a marker no one writes. An
unranked infrageneric of no code is written in brackets, as a zoological one
is; this also replaces `infragen.` for `Agaricus tr. Hypholoma Fr.`.
Format golden: 32 rows.

Refs #60
ICN Art. 15 sanctions through Persoon's Synopsis and Fries' Systema only. Any
other text after a colon was kept as the sanctioning author: page citations and
their notes (`Günther, 1875: 231 (fide Smith, 1943)`), HIV and E. coli strain
designations (`HIV-1 M:CRF02_AG`). It is now left unparsed. The two are
cited in one form, `Fr.` and `Pers.`, whether written `Fr`, `Fries`,
`fr.` or `Persoon`; a Fries with initials (`R.E.Fr.`) is another Fries.

CLB verbatim corpus, all 1,261,926 rows with a colon: 7,301 lose a fake
sanctioning author (its text now unparsed), 53 are normalised to Fr./Pers.,
7 `(Wulfen:fr.)` are recognised (BOTANICAL), `Bull.:Pers. sens. Gr` no
longer is. Golden: 1 row (`Bold:Aab`).

Refs #60
"Agaricus trib. Pholiota Fr." dropped the genus and made Pholiota a
tribe. Fries's tribus of Agaricus are unranked subdivisions of the genus
(ICN Art. F.4.1), as are Hampe's of Hypnum; the parser already read the
short "tr." that way. Now trib./subtrib. after a genus does too, unless a
family-group name stands before or after the marker ("Apocynaceae trib.
Tabernaemontaneae", "Benoistia trib Benoistieae").

"tribus" before a family-group name is a tribe ("Cornaceae tribus
Griselinieae Wangerin"); otherwise it stays an epithet ("Erionota tribus
Evans, 1941").

174 ChecklistBank names become unranked infragenerics in their genus,
4 become tribes.
…kets (#60)

Brackets without a marker are for an unranked infrageneric of any code
("Agaricus (Pholiota) Fr.", botanical "Abies (Grandes) sp. 1" instead of
the invented "infragen.") and a zoological subgenus. Of no code a
subgenus keeps the marker it was written with, as a botanical one must
(ICN Art. 21.1); every other rank shows its marker.

The parse and format goldens do not change.
…anked (#60)

Under the zoological code a bare "Genus (X)" is the subgenus (ICZN
Art. 6.1), but a marker that names no rank says otherwise: "Hieracium
unr. Verbasciformia", "Viola [unranked] Mirabiles", "Malus nothogrex
Prunifoliae" and Fries's "Agaricus trib. Pholiota" stay
INFRAGENERIC_NAME with a ZOOLOGICAL hint.
"Rosa div. Caninae" or "Pinus suprasect. Taeda" given as ZOOLOGICAL
came back BOTANICAL: the rank's code replaced the caller's, with a
warning. Both now stay as given, still with the CODE_MISMATCH warning.
The parser no longer overrides a code it was told.
The botanical code writes a subgenus "Costus subg. Metacostus" (ICN
Art. 21); zoologists bracket it instead (ICZN Art. 6.1), and the
Prokaryotic Code (2025 Revision) writes "subgen." only inside the
brackets of a species name (Rule 10c). So the marker follows botany:
"Astragalus subg. Cercidothrix", where Java wrote "subgen.". A subgenus
with no code keeps the marker.

15 rows of the format golden change only in the marker.
A new section of docs/parsing-examples.md parses each infrageneric
example with no code and with the zoological and botanical code given,
and states the parsing and formatting rules, so the overview follows
the engine whenever the document is regenerated. tools/parsing_examples.py
gains an "@by-code" table mode for it.
The Prokaryotic Code (2025 Revision, Rule 10c) cites a subgenus with
its author inside the brackets: "Acetobacter (subgen. Gluconoacetobacter
Yamada and Kondo 1985) liquefaciens (Asai 1935) Gosselé et al. 1983".
The parser read the whole bracket as a basionym author of the genus and
left the species unparsed. Now the species parses with its subgenus.
The subgenus author has no place in a species' name and is dropped with
a "Removed:" warning; on its own it is the subgenus' authorship.

17 ChecklistBank names change, all Moraxella, Acetobacter and
Rhodococcus.
Old entomologists divided genera into "div." (Dejean's "Feronia (div.
Percus) Dejean, 1828"), which came out as the botanical divisio and
BOTANICAL. Like a zoological section (#171) it is now an unranked
infrageneric name, under the zoological code or told by a year after a
comma. 6 ChecklistBank names change, all insects or scorpions.
The Prokaryotic Code abbreviates subgenus "subgen." (Rules 10c, 34c)
and puts the marker inside the brackets of a species name: "Acetobacter
(subgen. Gluconoacetobacter) liquefaciens". Under the bacterial code a
subgenus on its own is now "Acetobacter subgen. Gluconoacetobacter", and
a species shows its subgenus that way. Every other code keeps "subg.",
or the bare brackets in a species.
@mdoering
mdoering merged commit 5ff9aaf into main Oct 19, 2026
10 checks passed
@mdoering
mdoering deleted the fix/60-code-inference branch October 19, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code inference: how much inference can and should we do?

1 participant