Search by

survos / names-bundle

tacman1123

Deterministic lookups of common English given names and surnames, from a DuckDB file kept locally or on S3.

Package info

github.com/survos/names-bundle

Type:symfony-bundle

pkg:composer/survos/names-bundle

Fund package maintenance!

kbond

Statistics

Installs: 5

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

2.46.5 2026-11-29 00:24 UTC

This package is auto-updated.

Last update: 2026-11-29 00:25:13 UTC


README

Deterministic lookups of common English given names and surnames, and a parser that uses them to decide whether a name string is a person, an organization or unknown. No model, no network at lookup time: the same text and the same names.duckdb always give the same answer, with the rules and list matches that decided it.

Data

names.duckdb (about 5 MB) has three tables, sorted by name (lowercase), without indexes:

Table Rows Source License
given 105,966 US SSA national baby names 1880 onward, summed over years and sexes (births, female_share, first_year, last_year, rank) CC0
surname 151,671 US Census 2000 surnames with 100 or more people (count, rank, prop100k) Public domain
meta Sources, licenses, counts, build time

ssa.gov and census.gov refuse scripted downloads, so the build reads a CC0 mirror of the SSA files on Hugging Face and FiveThirtyEight's copy of the Census list (URLs in NamesBuildCommand).

Configuration

survos_names:
    data_dir: '%kernel.project_dir%/var/names'   # default
    duckdb_uri: ~             # s3://bucket/names.duckdb or https://...; null reads <data_dir>/names.duckdb
    duckdb_cache: true        # copy a remote file into data_dir once; false queries it in place (httpfs)

S3 credentials come from the usual AWS chain (environment, profile, instance role).

Use

bin/console names:build                  # build <data_dir>/names.duckdb (about 6 s)
bin/console names:build --fetch          # copy duckdb_uri into data_dir again
bin/console names:parse "Clark, Ebenezer, 1790-1861" "Southworth & Hawes" Higgins
bin/console names:parse --json < names.txt
$name = $parser->parse('Hawes, Josiah Johnson, 1808-1901', hint: 'creator');
$name->type;        // person
$name->confidence;  // high (known given name and surname)
$name->sort;        // Hawes, Josiah Johnson
$name->dates;       // 1808-1901
$names = $parser->parseMany($list);      // two lexicon queries for the whole list
$rows = $lexicon->lookup(NameLexicon::SURNAME, ['higgins']);

Rules

  • A firm marker (&, and, Co., Company, Press, Studio, Gallery, Library, Society, Police, ...) makes an organization. Placeholders (Unknown, Unidentified, Anonymous, Various) are unknown.
  • Life dates at the end, after a comma or in parentheses, are kept apart. A parenthesized fuller form or gloss is dropped; so is a cataloguer's closing period.
  • Inverted ("Last, First") and natural order are both read, with honorifics, initials, suffixes (Jr., Sr., II) and surname particles (van, de, di, ...).
  • Person, high: a known given name and a known surname. Person, medium: a known given name, initials or an honorific with a surname, or an inverted form with a known surname or life dates. Person, low: a lone known surname or given name. Otherwise unknown.
  • The caller's hint (person, organization, creator) is kept in hint, never used to decide type.

On the 2,243 distinct creator names of five Harvard OAI sets: 1,568 person high, 432 medium, 41 low, 81 organizations, 121 unknown (mostly "Anonymous painter of ..." placeholders and non-English names).

Limits and next steps

  • English-language lists from the US: Italian, Arabic or Chinese given names are mostly unknown.
  • Common words are also surnames ("Rose Hall" reads as a person). Context belongs to the caller or to lingua.
  • SQLite as a fallback format, as geonames-bundle and geoboundaries-bundle have.
  • Places and points of interest through geonames-bundle or a Nominatim service, and name resolution against authorities, belong to lingua (survos-sites/lingua#3), which can use this bundle as its first provider.