Preparing comparable texts
The attribution task asks which of Baudelaire, Hugo or Rimbaud wrote a given poem. For this NLP course project at ESIEA, I worked with a corpus of 208 poems drawn from Project Gutenberg pages.
Preparation turns differently edited source texts into comparable model inputs. It separates poems from surrounding material, normalises the text and stores the prepared data in JSON. Doing the linguistic preprocessing once avoids repeating it for every experiment and gives the models a common starting point.
Moving from segments to whole poems
Texts are divided into windows, processed with spaCy and converted into indices. The vocabulary is built from the training data. Segments stay grouped by poem when the corpus is split: 145 poems for training, 31 for validation and 32 for testing.
I compared an MLP, an RNN, an LSTM and a GRU using TensorFlow/Keras. Each model produces probabilities for a segment; averaging them yields the attribution for the complete poem. This connects the manageable units used in training to the document-level question being asked.
Examining results and mistakes
The final report records 87.5% correct attributions for both the MLP and LSTM on the 32 test poems, compared with 81.25% for the RNN and 78.12% for the GRU. In this experiment, the MLP reaches the same accuracy as the LSTM with fewer parameters.
I also examined confusion matrices and metrics by author. They add context to the overall score, especially because Baudelaire has more examples in the corpus. The documented checkpoint selection uses the test set, so these numbers describe the experiment rather than an untouched final evaluation.
Adjusting models in response to observations
Differences between training and validation guided experiments with capacity, regularisation and learning settings. Jupyter notebooks retain curves and commentary so a change can be considered alongside its result. Several settings changed together, which makes those iterations comparisons of configurations rather than isolated causal tests.
A second part compares character-level and word-level generation under its own protocol. It extends the investigation of text representations. Across both parts, my main contribution is a comparison that can be followed from the prepared data through the models to an interpretation of their outputs.