|
|
--- |
|
|
language: |
|
|
- en |
|
|
license: cc0-1.0 |
|
|
task_categories: |
|
|
- text-generation |
|
|
pretty_name: Shakespeare Complete Works - Dialogue Format |
|
|
tags: |
|
|
- shakespeare |
|
|
- dialogue |
|
|
- drama |
|
|
- literature |
|
|
configs: |
|
|
- config_name: default |
|
|
data_files: |
|
|
- split: train |
|
|
path: data/train-* |
|
|
dataset_info: |
|
|
features: |
|
|
- name: text |
|
|
dtype: string |
|
|
splits: |
|
|
- name: train |
|
|
num_bytes: 1115398 |
|
|
num_examples: 1 |
|
|
download_size: 704060 |
|
|
dataset_size: 1115398 |
|
|
--- |
|
|
|
|
|
Taken from Andrej Karpathy and repurposed for UofT's CSC 413 Deep Learning |
|
|
40,000 lines of Shakespeare from a variety of Shakespeare's plays. Featured in Andrej Karpathy's blog post 'The Unreasonable Effectiveness of Recurrent Neural Networks': http://karpathy.github.io/2015/05/21/rnn-effectiveness/. |
|
|
|
|
|
|
|
|
|
|
|
## Usage |
|
|
|
|
|
To use for e.g. character modelling: |
|
|
|
|
|
```python |
|
|
from datasets import load_dataset |
|
|
|
|
|
# Load the dataset |
|
|
dataset = load_dataset("r-three/shakespeare-dialogue-blob") |
|
|
|
|
|
# Access examples |
|
|
for example in dataset['train'][:5]: |
|
|
print(f"{example['character']}: {example['text']}") |
|
|
|
|
|
# Filter by character |
|
|
hamlet_lines = dataset['train'].filter(lambda x: x['character'] == 'Hamlet') |
|
|
|
|
|
# Get character statistics |
|
|
from collections import Counter |
|
|
characters = Counter(dataset['train']['character']) |
|
|
print(f"Top 10 characters: {characters.most_common(10)}") |
|
|
``` |
|
|
|
|
|
## Source |
|
|
|
|
|
Public domain works by William Shakespeare, sourced from the Karpathy char-rnn repository. |
|
|
|
|
|
To cite: |
|
|
``` |
|
|
@misc{ |
|
|
author={Karpathy, Andrej}, |
|
|
title={char-rnn}, |
|
|
year={2015}, |
|
|
howpublished={\url{https://github.com/karpathy/char-rnn}} |
|
|
} |
|
|
``` |
|
|
|
|
|
|
|
|
## License |
|
|
|
|
|
This dataset is in the public domain (CC0-1.0) as Shakespeare's works are no longer under copyright. |
|
|
|