Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
36
36
title
stringlengths
1
237
author
stringlengths
0
80
language
stringclasses
291 values
release_date
stringlengths
9
77
text_length_chars
int64
180
148M
cleaned_text_length
int64
77
148M
text
stringlengths
77
148M
9365f16c-7bec-49c5-95ac-39c218886895
null
taking several
en
null
4,514,197
4,514,102
"The King James Bible\n\n\nNotes from the previous editions:\n\nThis is a modified version of: The P(...TRUNCATED)
11983d38-395e-4dd4-b9c9-522a1cf660c8
null
H. G. Wells
en
null
337,521
337,423
"/\n\n\nThe War of the Worlds\n\nby H. G. Wells\n\n\n\n\n ‘But who shall dwell in these worlds i(...TRUNCATED)
09a67821-7a62-4dae-a47e-274737d3289d
The Scarlet Letter
Nathaniel Hawthorne
english
February, 1992 [eBook #33]
499,522
480,298
"The Scarlet Letter\n\nby Nathaniel Hawthorne\n\n\nContents\n\n THE CUSTOM-HOUSE\n THE SCARLET LETTE(...TRUNCATED)
5d2ee3f8-fa0a-41fb-8f18-9eaf496409fb
The Oedipus Trilogy
Sophocles
english
October 21, 2000 [eBook #31]
234,008
214,753
"The Oedipus Trilogy\n\nby Sophocles\n\n\nContents\n\n OEDIPUS THE KING\n OEDIPUS AT COLONUS\n ANTIG(...TRUNCATED)
7b7bc7ea-e68f-45b2-afb4-3a3e0f17d7cf
null
Charlotte Perkins Stetson Gilman
en
null
296,996
296,895
"HERLAND\n\nby Charlotte Perkins Stetson Gilman\n\n\n\n\nCHAPTER 1.\nA Not Unnatural Enterprise\n\n\(...TRUNCATED)
42ed9b55-6258-4c48-8807-467c4f704f4f
null
H. G. Wells
en
null
179,791
179,690
"The Time Machine\n\nAn Invention\n\nby H. G. Wells\n\n\nCONTENTS\n\n I Introduction\n II The Machin(...TRUNCATED)
07815f05-088c-49b6-99e5-1bdb18b8f361
Old Indian Legends
Zitkala-Sa
english
July 5, 2008 [EBook #338]
118,191
98,871
"Produced by Judith Boss\n\n\n\n\n\nOLD INDIAN LEGENDS\n\nRetold By Zitkala-Sa\n\n\n\n\nITKALA-SA.\n(...TRUNCATED)
ef26bb82-e91f-4913-89b7-fe288c6a3875
Old Indian Days
[AKA Ohiyesa], Charles A. Eastman
english
July 5, 2008 [EBook #339]
288,627
269,263
"Produced by Judith Boss\n\n\n\n\n\nOLD INDIAN DAYS\n\nBy Charles A. Eastman\n\n(Ohiyesa)\n\n\n\n\n\(...TRUNCATED)
34c25fb9-4075-4f77-ad30-fcdd41a08e02
The Mucker
Edgar Rice Burroughs
english
September, 1995
697,584
678,236
"Produced by Judith Boss\n\n\n\n\n\nTHE MUCKER\n\nBy Edgar Rice Burroughs\n\n\n\nTHE MUCKER: Origina(...TRUNCATED)
7872a7f5-6346-45bf-ad4a-4fd9d111ca01
Indian Boyhood
[AKA Ohiyesa], Charles A. Eastman
english
July 5, 2008 [EBook #337]
319,018
299,659
"Produced by Judith Boss\n\n\n\n\n\nINDIAN BOYHOOD\n\nBy [Ohiyesa] Charles A. Eastman\n\n\n\n\nConte(...TRUNCATED)
End of preview. Expand in Data Studio

Overview

Property Value
Source Project Gutenberg (English catalog)
Snapshot 2026-06-04
Total files ~50,648
Total Tokens (BPE) 2.3B
Total directories ~86,315
Primary format Plain text (.txt)
Bulk format Parquet, JSONL

Repository Structure

.
├── app.py                                      # Application entry point
├── main.py                                     # Main pipeline / processing script
├── d.py                                        # Utility / downloader script
│
├── pg_dataset/
│   ├── pg_dataset.jsonl                        # Full dataset in newline-delimited JSON
│   └── pg_manifest.json                        # Manifest: metadata index for all entries
│
├── project-gutenberg-en_2026-06-04.parquet     # Columnar bulk export (Apache Parquet)
│
└── <N>/                                        # Sharded text files by Gutenberg ID
    └── <NN>/
        └── <NNN>/
            └── <book_id>/
                └── <book_id>-0.txt             # Raw plain-text file for each book

Sharding Scheme

Individual book files are stored under a hierarchical directory tree derived from their numeric Gutenberg ID. This prevents any single directory from holding an unmanageable number of entries and ensures fast filesystem lookups.

For example, book 9320 is stored at:

9/3/2/9320/9320-0.txt

Each leaf directory corresponds to one book. The -0 suffix in the filename follows the standard Project Gutenberg naming convention for the primary (unformatted) text edition.


Data Formats

Plain Text (<book_id>-0.txt)

Raw UTF-8 plain-text files as distributed by Project Gutenberg. Each file includes the Project Gutenberg header and license footer. Strip these as needed using standard markers:

*** START OF THE PROJECT GUTENBERG EBOOK ... ***
*** END OF THE PROJECT GUTENBERG EBOOK ... ***

JSONL (pg_dataset/pg_dataset.jsonl)

One JSON object per line. Each record contains the book text alongside metadata fields. Suitable for streaming ingestion into data pipelines.

{"id": 1342, "title": "...", "author": "...", "language": "en", "text": "..."}

Parquet (project-gutenberg-en_2026-06-04.parquet)

A single Apache Parquet file containing the full English corpus in columnar format. Optimized for analytics and ML training workflows with tools such as pandas, Polars, DuckDB, and PyArrow.

import pandas as pd

df = pd.read_parquet("project-gutenberg-en_2026-06-04.parquet")
print(df.head())

Manifest (pg_dataset/pg_manifest.json)

A JSON index mapping Gutenberg IDs to file paths and metadata. Use this to resolve a book ID to its location on disk without a filesystem scan.


Getting Started

Requirements

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Reading a single book

book_id = 1342  # Pride and Prejudice

path = f"{str(book_id)[0]}/{'/'.join(str(book_id)[1:-1])}/{book_id}/{book_id}-0.txt"
with open(path, encoding="utf-8") as f:
    text = f.read()

Loading the full corpus via Parquet

import pandas as pd

df = pd.read_parquet("project-gutenberg-en_2026-06-04.parquet")
print(f"Loaded {len(df):,} books")
print(df.columns.tolist())

Streaming from JSONL

import json

with open("pg_dataset/pg_dataset.jsonl", encoding="utf-8") as f:
    for line in f:
        record = json.loads(line)
        # process record

Using the manifest

import json

with open("pg_dataset/pg_manifest.json", encoding="utf-8") as f:
    manifest = json.load(f)

entry = manifest["1342"]
print(entry)  # {"path": "1/3/4/1342/1342-0.txt", "title": "...", ...}

Scripts

File Purpose
app.py Application / serving layer for the dataset
main.py Main data processing and build pipeline
d.py Downloader / sync utility for fetching or updating texts from Project Gutenberg mirrors

Run the main pipeline:

python main.py

License

The code in this repository is released under the MIT License.

The texts are sourced from Project Gutenberg and are in the public domain in the United States. Books may be subject to copyright restrictions in other jurisdictions. Consult the Project Gutenberg license terms and the header of each individual file before redistribution.

Project Gutenberg is a trademark of the Project Gutenberg Literary Archive Foundation. All usage must comply with the Project Gutenberg License.


Acknowledgements

Downloads last month
134