Bilingual patent corpus and cross-search

Prepares public patent full texts as English-Chinese parallel corpora and searches across them in one query.

#patents#parallel corpus#MCP#parallel translation#hover dictionary
Patent bilingual corpora

WorkflowPatent bilingual corpora

Research & knowledge bases Research setup (public patents only)

A data layer that stores the full English text of public patents verbatim in structured form, adds Chinese literal and free translations as reading pages, and offers a search MCP across several corpora. It writes no analysis or conclusions; it is responsible only for complete material.

Challenge

  • Patents are long, and reading claims and descriptions back and forth in English is hard work
  • Once patents gathered by topic are scattered, nobody can find which one held a given drafting precedent

Approach

  • Store bibliographic data, abstract, claims and description of each public patent verbatim in structured form, and split translation into slices handled by agents
  • Write each corpus's scope into its manifest, and provide one search MCP across all corpora

Outcome

  • Reading pages show literal and free translations under the English, with a dictionary on hover
  • Research and design work can pull the relevant passage of any patent through the MCP

The author built this corpus of public patents only, to research patents related to AI and development methods. Each topic has its own corpus, with a written statement of what it includes and excludes.

As a data layer it handles only input and completeness, never conclusions or judgements. Analysis happens in separate work that cites the corpus.

The full workflow

TaskWhoInputsOutputs
1. Define scopeMain session—Corpus scope
2. Fetch textFetcherfetch_extract.pyCorpus scopeEnglish text
3. Plan slicesSlice plannergen_plan.pyEnglish textSlice plan
4. TranslateTranslators + Fan-out scriptone per slice + workflow .jsSlice planSlices
5. MergeMergermerge.pySlicesMerged text
6. CheckCheckercheck_corpus.pyMerged textCheck report
7. Build pagesPage buildergen_html.pyCheck reportReading pages
8. Cross-searchSearch MCPpatent_server.pyCheck reportSearch hits
Patent bilingual corpora

8 steps · 1 role · 7 tools · 1 loop · 3 corpora, 42 patents, 26 translated

Store the English exactly as fetched, let agents translate slice by slice in parallel, and publish to pages and search only after the machine check passes.

  • As a data layer it handles only intake and completeness; no analysis or conclusions are written here
  • Original and translation are separate files, so fixing a translation never touches the original
  • The only model work is translation in step 4; fetching, slicing, merging, checking, pages and search are scripts and a server
  • The checker decides when a corpus is done; in strict mode, anything untranslated fails

Project folders involved (3)

This workflow does not live in one folder: it runs across projects.

(private) patent data folder
The core: corpora, pipeline scripts and the search server
patent-mcp plugin
The author's plugin bundling the search server, enabled per project
(private) research folders
Separate work that cites the corpora; conclusions are written there
Define scope

Step 1 · Main session

Define scopemeta.scope

Write down, per corpus, what goes in and what stays out.

  • Only published patent documents are included
  • The boundary is written inside the manifest, never left to be guessed from folder names
  • Each topic gets its own corpus, with groups and topics for filtering
OutputsCorpus scope
Fetch text

Step 2 · Fetcher

Fetch textfetch_extract

Fetch the full English text from the public page in structured form.

  • Bibliographic data, abstract, claims and description are stored exactly as fetched
  • Classification, citations, family and legal events come along as bibliographic fields
  • Translated corpora use a bibliography-only update mode, because re-fetching the body breaks its alignment with the translation

Common misconceptionRe-fetching is not harmless: overwriting a translated body shifts the paragraph alignment

InputsCorpus scope
OutputsEnglish text
Plan slices

Step 3 · Slice planner

Plan slices30 paragraphs

Split the translation into slices one agent can handle.

  • Each patent gets one slice for title, abstract and all claims
  • The description is cut into slices of 30 paragraphs
  • The first corpus of 20 patents came to 157 slices
InputsEnglish text
OutputsSlice plan
Translate

Step 4 · Translators + Fan-out script

Translatelit + free

Send one agent per slice in parallel to write literal and free translations.

  • Claims get both a literal and a free translation; the description is translated paragraph by paragraph
  • The translated paragraph count must equal the original's, and each agent writes only its own slice file
  • Every agent receives the same terminology list and the rule to keep figure numbers and reference signs unchanged

Claude CodeA workflow script fans the slices out; general-purpose subagents do the translating

InputsSlice plan
OutputsSlices
Merge

Step 5 · Merger

Mergemerge.py

Merge the slices into one translation per patent.

  • The merged translation lives in a file separate from the original
  • Translations come in two shapes, plain strings and literal/free pairs; that is a convention, not an error
  • Every consumer goes through one shared function, so both shapes are handled the same way
InputsSlices
OutputsMerged text
Check

Step 6 · Checker

Checkcheck_corpus

Check structural completeness and decide whether the corpus is done.

  • It counts untranslated patents and empty translated paragraphs
  • A non-zero exit code means fail
  • Strict mode also fails anything untranslated and is used to accept a finished corpus
InputsMerged text
OutputsCheck report
Build pages

Step 7 · Page builder

Build pagesgen_html

Build reading pages with literal and free translations under the English.

  • Hovering over an English word shows a dictionary entry, cut down per page to what is needed
  • A panel at the bottom right toggles literal, free and translated text
  • Pages can always be rebuilt, so they are kept out of the repository
InputsCheck report
OutputsReading pages
Cross-search

Step 8 · Search MCP

Cross-search8 MCP tools

Search across all corpora at once.

  • Eight tools; the corpus list is always fetched first instead of guessing names
  • An empty corpus name searches across all corpora; on the Chinese side both literal and free translations are searched
  • The server ships in the author's plugin and is enabled only in the projects that use it
InputsCheck report
OutputsSearch hits

Loops and rework

  • Untranslated or empty paragraphs → step 4: Only the missing slices go back to the agents, then merge and check run again

Key points

Keep original and translation apart. The English full text is stored exactly as fetched; translations are written as separate slice files and then merged. Fixing a translation never touches the original.

Update only bibliographic data once a corpus is translated. Re-fetching full text rewrites the body and breaks its alignment with the translation, so translated corpora use a bibliography-only update mode.

Let the checker decide completion. A corpus is not considered done until the structural integrity checker passes; in strict mode, untranslated items also fail.