You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

The Future Of Patent Corpus Management

Input Any USPTO/EPO Patent PDF - Output Enterprise Wide, Deduplicated Patent Corpus

The pipeline takes as input any USPTO/EPO patent PDF and outputs an enterprise-wide, deduplicated patent corpus. The pipeline is designed to handle large-scale automation and bulk datasets, making it suitable for organizations that need to manage and analyze patent data efficiently.

Patent Corpus Demo - All Outputs Of 100 Randomly Selected Patent Documents

Pipeline Inputs

The available input modes are:

  • FILE
  • ARCHIVE

*All statements apply to any USPTO, and EPO published patent document, unless mentioned otherwise.

FILE mode allows the user to place any published patent document (PDF) in an ingest directory, and the pipeline handles everything else.

ARCHIVE mode takes any official Bulk Download Dataset, and processes it automatically.

Details that matter

  • No restrictions on when the published patent document was published.
  • All official languages are supported:
    • EPO: [English, French, German]
    • USPTO: [English]

No restrictions on the page count of the published patent document.

Regardless of whether an input file has an embedded text layer or not, the pipeline will generate a page text for each page of the published patent document.

No filtering/deduplication/manual curation should be done by the user. The pipeline was designed to handle all of that automatically.

Pipeline outputs

The pipeline creates standardized outputs for each processed published patent document.

Every published patent document in the output is not already in the corpus, and is not a duplicate of any other published patent document in the output.

All outputs are generated deterministically based on the pages tables. This is the enterprise-wide single source of truth which includes all filepaths for the outputs, and is used to generate the outputs in a consistent manner.

Here is an example of the outputs for a single published patent document:

All keys in the two JSON Arrays below are columns in the pages table, apart from first_page_file_path and last_page_file_path, which are included for illustration purposes only.

# One level under the hash directory
'published patent document hash' / 'document level outputs'
───────────────────────────────────────────────────────────

# Two levels under the hash directory
'published patent document hash' / 'pages' / 'page level outputs'
───────────────────────────────────────────────────────────────

Let's look at the 'document level outputs' that are generated for a single published patent document.

[
  {
    "csv_filename": "12295323.csv",
    "csv_filename_parts": [
      {
        "stem": "12295323",
        "extension": ".csv"
      }
    ],
    "parquet_filename": "12295323.parquet",
    "parquet_filename_parts": [
      {
        "stem": "12295323",
        "extension": ".parquet"
      }
    ],
    "pdf_filename": "12295323.pdf",
    "pdf_filename_parts": [
      {
        "stem": "12295323",
        "extension": ".pdf"
      }
    ],
    "readme_filename": "README.md",
    "manifest_filename": "manifest.json"
  }
]

This is generated by the following SQL query:

WITH
    filenames AS (
        SELECT
            parse_filename(csv_file_path) AS csv_filename,
            parse_filename(parquet_file_path) AS parquet_filename,
            parse_filename(pdf_filename) AS pdf_filename,
            parse_filename(readme_file_path) AS readme_filename,
            parse_filename(manifest_file_path) AS manifest_filename,
        FROM
            pages
        WHERE
            pdf_filename = '12295323.pdf'
    )
SELECT DISTINCT
    regexp_extract_all(
        csv_filename,
        '([^.]+)(\.csv)',
        ['stem', 'extension']
    ) AS csv_filename_parts,
    regexp_extract_all(
        parquet_filename,
        '([^.]+)(\.parquet)',
        ['stem', 'extension']
    ) AS parquet_filename_parts,
    regexp_extract_all(
        pdf_filename,
        '([^.]+)(\.pdf)',
        ['stem', 'extension']
    ) AS pdf_filename_parts,
    (*),
FROM
    filenames;

all pages are stored in a subdirectory called pages under the hash directory. They use the stem of column pdf_filename and appent to it the page number and the .pdf extension. It follows the same naming convention as the pdf_filename column, but with the page number appended to the stem. The count of files in the pages subdirectory includes page_count files, starting with page 1 and ending with page_no == page_count.

"page_file_path": [
  {
    "stem": "12295323_page_1",
    "extension": ".pdf"
  }
],

Run Stats

[
  {
    "total_pdf_page_count": 8491,
    "total_embedded_character_count": 0,
    "total_character_count_in_output": 686739190,
    "unique_filename_count": 8491,
    "unique_content_hash_count": 8491,
    "unique_language_count": 1,
    "unique_modified_timestamp": 8113,
    "unique_created_timestamp": 8113,
    "unique_readme_file_paths": 8491,
    "unique_directory_paths": 8491,
    "unique_csv_file_paths": 8491,
    "unique_parquet_file_paths": 8491,
    "unique_pdf_file_paths": 8491,
    "unique_page_file_paths": 231315
  }
]

Human-readable scale: 686,739,190 extracted characters (about 686.7 million) across 231,315 page-level PDF artifacts. The source PDFs contained zero recorded embedded-text characters, so the page text represented here was reconstructed by the pipeline.

Materialized Output

The finalized run materialized more than 282,000 stored artifacts under 8,491 hash-prefixed document directories:

Output class Files
Original source PDFs 8,491
Per-document CSV exports 8,491
Per-document Parquet exports 8,491
Per-document README.md files 8,491
Per-document manifest.json files 8,491
Hidden per-document .meta.json sidecars 8,491
Individual page PDFs 231,315

The bucket view captured 282,263 items before the separate dataset-wide pages.parquet query table was added. Raw object totals can include hidden filesystem metadata; the operational result is the repeatable artifact structure above, produced for every content-addressed document directory.

Each document directory is keyed by the full content hash of its source PDF. If identical input bytes are encountered again, they resolve to the same document identity instead of creating a second logical document. The client therefore does not have to pre-select or pre-deduplicate the input collection.

Code to reproduce

sql_queries/run_stats.sql

or

COPY (
    SELECT
        COUNT(DISTINCT (hash, page_count)) AS total_pdf_page_count,
        SUM(page_char_count_pdf) AS total_embedded_character_count,
        SUM(page_char_count_after_conversion) AS total_character_count_in_output,
        COUNT(DISTINCT (pdf_filename)) AS unique_filename_count,
        COUNT(DISTINCT (hash)) AS unique_content_hash_count,
        COUNT(DISTINCT (metadata_language)) AS unique_language_count,
        COUNT(DISTINCT (moddate_dt)) AS unique_modified_timestamp,
        COUNT(DISTINCT (creation_date_dt)) AS unique_created_timestamp,
        COUNT(DISTINCT (readme_file_path)) AS unique_readme_file_paths,
        COUNT(DISTINCT (directory_path)) AS unique_directory_paths,
        COUNT(DISTINCT (csv_file_path)) AS unique_csv_file_paths,
        COUNT(DISTINCT (parquet_file_path)) AS unique_parquet_file_paths,
        COUNT(DISTINCT (pdf_file_path)) AS unique_pdf_file_paths,
        COUNT(DISTINCT (page_file_path)) AS unique_page_file_paths
    FROM
        'data/pages.parquet'
) TO '/Volumes/crucial/huggingface/run_stats.json' (ARRAY);

Page Coverage

There is no page in any of the input files where the conversion did not extract text from.

This file lists each file's page_count and the number of pages with text in each file.

For all 8491 files: pages_page_count_validation.json

Code to reproduce

sql_queries/pages_count_validation.sql

or

COPY (
    SELECT
        pdf_filename,
        pdf_file_path,
        max(page_no) AS max_page_no,
        max(page_count) AS page_count,
        min(length(page_text)) AS page_least_text,
        max(length(page_text)) AS page_most_text,
    FROM
        'data/pages.parquet'
    GROUP BY
        pdf_filename,
        pdf_file_path
    HAVING
        max(page_no) = max(page_count)
    ORDER BY
        pdf_filename,
        pdf_file_path
) TO '/Volumes/crucial/huggingface/pages_page_count_validation.json' (ARRAY);

Features

The pipeline is capable of handling the end-to-end processing of any patent document published by USPTO or EPO respectively. The pipeline is capable of processing any patent document in PDF format, and it generates the same outputs for every patent document.

  • Handles any PDF, regardless of whether there is embedded text or not.

  • Full text search is always supported. Every page is converted from the first to the last.

  • Deduplication happens automatically. No input selection/deduplication required by the client.

  • Identity is separated from filename/size/path/extension/case/etc.

  • Outputs don't depend on publication year of the patent document.

  • PDF metadata Extraction included.

  • USPTO and EPO publications use a single table schema.

  • Text from the conversion remains anchored to the page number it was extracted from.

  • Patent Columnarization is included. The pipeline can handle any patent document, regardless of whether it is a single column or multi-column layout.

  • Every run syncronizes the filesystem outputs at the end.

  • The Enterprise ClickHouse table is client owned.

  • The ClickHouse table is updated automatically at the end of each run.

One Page Per Row, With Complete Document Context

The pages table is deliberately denormalized: each row represents one patent page, while document-level values such as hash, pdf_filename, pdf_file_path, page_count, metadata, and artifact paths are repeated on every row for that document. The included search-result JSON outputs make this visible: each array item is one selected page row, and document-level values repeat across items belonging to the same patent. A text-search query can therefore select page-level evidence and complete source-document context from the same row without requiring the client to reconstruct the result through joins.

Read how the denormalized pages table is constructed and why

Languages

Language Supported Used By Jurisdiction
English True EPO + USPTO
German True EPO
French True EPO

Required Inputs

At the beginning of a run, the pipeline scans the ingest directory for PDF files to process.

  • PDF files or Bulk Data Download archives (.tar|.zip) are valid inputs.

Artifacts

For every USPTO/EPO published patent PDF document that the pipeline processes, the following artifacts are generated.

  • The published patent document
  • Export of all rows in the ClickHouse table pages to a Parquet file.
  • Export of all rows in the ClickHouse table pages to a CSV file.
  • A unique README.md that explains how to use the included files completely without database access and much more.
  • manifest.json file that lists all files generated by the pipeline for this run.
  • pages/ directory that contains all pages of the published patent document as individual PDF files.

Quality

USPTO patent PDFs have a reputation of being one of the most difficult to convert/parse at scale. Factors include:

  • There is no embedded text on any of the PDF pages.
  • The layout is hostile for layout detection:
    • Two column layout
    • Form fields
    • Figures in landscape/portrait orientation
    • Changing vertical span of page level headers/footers on the Y-Axis.

Statistics

ECDF Plot Of Character Count

The first page of a patent is important, and we understand that.

The plot above highlights that the pipeline handles image based PDF patent files reliably. The plot uses the generated text for each of the 8491 files processed in this run.

SELECT
    len(page_text) AS character_count,
    page_no
FROM
    pages
WHERE
    page_no = 1;

ECDF Plot Of Page Count

SELECT
    MIN(page_count) OVER (
        PARTITION BY
            hash
    ) AS page_count
FROM
    pages;

Column page_count is a document level column, and thus gets broadcasted across all page level rows for each document.

Learn more about how we use denormalized tables in the pipeline outputs: Denormalized Table Structure

Document-specific ClickHouse Query

This global README describes the corpus-wide structure. Each of the 8491 generated document-specific README.md files includes the same ClickHouse query pattern, with param_hash set to the content hash of that published patent document. The following example is taken from one of those document-specific README.md files and retrieves all pages of that document from the enterprise pages table.

SET param_hash = '0324120e53092d85720e80404441942df539385862f6d91cbdbe34a001d67bdb';
SELECT
    *
FROM pages
WHERE hash = {hash: String}
ORDER BY pdf_filename, page_no;

Portable Corpus Directory Structure

All 8491 processed patent documents use the same directory and file naming pattern. The 100-document sample under client/patent_corpus showcases that exact structure; it is not a separate or fallback layout.

The paths stored in the pages table are relative to $CLIENT_PATENT_CORPUS_ROOT_DIRECTORY. Each office or environment can set that variable to its own local, network, or mounted storage location without changing any stored path or generated artifact:

$CLIENT_PATENT_CORPUS_ROOT_DIRECTORY/
└── <document-hash>/
    β”œβ”€β”€ <stem>.csv
    β”œβ”€β”€ <stem>.parquet
    β”œβ”€β”€ <stem>.pdf
    β”œβ”€β”€ README.md
    β”œβ”€β”€ manifest.json
    └── pages/
        β”œβ”€β”€ <stem>_page_1.pdf
        β”œβ”€β”€ <stem>_page_2.pdf
        └── <stem>_page_<page-number>.pdf
  • <document-hash>/ is the document-specific directory prefix shared by every artifact path for that document.
  • <stem> is the source PDF filename without its extension. For example, the stem of D1075061.pdf is D1075061.
  • .pdf, .csv, and .parquet are the artifact filename suffixes applied to the same stem.
  • _page_<page-number>.pdf is the page filename suffix applied to the same stem under the fixed pages/ directory.
  • README.md and manifest.json are fixed filenames generated once per document.

The complete corpus can therefore be mounted anywhere by defining $CLIENT_PATENT_CORPUS_ROOT_DIRECTORY. At the end of a run, the outputs are synchronized beneath that environment-specific root while every relative path remains unchanged.

The following concrete path is retained to show the repository-relative form used by the synchronized sample:

9c60cfe9eca2e071407880455016b72e244825828d3ee19ee40f7a72e3e8e171
# (1) Repository-relative document directory
directory = 'client/patent_corpus/9c60cfe9eca2e071407880455016b72e244825828d3ee19ee40f7a72e3e8e171'
# (2) The same path expressed as ordered path segments, using '/' as separator
path_segments = ['client','patent_corpus','9c60cfe9eca2e071407880455016b72e244825828d3ee19ee40f7a72e3e8e171']
  • (1) shows the complete repository-relative path of one document directory.
  • (2) shows the storage prefix (client/patent_corpus) and the document-hash directory as separate path segments. When the corpus is mounted elsewhere, the environment-specific root replaces the repository storage prefix; the document hash becomes the first relative path segment, and every artifact path below it remains the same.

The directory contains the following concrete artifacts. Here, D1075061 is the shared filename stem:

.
β”œβ”€β”€ D1075061.csv
β”œβ”€β”€ D1075061.parquet
β”œβ”€β”€ D1075061.pdf
β”œβ”€β”€ README.md
β”œβ”€β”€ manifest.json
└── pages
    β”œβ”€β”€ D1075061_page_1.pdf
    β”œβ”€β”€ D1075061_page_2.pdf
    β”œβ”€β”€ D1075061_page_3.pdf
    β”œβ”€β”€ D1075061_page_4.pdf
    β”œβ”€β”€ D1075061_page_5.pdf
    β”œβ”€β”€ D1075061_page_6.pdf
    β”œβ”€β”€ D1075061_page_7.pdf
    └── D1075061_page_8.pdf

Further Reading

One Corpus. Any Storage Location. Zero Ambiguity.

Storage location remains flexible, while content identity remains exact. Paths tell the system where a file is available; hashes establish what the file is. This allows one client-owned corpus to move across offices, mount points, and storage systems without changing its internal structure or creating identity ambiguity.

Read the complete article

More From This Demonstration

Transparency

The complete ~280k output files generated by this run are available upon request. Due to huggingface preview limitations triggered by the complete outputs, we are unable to include the full output.

We believe in non-fabricated demos without pre-selected/non-average using data.

Random Sample Generation Script Used

Files Featured In The Repository

All JSON outputs included in the repository were generated by one of the uploaded script/sql-query files.

search_case_insensitive.sql

PREPARE search_case_insensitive AS COPY (
SELECT
    regexp_extract_all(page_text, '(.{0,100})\b(' || $search_term || ')\b(.{0,100})',['pre_match','match','post_match'],'i') AS matches,
    hash,
    pdf_filename,
    page_no,
    page_count,
    title,
    creation_date_dt,
    page_text,
    $search_term::VARCHAR AS search_query,
    'i'::VARCHAR AS options
FROM 'data/pages.parquet'
WHERE regexp_matches(page_text, '(?i)\b(' || $search_term || ')\b')
ORDER BY matches DESC, hash, pdf_filename, page_no
) TO $file (ARRAY);

EXECUTE search_case_insensitive(file := 'boeing_matches.json',search_term := 'Boeing');
EXECUTE search_case_insensitive(file := 'samsung_matches.json',search_term := 'Samsung');
EXECUTE search_case_insensitive(file := 'apple_matches.json',search_term := 'Apple');
EXECUTE search_case_insensitive(file := 'applicant_matches.json',search_term := 'Applicant: ');

File path script: search_case_insensitive.sql

Outputs from this script: apple_matches.json

boeing_matches.json

samsung_matches.json

applicant_matches.json

search_figures.sql

PREPARE search_figures AS COPY (
SELECT
    regexp_extract_all(page_text, '(.{0,100})\b(' || $search_term || ')\b(.{0,100})',['pre_match','match','post_match'],'i') AS matches,
    regexp_extract_all(page_text, '(?i)\b(' || $company_filter || ')\b',['company_match']),
    array_length(regexp_extract_all(page_text, '(?i)\b(' || $company_filter || ')\b',['company_match'])) AS company_match_count,
    hash,
    pdf_filename,
    page_no,
    page_count,
    title,
    creation_date_dt,
    page_text,
    $search_term::VARCHAR AS search_query,
    'i'::VARCHAR AS options
FROM 'data/pages.parquet'
WHERE regexp_matches(page_text, '(?i)\b(' || $search_term || ')\b') AND regexp_matches(page_text,'(?i)\b(' || $company_filter || ')\b')
ORDER BY matches DESC, hash, pdf_filename, page_no
) TO $file WITH DELIMITER '\t' CSV HEADER;

EXECUTE search_figures(file := 'nvidia_figures_matched.tsv',search_term := 'Fig\.\s\d+', company_filter := 'nvidia');
EXECUTE search_figures(file := 'bmw_figures_matched.tsv',search_term := 'Fig\.\s\d+', company_filter := 'bmw');
EXECUTE search_figures(file := 'tesla_figures_matched.tsv',search_term := 'Fig\.\s\d+', company_filter := 'tesla');
EXECUTE search_figures(file := 'siemens_figures_matched.tsv',search_term := 'Fig\.\s\d+', company_filter := 'siemens');

File path script: sql_queries/search_figures.sql

Outputs from this script: nvidia_figures_matched.json

bmw_figures_matched.json

tesla_figures_matched.json

siemens_figures_matched.json

pages_split_8491_title.sql

COPY (
    select
        title,
        page_count,
        creation_date_dt,
        page_char_count_pdf AS character_count_embedded,
        parquet_file_path,
        csv_file_path,
        size AS size_bytes,
        regexp_extract(
            title,
            '^([A-Z]{2})[0]{4,6}([RE12PP]{2}[^A-Z]+)([A-Z][0-9])(\d{4})(\d{2})(\d{2})',
            [
                'prefix',
                'patent_number',
                'patent_category',
                'year_bulk_dataset_date',
                'month_bulk_dataset_date',
                'day_bulk_dataset_date'
            ],
            'i'
        ) as split_title,
    from
        'data/pages.parquet'
    where
        page_no = 1
    order by
        title
) TO 'title_proof_all_8491_files_are_valid.json' (ARRAY);

File path script: sql_queries/pages_split_8491_title.sql

Outputs from this script: title_proof_all_8491_files_are_valid.json

Mode: FILE

This mode

  • End-to-end processing of mixed EPO/USPTO patent PDF files in a single run.

License

Copyright (c) Tobias Klein. All Rights Reserved

Legal Disclaimer

The pipeline processes patent documents published by USPTO or EPO respectively. The pipeline is not affiliated with any patent office and does not declare ownership/rights to any of the patent documents. All outputs include the published patent document itself, and every output produced is merely a view of the published patent document. All files under the pages/ directory are generated by splitting the published patent document into individual pages. The pipeline does not modify the content of the published patent document in any way. The following code snippet shows how the pipeline splits a published patent document into individual pages and copies the metadata from the original document to each page. Every page produced by this pipeline has matching metadata values for the following keys: dc:title, dc:subject, and dc:keywords. We keep the hash cryptographic hash values of every produced file. This allows us to verify which files were produced by the pipeline if necessary.

from pikepdf import Pdf
safe_to_copy = ["dc:title", "dc:subject", "dc:keywords"]
source_pdf = Pdf.open(series_single_file["pdf_file_path"])
for _i, _p in enumerate(source_pdf.pages):
    page_no = _i + 1
    target_pdf = Pdf.new()
    with (
        source_pdf.open_metadata() as src,
        target_pdf.open_metadata() as dst,
    ):
        for key in safe_to_copy:
            if key in src:
                dst[key] = src[key]
        target_pdf.pages.append(_p)
        target_pdf.save(
            filename_or_stream=os.path.join(
                series_single_file["pdf_pages_directory_path_string"],
                f"{series_single_file['stem']}_page_{page_no}.pdf",
            ),
            preserve_pdfa=True,
            deterministic_id=True,
        )

Frequently Asked Questions

Does Hugging Face Dataset Viewer search prove that a term is absent?

No. The Hugging Face Dataset Viewer /search endpoint uses DuckDB full-text search with the BM25 relevance algorithm and the English-oriented Porter stemmer. Its matching behavior is therefore not equivalent to a neutral, exhaustive literal-substring scan. Tokenization, stemming, and the search implementation can affect which rows are returned for a query. A row that is not returned by /search must not be treated as proof that the underlying page_text does not contain the term.

When exhaustive verification matters, query data/pages.parquet directly with an explicit DuckDB predicate such as exact string matching or a documented regular expression. See the Hugging Face Dataset Viewer search documentation for the /search implementation details.

Why can page_text look incomplete in a preview or query result?

Each page_text value is one string containing the extracted text for one complete patent page. A Dataset Viewer cell can show only the portion that fits the current interface or column width, and DuckDB's default tabular CLI output can shorten long values according to its display settings. This is presentation-layer truncation; it does not mean that the string stored in the Parquet file is incomplete.

The Hugging Face /search response itself is currently documented as untruncated. For direct DuckDB inspection, line mode (.mode line) is the safest human-readable option for long page strings. For structured or machine-readable results, use a complete JSON output or export. Default table output and other width-constrained formats should not be used to determine whether the full page text is present.

Downloads last month
121