--- language: - en license: cc0-1.0 task_categories: - text-generation pretty_name: Shakespeare Complete Works - Dialogue Format tags: - shakespeare - dialogue - drama - literature --- 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") # Access examples for example in dataset['train'][:5]: print(f"{example['character']}: {example['text']}") print(f"From: {example['work']}\n") # Filter by play hamlet = dataset['train'].filter(lambda x: 'HAMLET' in x['work']) # 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.