jeremyrmanning commited on
Commit
c2b5d7d
·
verified ·
1 Parent(s): eaf5c4b

Upload fitzgerald complete works corpus

Browse files
4368.txt ADDED
The diff for this file is too large to render. See raw diff
 
64317.txt ADDED
The diff for this file is too large to render. See raw diff
 
6695.txt ADDED
The diff for this file is too large to render. See raw diff
 
68229.txt ADDED
The diff for this file is too large to render. See raw diff
 
805.txt ADDED
The diff for this file is too large to render. See raw diff
 
9830.txt ADDED
The diff for this file is too large to render. See raw diff
 
README.md ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ task_categories:
5
+ - text-generation
6
+ tags:
7
+ - stylometry
8
+ - authorship-attribution
9
+ - literary-analysis
10
+ - fitzgerald
11
+ - classic-literature
12
+ - project-gutenberg
13
+ size_categories:
14
+ - n<1K
15
+ pretty_name: F. Scott Fitzgerald Complete Works
16
+ ---
17
+
18
+ # F. Scott Fitzgerald Complete Works Corpus
19
+
20
+ <div style="text-align: center;">
21
+ <img src="https://cdn-avatars.huggingface.co/v1/production/uploads/1654865912089-62a33fd71424f432574c348b.png" alt="ContextLab" width="100"/>
22
+ </div>
23
+
24
+ ## Dataset Description
25
+
26
+ This dataset contains the complete works of **F. Scott Fitzgerald** (1896-1940), preprocessed for computational stylometry research. The texts were sourced from [Project Gutenberg](https://www.gutenberg.org/) and cleaned for use in the paper ["A Stylometric Application of Large Language Models"](https://github.com/ContextLab/llm-stylometry) (Stropkay et al., 2025).
27
+
28
+ The corpus includes **8 books** by F. Scott Fitzgerald, including The Great Gatsby, Tender Is the Night, This Side of Paradise. All text has been converted to **lowercase** and cleaned of Project Gutenberg headers, footers, and chapter headings to focus on the author's prose style.
29
+
30
+ ### Quick Stats
31
+
32
+ - **Books:** 8
33
+ - **Total characters:** 3,363,535
34
+ - **Total words:** 592,393 (approximate)
35
+ - **Average book length:** 420,441 characters
36
+ - **Format:** Plain text (.txt files)
37
+ - **Language:** English (lowercase)
38
+
39
+ ## Dataset Structure
40
+
41
+ ### Books Included
42
+
43
+ Each `.txt` file contains the complete text of one book:
44
+
45
+ | File | Title |
46
+ |------|-------|
47
+ | `4368.txt` | Flappers and Philosophers |
48
+ | `64317.txt` | The Great Gatsby |
49
+ | `6695.txt` | Tales of the Jazz Age |
50
+ | `68229.txt` | All the Sad Young Men |
51
+ | `805.txt` | This Side of Paradise |
52
+ | `9830.txt` | The Beautiful and Damned |
53
+ | `gutenberg_net_au_ebooks03_0301261.txt` | Tender Is the Night |
54
+ | `gutenberg_net_au_fsf_PAT-HOBBY.txt` | The Pat Hobby Stories |
55
+
56
+
57
+ ### Data Fields
58
+
59
+ - **text:** Complete book text (lowercase, cleaned)
60
+ - **filename:** Project Gutenberg ID
61
+
62
+ ### Data Format
63
+
64
+ All files are plain UTF-8 text:
65
+ - Lowercase characters only
66
+ - Punctuation and structure preserved
67
+ - Paragraph breaks maintained
68
+ - No chapter headings or non-narrative text
69
+
70
+ ## Usage
71
+
72
+ ### Load with `datasets` library
73
+
74
+ ```python
75
+ from datasets import load_dataset
76
+
77
+ # Load entire corpus
78
+ corpus = load_dataset("contextlab/fitzgerald-corpus")
79
+
80
+ # Iterate through books
81
+ for book in corpus['train']:
82
+ print(f"Book length: {len(book['text']):,} characters")
83
+ print(book['text'][:200]) # First 200 characters
84
+ print()
85
+ ```
86
+
87
+ ### Load specific file
88
+
89
+ ```python
90
+ # Load single book by filename
91
+ dataset = load_dataset(
92
+ "contextlab/fitzgerald-corpus",
93
+ data_files="54.txt" # Specific Gutenberg ID
94
+ )
95
+
96
+ text = dataset['train'][0]['text']
97
+ print(f"Loaded {len(text):,} characters")
98
+ ```
99
+
100
+ ### Download files directly
101
+
102
+ ```python
103
+ from huggingface_hub import hf_hub_download
104
+
105
+ # Download one book
106
+ file_path = hf_hub_download(
107
+ repo_id="contextlab/fitzgerald-corpus",
108
+ filename="54.txt",
109
+ repo_type="dataset"
110
+ )
111
+
112
+ with open(file_path, 'r') as f:
113
+ text = f.read()
114
+ ```
115
+
116
+ ### Use for training language models
117
+
118
+ ```python
119
+ from datasets import load_dataset
120
+ from transformers import GPT2Tokenizer, GPT2LMHeadModel, Trainer, TrainingArguments
121
+
122
+ # Load corpus
123
+ corpus = load_dataset("contextlab/fitzgerald-corpus")
124
+
125
+ # Combine all books into single text
126
+ full_text = " ".join([book['text'] for book in corpus['train']])
127
+
128
+ # Tokenize
129
+ tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
130
+
131
+ def tokenize_function(examples):
132
+ return tokenizer(examples['text'], truncation=True, max_length=1024)
133
+
134
+ tokenized = corpus.map(tokenize_function, batched=True, remove_columns=['text'])
135
+
136
+ # Initialize model
137
+ model = GPT2LMHeadModel.from_pretrained("gpt2")
138
+
139
+ # Set up training
140
+ training_args = TrainingArguments(
141
+ output_dir="./results",
142
+ num_train_epochs=10,
143
+ per_device_train_batch_size=8,
144
+ save_steps=1000,
145
+ )
146
+
147
+ # Train
148
+ trainer = Trainer(
149
+ model=model,
150
+ args=training_args,
151
+ train_dataset=tokenized['train']
152
+ )
153
+
154
+ trainer.train()
155
+ ```
156
+
157
+ ### Analyze text statistics
158
+
159
+ ```python
160
+ from datasets import load_dataset
161
+ import numpy as np
162
+
163
+ corpus = load_dataset("contextlab/fitzgerald-corpus")
164
+
165
+ # Calculate statistics
166
+ lengths = [len(book['text']) for book in corpus['train']]
167
+
168
+ print(f"Books: {len(lengths)}")
169
+ print(f"Total characters: {sum(lengths):,}")
170
+ print(f"Mean length: {np.mean(lengths):,.0f} characters")
171
+ print(f"Std length: {np.std(lengths):,.0f} characters")
172
+ print(f"Min length: {min(lengths):,} characters")
173
+ print(f"Max length: {max(lengths):,} characters")
174
+ ```
175
+
176
+ ## Dataset Creation
177
+
178
+ ### Source Data
179
+
180
+ All texts sourced from [Project Gutenberg](https://www.gutenberg.org/), a library of over 70,000 free eBooks in the public domain.
181
+
182
+ **Project Gutenberg Links:**
183
+ - Books identified by Gutenberg ID numbers (filenames)
184
+ - Example: `54.txt` corresponds to https://www.gutenberg.org/ebooks/54
185
+ - All works are in the public domain
186
+
187
+ ### Preprocessing Pipeline
188
+
189
+ The raw Project Gutenberg texts underwent the following preprocessing:
190
+
191
+ 1. **Header/footer removal:** Project Gutenberg license text and metadata removed
192
+ 2. **Lowercase conversion:** All text converted to lowercase for stylometry
193
+ 3. **Chapter heading removal:** Chapter titles and numbering removed
194
+ 4. **Non-narrative text removal:** Tables of contents, dedications, etc. removed
195
+ 5. **Encoding normalization:** Converted to UTF-8
196
+ 6. **Structure preservation:** Paragraph breaks and punctuation maintained
197
+
198
+ **Why lowercase?** Stylometric analysis focuses on word choice, syntax, and style rather than capitalization patterns. Lowercase normalization removes this variable.
199
+
200
+ **Preprocessing code:** Available at https://github.com/ContextLab/llm-stylometry
201
+
202
+ ## Considerations for Using This Dataset
203
+
204
+ ### Known Limitations
205
+
206
+ - **Historical language:** Reflects Jazz Age America vocabulary, grammar, and cultural context
207
+ - **Lowercase only:** All text converted to lowercase (not suitable for case-sensitive analysis)
208
+ - **Incomplete corpus:** May not include all of F. Scott Fitzgerald's writings (only public domain works on Gutenberg)
209
+ - **Cleaning artifacts:** Some formatting irregularities may remain from Gutenberg source
210
+ - **Public domain only:** Limited to works published before copyright restrictions
211
+
212
+ ### Intended Use Cases
213
+
214
+ - **Stylometry research:** Authorship attribution, style analysis
215
+ - **Language modeling:** Training author-specific models
216
+ - **Literary analysis:** Computational study of F. Scott Fitzgerald's writing
217
+ - **Historical NLP:** Jazz Age America language patterns
218
+ - **Educational:** Teaching computational text analysis
219
+
220
+ ### Out-of-Scope Uses
221
+
222
+ - Case-sensitive text analysis
223
+ - Modern language applications
224
+ - Factual information retrieval
225
+ - Complete scholarly editions (use academic sources)
226
+
227
+ ## Citation
228
+
229
+ If you use this dataset in your research, please cite:
230
+
231
+ ```bibtex
232
+ @article{StroEtal25,
233
+ title={A Stylometric Application of Large Language Models},
234
+ author={Stropkay, Harrison F. and Chen, Jiayi and Jabelli, Mohammad J. L. and Rockmore, Daniel N. and Manning, Jeremy R.},
235
+ journal={arXiv preprint arXiv:XXXX.XXXXX},
236
+ year={2025}
237
+ }
238
+ ```
239
+
240
+ ## Additional Information
241
+
242
+ ### Dataset Curator
243
+
244
+ [ContextLab](https://www.context-lab.com/), Dartmouth College
245
+
246
+ ### Licensing
247
+
248
+ MIT License - Free to use with attribution
249
+
250
+ ### Contact
251
+
252
+ - **Paper & Code:** https://github.com/ContextLab/llm-stylometry
253
+ - **Issues:** https://github.com/ContextLab/llm-stylometry/issues
254
+ - **Contact:** Jeremy R. Manning ([email protected])
255
+
256
+ ### Related Resources
257
+
258
+ Explore datasets for all 8 authors in the study:
259
+ - [Jane Austen](https://huggingface.co/datasets/contextlab/austen-corpus)
260
+ - [L. Frank Baum](https://huggingface.co/datasets/contextlab/baum-corpus)
261
+ - [Charles Dickens](https://huggingface.co/datasets/contextlab/dickens-corpus)
262
+ - [F. Scott Fitzgerald](https://huggingface.co/datasets/contextlab/fitzgerald-corpus)
263
+ - [Herman Melville](https://huggingface.co/datasets/contextlab/melville-corpus)
264
+ - [Ruth Plumly Thompson](https://huggingface.co/datasets/contextlab/thompson-corpus)
265
+ - [Mark Twain](https://huggingface.co/datasets/contextlab/twain-corpus)
266
+ - [H.G. Wells](https://huggingface.co/datasets/contextlab/wells-corpus)
267
+
268
+ ### Trained Models
269
+
270
+ Author-specific GPT-2 models trained on these corpora will be available after training completes:
271
+ - https://huggingface.co/contextlab (browse all models)
gutenberg_net_au_ebooks03_0301261.txt ADDED
The diff for this file is too large to render. See raw diff
 
gutenberg_net_au_fsf_PAT-HOBBY.txt ADDED
The diff for this file is too large to render. See raw diff