Skip to content

Add patentsview-inventors, a local corpus of US patents' inventors - #931

Merged
derek73 merged 1 commit into
masterfrom
feat/patentsview-local-corpus
Oct 28, 2026
Merged

derek73 merged 1 commit into
masterfrom
feat/patentsview-local-corpus

Conversation

@derek73

@derek73 derek73 commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Summary

A second worldwide fielded local corpus, beside orcid-researchers, for checking language-pack decisions. PatentsView's granted-patent tables (USPTO Open Data Portal, grants from 1976 to 2025-12-31) give each inventor's name in the filing's two boxes (first name, last name) and the country of their address.

Two things set it apart:

  • The split is a professional filer's, the applicant's attorney, not the bearer's as in ORCID.
  • Each record counts the distinct people who filed under a name in a country (PatentsView's disambiguated inventor id), so a prolific inventor weighs once.

The extract keeps every name with its count, for the per-country word counts planned next. The corpus keeps at most 20,000 names a country, for the tools that hold a corpus in memory.

tools/differential/local_patentsview.py:

  • The key. It is read from ~/.config/nameparser-tools/uspto-odp-key, sent as X-API-KEY to https uspto.gov hosts only, and dropped on a redirect anywhere else. A missing key is refused naming how to get one, and so is a key the portal refuses (401/403).
  • The pin. The release is pinned by each of the three files' size, listed date and sha256 (the portal lists no checksum), and by the row count. Every field of the TSVs is quoted, so a stray quote can't fold rows together.
  • The join. The raw and disambiguated inventor tables are read in step, and a pair of rows naming different inventor slots is refused rather than joined.
  • The downloads. Each is retried under the shared retry policy. A zip that passed its sha256 is kept across a failed run, so the next run downloads only the rest.
  • The checks. There are gates on malformed rows, the share with a country and the share filling both boxes. The extract is read back through every load check before it replaces the cached one.

local_agreement.scorer_fingerprint(source) now hashes only that source's FIELDED entry. Before, adding this source's row refused every other source's agreement record. This change moves each existing fingerprint once.

Measured (2026-10-28)

  • The fetch: about five minutes, of which the three zips (1.75 GB) took under one.
  • The data: 24,037,380 inventor rows, 99.3% with a country, held 5,319,206 distinct names.
  • The corpus: 657,991 records from 202 countries, 23 of them at the cap, plus the no-country group of 20,000.
  • Agreement: 94.7% overall.
Country patentsview-inventors orcid-researchers
JP 99.8% 95.5%
CN 99.5% 84.5%
KR 99.4% 92.4%
US 99.0% 90.8%
ES 45.6% 48.0%

Filer-split East Asian names agree almost every time, so ORCID's lower East Asian figures reflect how its holders typed their names. The double-surname gap is the same in both.

One shape new to the corpora: 92,503 last-name boxes hold a comma, followed by a suffix (Jr. 55,459 names) or a legal role typed after a deceased inventor's name (deceased 4,635, heir 514, legal representative 393, executrix 328, administrator 288).

Review

A code review and a design-docs review ran.

Code review:

  • A refused key gave a bare 401 traceback. It now names the key file and how to replace it.
  • One dropped download threw away every zip already fetched. Downloads now retry and keep the zips that arrived whole.

Design-docs review (four corrections, each re-verified):

  • A capped count read as a frequency. The comma counts came from the capped corpus and read as if over all the names; they are now the extract's.
  • A stale comparison figure. ORCID's Korea figure predated the comma fix in Read a comma in a box as a space when scoring local agreement #930; it is 92.4%, not 92.3%.
  • An over-reaching "one source" claim. It now says what only this source has: a count of people per name, over US-patent inventors.
  • A missing group. The no-country group is now counted, as ORCID's row counts its own.

Negative controls: each of ten guards made its test fail when switched off.

Notes for merging

  • Re-record the other fielded sources. The per-source fingerprint refuses psc-individuals' and orcid-researchers' shared agreement records once. Kept --base records are re-scored on their next run. I re-recorded all three locally, and their totals were unchanged.
  • Checks: the full suite (32,609), ruff and mypy pass. The local tests pass on 3.15.

🤖 Generated with Claude Code

PatentsView's granted-patent tables on the USPTO Open Data Portal give
each inventor's name in the filing's two boxes and a country. The fetch
reads an API key from ~/.config/nameparser-tools/uspto-odp-key and
sends it to https uspto.gov hosts only, pins the release by each file's
size, listed date and sha256 and by its row count, joins the raw and
disambiguated inventor tables in step, and counts the distinct people
under each name in each country: 24,037,380 rows held 5,319,206 names
on 2026-10-28. The extract keeps every name with its count; the corpus
keeps at most 20,000 a country (657,991 records), scored by
local_agreement.py with ORCID's boxes (94.7% agree).

local_agreement.scorer_fingerprint now hashes only the scoring source's
own FIELDED entry, so adding a source no longer refuses every other
source's record; the change moves each existing fingerprint once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 self-assigned this Oct 28, 2026
@derek73 derek73 added this to the 2.8 milestone Oct 28, 2026
@derek73
derek73 merged commit 87286a8 into master Oct 28, 2026
12 checks passed
@derek73
derek73 deleted the feat/patentsview-local-corpus branch October 28, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant