WebBooks / README.md
Raziel1234's picture
Update README.md
c64cf12 verified
metadata
license: mit
task_categories:
  - text-generation
language:
  - en
tags:
  - biology
size_categories:
  - 10K<n<100K

Books Corpus Dataset

Overview

This dataset is a large collection of text lines extracted from free books available on Project Gutenberg. The dataset is primarily composed of literary texts, including classical literature and science fiction. It is designed for training custom language models focused on book-style text generation.


Dataset Structure

  • Directory: data/
  • Main corpus file: books.txt
    • Contains one sentence or paragraph per line.
  • Checkpoint file: corpus_checkpoint.txt
    • Keeps track of the last downloaded line to resume interrupted downloads.

Each line in the corpus represents a cleaned sentence or paragraph extracted from the HTML of Project Gutenberg books.


Features

  • Large-scale collection with tens of thousands of lines.
  • Focus on literary texts, including:
    • Science fiction
    • Classical literature
    • Popular public-domain books
  • Cleaned text:
    • Removes HTML tags, ads, and metadata
    • Splits paragraphs into sentences
    • Keeps lines with meaningful length (>30 characters)

Usage

  1. Clone or download the dataset directory.
  2. Load the dataset in Python:
with open("data/books.txt", "r", encoding="utf-8") as f:
    texts = [line.strip() for line in f if line.strip()]
print(f"Total lines in corpus: {len(texts)}")