Elamur Research⌕
☰
home / papers / 2023 / A data science and machine learning approach to continuous analysis of Shakespeare's plays

A data science and machine learning approach to continuous analysis of Shakespeare's plays

Paper · 2023 · Charles Swisher and Lior Shamir

Summary

The paper asks whether Shakespeare's writing style changed measurably across his career. It also asks whether the plays can be placed in time from style alone. The authors take the 38 plays from the MIT "Complete Works" site, leaving out the disputed "Edward III", and remove headers and front matter. Each play gets one representative composition year based on the Royal Shakespeare Company timeline. The Udat tool, built on CoreNLP, turns every play into 298 numeric descriptors covering word and sentence length, punctuation, vocabulary diversity, POS distributions, sentiment, readability, Soundex sound patterns and topic words. Each descriptor is weighted by its Pearson correlation with the year, and a weighted nearest-neighbour regressor then estimates each play's year. The predicted and assumed dates correlate at 0.71. Over time, sentences get shorter, adjectives and adverbs become more frequent, and the tone becomes less negative. Some plays fit a different period than their date suggests: "Romeo and Juliet" resembles the post-1600 plays. The approach is not driven by a prior hypothesis, and the code is public. This makes it a reusable template for stylometry in the digital humanities.

Key points

  • Corpus: 38 plays with one assigned year each. Udat with CoreNLP extracts 298 descriptors, including DFT-based periodicity of POS sequences and per-sentence CoreNLP sentiment on a 0–4 scale.
  • Year prediction: Pearson r = 0.71 between actual and predicted year, with a two-tailed p ≈ 6·10⁻⁷.
  • Single-feature trends against year:
    • mean sentence length r = −0.53 (shortest in 1600–1607);
    • very negative sentences r = −0.47;
    • negative sentences r = −0.57;
    • positive sentences r = 0.51.
  • "Romeo and Juliet" is dated 1596, yet its word homogeneity, topic words, modal auxiliaries and sentiment match the later plays.
  • Comedy vs tragedy classification:
    • Setup: 9 training plays and 1 test play per class, repeated over 100 random splits.
    • Accuracy: 74%.
    • Comedies have longer words, a higher Coleman–Liau index, more Soundex diversity, more "?" and more variable sentence length.

Interesting ideas

  • I1. Weighting each feature by its Pearson correlation with the target and then running a nearest-neighbour search gives a predictor whose every weight can be read and justified.
  • I2. Cases where the model disagrees with the label are treated as findings rather than errors, as when a play "looks" like another period.
  • I3. A Discrete Fourier Transform over the POS sequence captures rhythmic, repeating grammatical patterns that plain frequency counts miss.
  • I4. Classification accuracy is reported over many random train/test splits and judged against a 50% chance level, which keeps a small-sample claim honest.
  • I5. Sentiment is tracked sentence by sentence, including how it varies through a text, rather than as one document-level score.

For Mova

How these ideas could serve Mova, our small open language model — its files, stages and tests:

  • I1 (learn): such a model could estimate text difficulty or genre from tree-derived statistics while staying fully explainable, unlike an opaque regressor.
  • I2 (learn): sentences or documents whose parse statistics clash with their source treebank or dialect could be flagged automatically as candidates for annotation or conversion bugs.
  • I3 (tokens): POS periodicity spectra could cheaply detect tagger drift or odd input genres, such as verse or lists, before parsing.
  • I4 (learn): the same repeated-split protocol with an explicit chance baseline fits naturally into evaluation with negative controls on small test sets.
  • I5 (world): a per-sentence affect trajectory could be attached to entities and event order, supporting questions about how a character's situation turns in fables and tales.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Charles Swisher and Lior Shamir. 2023. A data science and machine learning approach to continuous analysis of Shakespeare's plays. arXiv:2301.06024 · Journal of Data Mining & Digital Humanities, 2023 (July 13, 2023) jdmdh:10829.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.46298/jdmdh.10829 · arXiv 2301.06024

@misc{swisher2023data,
  title = {{A data science and machine learning approach to continuous analysis of Shakespeare's plays}},
  author = {Charles Swisher and Lior Shamir},
  year = {2023},
  doi = {10.46298/jdmdh.10829},
  eprint = {2301.06024},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.46298/jdmdh.10829}
}

References

54 references, 3 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Andreev, V. Patterns in style evolution of poets. SAGE Open. 2019; 9(1). find
  2. Bai, S. and An, S. A survey on automatic image caption generation. Neurocomputing. 2018; 311: 291–304. find
  3. Barber, R. Big data or not enough? zeta test reliability and the attribution of henry VI. Digital Scholarship in the Humanities. 2021; 36(3) : 542-564. find
  4. Bauer, M. and Zirker, A. Shakespeare and stylometrics: Character style paradox and unique parallels. Regensburg, 2019; 31. find
  5. Boyd, R. L. Psychological text analysis in the digital humanities. In Data Analytics in Digital Humanities. 2017; 161–189. find
  6. Boyd, R. L. and Pennebaker, J. W. Did shakespeare write double falsehood? identifying individuals by creating psychological signatures with text analysis. Psychological Science. 2015; 26(5):570–582. find
  7. Brainerd, B. The chronology of shakespeare’s plays: A statistical study. Computers and the Humanities. 1980; 14: 221–230. find
  8. Coleman, M. and Liau, T. L. A computer readability formula designed for machine scoring. Journal of Applied Psychology. 1975; 60(2):283. find
  9. Craig, H. and Kinney, A. F., Shakespeare, computers, and the mystery of authorship. Cambridge University Press. 2009. de Rosa, G. H. and Papa, J. P. A survey on text generation using generative adversarial networks. find
  10. Pattern Recognition. 2021; 119:108098. find
  11. Derks, P. L. Clockwork Shakespeare: The bard meets the regressive imagery dictionary. Empirical Studies of the Arts. 1993; 12(2):131–139. find
  12. El-Kassas, W. S., Salama, C. R., Rafea, A. A., and Mohamed, H. K. Automatic text summarization: A comprehensive survey. Expert systems with applications. 2021; 165:113679. find
  13. Elliott, W. E. and Valenza, R. J. Two tough nuts to crack: Did Shakespeare write the ‘Shakespeare’ portions of sir thomas more and edward III ? Part I. Literary and Linguistic Computing. 2010a; 25(1):67–83. find
  14. Elliott, W. E. and Valenza, R. J. Two tough nuts to crack: did Shakespeare write the ‘Shakespeare’ portions of sir thomas more and edward III? Part II: Conclusion. Literary and Linguistic Computing. 2010b; 25(2):165–177. find
  15. Forsyth, R. S. Stylochronometry with substrings, or: a poet young and old. Literary and Linguistic Computing. 1999; 14(4):467–478. find
  16. Fucks, W. On mathematical analysis of style. Biometrika. 1952; 39(1/2):122–129. find
  17. Gambhir, M. and Gupta, V. Recent automatic text summarization techniques: a survey. Artificial Intelligence Review. 2017; 47:1–66. find
  18. Gatt, A. and Krahmer, E. Survey of the state of the art in natural language generation: Core tasks, applications and evaluation. Journal of Artificial Intelligence Research. 2018; 61:65–170. find
  19. Harbage, A. ”Love’s labor’s lost” and the early Shakespeare. Philological Quarterly. 1962; 41(1):18. find
  20. Hossain, M. Z., Sohel, F., Shiratuddin, M. F., and Laga, H. A comprehensive survey of deep learning for image captioning. ACM Computing Surveys. 2019; 51(6):1–36. find
  21. Kadhim, A. I. Survey on supervised machine learning techniques for automatic text classification. Artificial Intelligence Review. 2018; 52(1):273–292. find
  22. Klaussner, C. Elements of Style Change. PhD thesis, Trinity College Dublin. School of Computer Science & Statistics. Discipline, 2018. find
  23. Journal of Data Mining and Digital Humanities ISSN 2416-5999, an open-access journal Klaussner, C. and Vogel, C. Stylochronometry: Timeline prediction in stylometric analysis. In Research and Development in Intelligent Systems XXXII: Incorporating Applications and Innovations in Intelligent Systems XXIII. 2015; 91–106. find
  24. Klaussner, C. and Vogel, C. Temporal predictive regression models for linguistic style analysis. Journal of Language Modelling. 2018; 6. find
  25. Kowsari, K., Jafari Meimandi, K., Heidarysafa, M., Mendu, S., Barnes, L., and Brown, D. Text classification algorithms: A survey. Information. 2019; 10(4):150. find
  26. Lowe, D. and Matthews, R. Shakespeare vs. Fletcher: A stylometric analysis by radial basis functions. Computers and the Humanities. 1995; 29(6): 449–461. find
  27. Manning, C. D., Surdeanu, M., Bauer, J., Finkel, J. R., Bethard, S., and McClosky, D. The stanford corenlp natural language processing toolkit. In Proceedings of 52nd Annual Meeting of the Association for Computational Linguistics. 2014; 55–60.
  28. McDonald, R. Shakespeare’s late style. 2006. Cambridge University Press. find
  29. Merriam, T. Untangling the derivatives: points for clarification in the findings of the shakespeare clinic. Literary and Linguistic Computing. 2009; 24(4):403–416. find
  30. Lowe, D. and Matthews, R. Shakespeare vs. Fletcher: A stylometric analysis by radial basis functions. Computers and the Humanities. 1995. 29(6):449–461. find
  31. Manning, C. D., Surdeanu, M., Bauer, J., Finkel, J. R., Bethard, S., and McClosky, D. The stanford corenlp natural language processing toolkit. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics. 2014; pages 55–60.
  32. McDonald, R. Shakespeare’s late style. 2006. Cambridge University Press. find
  33. Merriam, T. Untangling the derivatives: points for clarification in the findings of the shakespeare clinic. Literary and Linguistic Computing. 2009; 24(4):403–416. find
  34. Moscato, P., Craig, H., Egan, G., Haque, M. N., Huang, K., Sloan, J., and de Oliveira, J. C. Multiple regression techniques for modelling dates of first performances of shakespeare-era plays. Expert Systems with Applications. 2022; 200:116903. find
  35. Nadel, I. B. and Matsuba, S. N. The ‘cunning pattern of excelling nature’: Shakespeare and the literary application of discan. Literary and Linguistic Computing. 1990; 5(3):229–234. find
  36. Predić, B., Manić, D., Saračević, M., Karabašević, D., and Stanujkić, D. Automatic image caption generation based on some machine learning algorithms. Mathematical Problems in Engineering, 2022; 4001460. find
  37. Rizvi, P. The interpretation of zeta test results. Digital Scholarship in the Humanities. 2019; 34(2):401–418. find
  38. Rosebaugh, C. and Shamir, L. Data science approach to compare the lyrics of popular music artists. UNISIA. 2022; 40:1. find
  39. Savoy, J. Stylometric analysis of characters in Shakespeare’s plays. Digital Scholarship in the Humanities. 2022; fqac092. find
  40. Seminck, O., Gambette, P., Legallois, D., and Poibeau, T. The corpus for idiolectal research. Journal of Open Humanities Data. 2021; 7:15. find
  41. Seminck, O., Gambette, P., Legallois, D., and Poibeau, T. The evolution of the idiolect over the lifetime: A quantitative and qualitative study of french 19th century literature. Journal of Cultural Analytics. 2022; 7(3). find
  42. Shamir, L. A computer analysis method for correlating knee x-rays with continuous indicators. International Journal of Computer Assisted Radiology and Surgery. 2011; 6(5):699–704. find
  43. Shamir, L. Udat: Compound quantitative analysis of text using machine learning. Digital Scholarship in the Humanities. 2020; 36(1):187–208. find
  44. Smith, E. A. and Senter, R. Automated readability index. AMRL-TR. Aerospace Medical Research Laboratories (US), 1967; 1. find
  45. Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A. Y., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. Proceedings Conference on Empirical Methods in Natural Language Processing. 2013; 1631–1642.
  46. Journal of Data Mining and Digital Humanities ISSN 2416-5999, an open-access journal Stamou, C. Stylochronometry: Stylistic development, sequence of composition, and relative dating. Literary and Linguistic Computing. 2007; 23(2):181–199. find
  47. Taylor, G. The canon and chronology of shakespeare’s plays. William Shakespeare: A Textual Companion. 1987; 69–144. find
  48. Whitworth, C. The comedy of errors. 2003. Oxford University Press, USA. find
  49. Wilhelm, T., Burghardt, M., and Wolff, C. To see or not to see – an interactive tool for the visualization and analysis of shakespeare plays. 2013. find
  50. Williams, C. B. Mendenhall’s studies of word-length distribution in the works of shakespeare and bacon. Biometrika. 1975; 62(1):207–212. find
  51. Xue, S., Lüdtke, J., Sylvester, T., and Jacobs, A. M. Reading Shakespeare sonnets: combining quantitative narrative analysis and predictive modeling—an eye tracking study. Journal of Eye Movement Research. 2019 ; 12(5). find
  52. Yadav, A. and Vishwakarma, D. K. Sentiment analysis using deep learning architectures: a review. Artificial Intelligence Review. 2020; 53(6):4335–4385. find
  53. Zesmer, D. M. Guide to Shakespeare. Barnes & Noble Books. 1976. find
  54. Zhang, L., Wang, S., and Liu, B. Deep learning for sentiment analysis: A survey. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery. 2018; 8(4):e1253. find

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/swisher-2023-data-science-machine-learning-approach/