Update README
Browse files
README.md
CHANGED
|
@@ -506,10 +506,11 @@ For faster downloads, install `pip install huggingface_hub[hf_transfer]` and set
|
|
| 506 |
|
| 507 |
### Using DuckDB (zero download, remote query)
|
| 508 |
|
| 509 |
-
DuckDB can query the Parquet files directly from HuggingFace without downloading anything to disk:
|
|
|
|
|
|
|
| 510 |
|
| 511 |
```sql
|
| 512 |
-
-- Find all editions of "Fantastic Mr Fox" by Roald Dahl
|
| 513 |
SELECT e.key, e.title, e.isbn_13, e.publishers, e.publish_date
|
| 514 |
FROM read_parquet('hf://datasets/open-index/open-library/data/editions/*.parquet') e
|
| 515 |
WHERE e.work_keys LIKE '%OL45804W%'
|
|
@@ -517,17 +518,14 @@ ORDER BY e.publish_date
|
|
| 517 |
LIMIT 20;
|
| 518 |
```
|
| 519 |
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
└──────────────┴─────────────────────┴────────────────────────┴─────────────────┴──────────────┘
|
| 527 |
-
```
|
| 528 |
|
| 529 |
```sql
|
| 530 |
-
-- Top-rated works (minimum 100 ratings)
|
| 531 |
SELECT work_key,
|
| 532 |
ROUND(avg(rating), 2) AS avg_rating,
|
| 533 |
count(*) AS num_ratings
|
|
@@ -538,20 +536,17 @@ ORDER BY avg_rating DESC
|
|
| 538 |
LIMIT 5;
|
| 539 |
```
|
| 540 |
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
└─────────────────────┴────────────┴─────────────┘
|
| 551 |
-
```
|
| 552 |
|
| 553 |
```sql
|
| 554 |
-
-- Join authors with their works to find prolific writers
|
| 555 |
SELECT a.name,
|
| 556 |
count(*) AS num_works
|
| 557 |
FROM read_parquet('hf://datasets/open-index/open-library/data/works/*.parquet') w,
|
|
@@ -562,38 +557,32 @@ ORDER BY num_works DESC
|
|
| 562 |
LIMIT 5;
|
| 563 |
```
|
| 564 |
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
└───────────────────────────┴───────────┘
|
| 575 |
-
```
|
| 576 |
|
| 577 |
```sql
|
| 578 |
-
-- Authors with Wikidata links
|
| 579 |
SELECT key, name, wikidata_id, birth_date, death_date
|
| 580 |
FROM read_parquet('hf://datasets/open-index/open-library/data/authors/*.parquet')
|
| 581 |
WHERE wikidata_id IS NOT NULL
|
| 582 |
LIMIT 5;
|
| 583 |
```
|
| 584 |
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
└─────────────────────┴─────────────────┴─────────────┴───────────────────────┴───────────────────────┘
|
| 593 |
-
```
|
| 594 |
|
| 595 |
```sql
|
| 596 |
-
-- Reading trends: most want-to-read works
|
| 597 |
SELECT work_key, count(*) AS readers
|
| 598 |
FROM read_parquet('hf://datasets/open-index/open-library/data/reading-log/*.parquet')
|
| 599 |
WHERE shelf = 'want-to-read'
|
|
@@ -602,17 +591,13 @@ ORDER BY readers DESC
|
|
| 602 |
LIMIT 5;
|
| 603 |
```
|
| 604 |
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
│ /works/OL15413843W │ 5987 │
|
| 613 |
-
│ /works/OL362427W │ 5412 │
|
| 614 |
-
└─────────────────────┴─────────┘
|
| 615 |
-
```
|
| 616 |
|
| 617 |
### Using the raw dumps
|
| 618 |
|
|
@@ -842,10 +827,11 @@ Every field is extracted from the source data exactly as provided by OpenLibrary
|
|
| 842 |
|
| 843 |
Most author records are auto-imported stubs from library catalogs (just a name and key), so optional fields like `bio` and `birth_date` appear in a small fraction of records. Editions are the richest config, with strong coverage of ISBNs, publishers, languages, and page counts. Works sit in the middle, with nearly all having author links and about half having subject headings.
|
| 844 |
|
| 845 |
-
You can verify these numbers yourself with
|
|
|
|
|
|
|
| 846 |
|
| 847 |
```sql
|
| 848 |
-
-- Field population rates for authors
|
| 849 |
SELECT COUNT(*) AS total,
|
| 850 |
COUNT(bio) AS has_bio,
|
| 851 |
ROUND(COUNT(bio) * 100.0 / COUNT(*), 1) AS bio_pct,
|
|
@@ -858,16 +844,13 @@ SELECT COUNT(*) AS total,
|
|
| 858 |
FROM read_parquet('hf://datasets/open-index/open-library/data/authors/*.parquet');
|
| 859 |
```
|
| 860 |
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
└──────────┴─────────┴─────────┴───────────┴───────────┴──────────────┴──────────────┴────────────────┴────────────┘
|
| 867 |
-
```
|
| 868 |
|
| 869 |
```sql
|
| 870 |
-
-- Field population rates for works
|
| 871 |
SELECT COUNT(*) AS total,
|
| 872 |
COUNT(author_keys) AS has_authors,
|
| 873 |
ROUND(COUNT(author_keys) * 100.0 / COUNT(*), 1) AS authors_pct,
|
|
@@ -880,16 +863,13 @@ SELECT COUNT(*) AS total,
|
|
| 880 |
FROM read_parquet('hf://datasets/open-index/open-library/data/works/*.parquet');
|
| 881 |
```
|
| 882 |
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
└──────────┴─────────────┴─────────────┴──────────────┴──────────────┴──────────┴──────────┴────────────┴────────────┘
|
| 889 |
-
```
|
| 890 |
|
| 891 |
```sql
|
| 892 |
-
-- Field population rates for editions
|
| 893 |
SELECT COUNT(*) AS total,
|
| 894 |
COUNT(isbn_13) AS has_isbn13,
|
| 895 |
ROUND(COUNT(isbn_13) * 100.0 / COUNT(*), 1) AS isbn13_pct,
|
|
@@ -902,13 +882,9 @@ SELECT COUNT(*) AS total,
|
|
| 902 |
FROM read_parquet('hf://datasets/open-index/open-library/data/editions/*.parquet');
|
| 903 |
```
|
| 904 |
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
├──────────┼────────────┼────────────┼──────────┼─────────┼──────────┼──────────┼───────────┼───────────┤
|
| 909 |
-
│ 55615769 │ 29558726 │ 53.1 │ 52626364 │ 94.6 │ 48137077 │ 86.6 │ 34802286 │ 62.6 │
|
| 910 |
-
└──────────┴────────────┴────────────┴──────────┴─────────┴──────────┴──────────┴───────────┴───────────┘
|
| 911 |
-
```
|
| 912 |
|
| 913 |
## Dataset Creation
|
| 914 |
|
|
|
|
| 506 |
|
| 507 |
### Using DuckDB (zero download, remote query)
|
| 508 |
|
| 509 |
+
DuckDB can query the Parquet files directly from HuggingFace without downloading anything to disk. Here are some queries to get you started:
|
| 510 |
+
|
| 511 |
+
**Find all editions of a specific work.** Let's look up every printing of Roald Dahl's "Fantastic Mr Fox":
|
| 512 |
|
| 513 |
```sql
|
|
|
|
| 514 |
SELECT e.key, e.title, e.isbn_13, e.publishers, e.publish_date
|
| 515 |
FROM read_parquet('hf://datasets/open-index/open-library/data/editions/*.parquet') e
|
| 516 |
WHERE e.work_keys LIKE '%OL45804W%'
|
|
|
|
| 518 |
LIMIT 20;
|
| 519 |
```
|
| 520 |
|
| 521 |
+
| key | title | isbn_13 | publishers | publish_date |
|
| 522 |
+
|-----|-------|---------|------------|--------------|
|
| 523 |
+
| /books/OL1M | Fantastic Mr Fox | ["9780140328721"] | ["Puffin"] | Oct 1, 1988 |
|
| 524 |
+
| /books/OL2M | Fantastic Mr. Fox | ["9780375822063"] | ["Knopf"] | 2002 |
|
| 525 |
+
|
| 526 |
+
**Discover the highest-rated books.** This query finds works with at least 100 ratings, sorted by average score:
|
|
|
|
|
|
|
| 527 |
|
| 528 |
```sql
|
|
|
|
| 529 |
SELECT work_key,
|
| 530 |
ROUND(avg(rating), 2) AS avg_rating,
|
| 531 |
count(*) AS num_ratings
|
|
|
|
| 536 |
LIMIT 5;
|
| 537 |
```
|
| 538 |
|
| 539 |
+
| work_key | avg_rating | num_ratings |
|
| 540 |
+
|----------|----------:|------------:|
|
| 541 |
+
| /works/OL82563W | 4.72 | 142 |
|
| 542 |
+
| /works/OL17860744W | 4.68 | 109 |
|
| 543 |
+
| /works/OL5735363W | 4.65 | 287 |
|
| 544 |
+
| /works/OL362427W | 4.63 | 516 |
|
| 545 |
+
| /works/OL15413843W | 4.62 | 153 |
|
| 546 |
+
|
| 547 |
+
**Find the most prolific writers.** Join authors with works to see who has the most entries in the catalog:
|
|
|
|
|
|
|
| 548 |
|
| 549 |
```sql
|
|
|
|
| 550 |
SELECT a.name,
|
| 551 |
count(*) AS num_works
|
| 552 |
FROM read_parquet('hf://datasets/open-index/open-library/data/works/*.parquet') w,
|
|
|
|
| 557 |
LIMIT 5;
|
| 558 |
```
|
| 559 |
|
| 560 |
+
| name | num_works |
|
| 561 |
+
|------|----------:|
|
| 562 |
+
| United States | 60,657 |
|
| 563 |
+
| Anonymous | 33,671 |
|
| 564 |
+
| William Shakespeare | 11,210 |
|
| 565 |
+
| Various | 8,435 |
|
| 566 |
+
| Charles Dickens | 8,206 |
|
| 567 |
+
|
| 568 |
+
**Explore Wikidata cross-references.** Over 177K authors are linked to Wikidata, making it easy to enrich records with external knowledge:
|
|
|
|
|
|
|
| 569 |
|
| 570 |
```sql
|
|
|
|
| 571 |
SELECT key, name, wikidata_id, birth_date, death_date
|
| 572 |
FROM read_parquet('hf://datasets/open-index/open-library/data/authors/*.parquet')
|
| 573 |
WHERE wikidata_id IS NOT NULL
|
| 574 |
LIMIT 5;
|
| 575 |
```
|
| 576 |
|
| 577 |
+
| key | name | wikidata_id | birth_date | death_date |
|
| 578 |
+
|-----|------|-------------|------------|------------|
|
| 579 |
+
| /authors/OL34184A | Roald Dahl | Q25161 | 13 September 1916 | 23 November 1990 |
|
| 580 |
+
| /authors/OL23919A | J.K. Rowling | Q34660 | 31 July 1965 | |
|
| 581 |
+
| /authors/OL2162284A | Stephen King | Q39829 | September 21, 1947 | |
|
| 582 |
+
|
| 583 |
+
**See what people want to read.** The reading log captures millions of shelf actions from Open Library users:
|
|
|
|
|
|
|
| 584 |
|
| 585 |
```sql
|
|
|
|
| 586 |
SELECT work_key, count(*) AS readers
|
| 587 |
FROM read_parquet('hf://datasets/open-index/open-library/data/reading-log/*.parquet')
|
| 588 |
WHERE shelf = 'want-to-read'
|
|
|
|
| 591 |
LIMIT 5;
|
| 592 |
```
|
| 593 |
|
| 594 |
+
| work_key | readers |
|
| 595 |
+
|----------|--------:|
|
| 596 |
+
| /works/OL45804W | 8,432 |
|
| 597 |
+
| /works/OL82563W | 7,891 |
|
| 598 |
+
| /works/OL468516W | 6,234 |
|
| 599 |
+
| /works/OL15413843W | 5,987 |
|
| 600 |
+
| /works/OL362427W | 5,412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
### Using the raw dumps
|
| 603 |
|
|
|
|
| 827 |
|
| 828 |
Most author records are auto-imported stubs from library catalogs (just a name and key), so optional fields like `bio` and `birth_date` appear in a small fraction of records. Editions are the richest config, with strong coverage of ISBNs, publishers, languages, and page counts. Works sit in the middle, with nearly all having author links and about half having subject headings.
|
| 829 |
|
| 830 |
+
You can verify these numbers yourself with DuckDB. Here are the queries and results for the three core configs:
|
| 831 |
+
|
| 832 |
+
**Authors** (15.1M records): most are auto-imported stubs, so rich fields like `bio` are rare, but 1.9M have birth dates and 177K link to Wikidata.
|
| 833 |
|
| 834 |
```sql
|
|
|
|
| 835 |
SELECT COUNT(*) AS total,
|
| 836 |
COUNT(bio) AS has_bio,
|
| 837 |
ROUND(COUNT(bio) * 100.0 / COUNT(*), 1) AS bio_pct,
|
|
|
|
| 844 |
FROM read_parquet('hf://datasets/open-index/open-library/data/authors/*.parquet');
|
| 845 |
```
|
| 846 |
|
| 847 |
+
| total | has_bio | bio_pct | has_birth | birth_pct | has_wikidata | wikidata_pct | has_remote_ids | remote_pct |
|
| 848 |
+
|------:|--------:|--------:|----------:|----------:|-------------:|-------------:|---------------:|-----------:|
|
| 849 |
+
| 15,071,242 | 43,822 | 0.3% | 1,935,260 | 12.8% | 177,233 | 1.2% | 273,801 | 1.8% |
|
| 850 |
+
|
| 851 |
+
**Works** (40.7M records): nearly all have author links and about half have subject headings, making this config great for topic-based exploration.
|
|
|
|
|
|
|
| 852 |
|
| 853 |
```sql
|
|
|
|
| 854 |
SELECT COUNT(*) AS total,
|
| 855 |
COUNT(author_keys) AS has_authors,
|
| 856 |
ROUND(COUNT(author_keys) * 100.0 / COUNT(*), 1) AS authors_pct,
|
|
|
|
| 863 |
FROM read_parquet('hf://datasets/open-index/open-library/data/works/*.parquet');
|
| 864 |
```
|
| 865 |
|
| 866 |
+
| total | has_authors | authors_pct | has_subjects | subjects_pct | has_desc | desc_pct | has_covers | covers_pct |
|
| 867 |
+
|------:|------------:|------------:|-------------:|-------------:|---------:|---------:|-----------:|-----------:|
|
| 868 |
+
| 40,718,247 | 38,478,663 | 94.5% | 20,024,694 | 49.2% | 1,828,315 | 4.5% | 9,645,694 | 23.7% |
|
| 869 |
+
|
| 870 |
+
**Editions** (55.6M records): the richest config by far, with strong coverage of publishers (94.6%), languages (86.6%), and page counts (62.6%). Over half have ISBN-13 numbers.
|
|
|
|
|
|
|
| 871 |
|
| 872 |
```sql
|
|
|
|
| 873 |
SELECT COUNT(*) AS total,
|
| 874 |
COUNT(isbn_13) AS has_isbn13,
|
| 875 |
ROUND(COUNT(isbn_13) * 100.0 / COUNT(*), 1) AS isbn13_pct,
|
|
|
|
| 882 |
FROM read_parquet('hf://datasets/open-index/open-library/data/editions/*.parquet');
|
| 883 |
```
|
| 884 |
|
| 885 |
+
| total | has_isbn13 | isbn13_pct | has_pub | pub_pct | has_lang | lang_pct | has_pages | pages_pct |
|
| 886 |
+
|------:|-----------:|-----------:|--------:|--------:|---------:|---------:|----------:|----------:|
|
| 887 |
+
| 55,615,769 | 29,558,726 | 53.1% | 52,626,364 | 94.6% | 48,137,077 | 86.6% | 34,802,286 | 62.6% |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 888 |
|
| 889 |
## Dataset Creation
|
| 890 |
|