Botanical-name: a small open-source parser for plant names (PHP + JavaScript)

Hi all,

We have released botanical-name, an MIT-licensed library that parses, normalizes and formats botanical names: hybrids, infraspecific ranks, authors, cultivars, cultivar groups and trade designations. It is available for PHP and for JavaScript/TypeScript, and both versions run the same test fixtures and give identical output.

It grew out of a practical problem at PlantGeekz, a plant identification app built on the GBIF and Catalogue of Life backbones. Names arrive as hydrangea x macrophylla ssp. serrata cv. Bluebird, and most websites italicize the whole name. The library turns that into Hydrangea ×macrophylla subsp. serrata ‘Bluebird’, with italics only where ICN and ICNCP put them. It also gives a comparison key for matching names spelled in different ways, and it reports every change it made.

It is not a replacement for GBIF’s name-parser or gnparser. It is a structural parser for web projects that have no JVM or Go toolchain, and it never looks names up. Before release we ran it on 30,569 real names, and the PHP and JS results were identical.

Feedback is very welcome, especially names it gets wrong.

Rasmus, PlantGeekz (Copenhagen)