Digital resources in the Social Sciences and Humanities OpenEdition Our platforms OpenEdition Books OpenEdition Journals Hypotheses Calenda Libraries OpenEdition Freemium Follow us

Py4SHS: A summer school on Python for Digital Humanities


Introduction

From 25 to 29 August, I had the opportunity to attend the Py4SHS Summer School, a five-day intensive Python training program held at the Saulcy Campus at University of Lorraine, in Metz, France. This course was designed to blend Python, a high-level interpreted programming language, and different applications in Digital Humanities.

Each day was organised with morning lectures and hands-on afternoon lab sessions, focusing on a specific topic everyday. We covered a wide range of essential topics, from setting up a functional Python environment and manipulating data to exploring the basics of Artificial Intelligence (AI) and Natural Language Processing (NLP). The tutors, with their combined academic and professional backgrounds, provided valuable guidance for our technical and theoretical development.

In this article, I will recap the sessions from this intese and exciting week and explain in very simple words the basic concepts that may be useful to better understand this article or in your everyday work practice.  

Elements of Digital Humanities and Python language 

The first day, Sophie Robert-Hayek, Associate Professor in Computer Science Applied to Humanities at Sorbonne University in Paris, gave us an overview of Digital Humanities and we looked at a wide range of existing Digital Humanities projects. After that, Céline Lemarinier, Product Owner for Eviden in the ”Data Science for HPC” team, explained what is Python language and the main data structures, operators, functions and how to install an environment, which is what we put into practice during the afternoon.

Data manipulation with Python

Tuesday was focused on data manipulation on a CSV dataset containing Shakespeare’s Romeo and Juliet, so we created a virtual environment in Python to work with Python libraries, such as pandas, numpy and seaborn. We used pandas to pre-process the dataset, for example for filtering, sorting and creating or merging columns. We used numpy to compute basic estimators like number of individuals or variables, and then to compute statistical estimators. With seaborn then, we plotted univariate and multivariate analyses to understand data relationships. 

Machine Learning and Natural Language Processing

Day 3 was all about Machine Learning (ML) and Natural Language Processing (NLP). ML algorithms are used to learn from the data we input to train the model and output inferences from new data. We dove into the distinction of supervised and unsupervised ML and understood the key concept of textual embedding, a machine-readable (vector) representation of textual data. We took a dataset with all the Shakespeare’s plays (in Digital Humanities we love Shakespeare!) and statistically analysed it with numpy. We used another Python library called spacy that is specific for NLP tasks, such as lemmatising (reduce all the words in the text to their stem = dictionary form), POS tagging (Part of Speech tagging = tagging each word with their grammatical function) and removed the stop words (very frequent words that don’t carry significant information, such as “the”, “and”, “it”). We then computed Term Frequency-Inverse Document Frequency (TF-IDF) to convert words into vectors. We combine two metrics: how frequent is a word in a specific document and how rare is that word across the entire document collection – we want to give more weight to relevant terms and reduce the weight of common words. After all this, we used scikit-learn, a ML library in Python to work with ML tasks, and used it to cluster the whole dataset into significant groups together using an unsupervised learning algorithm called k-means

Deep Learning and Optimal Character Recognition

On day 4 we tapped into OCR with Mathieu Pister, Machine Learning Operations at Schneider Electrics in Grenoble: OCR is a conversion of typed, printed or handwritten text into machine-encoded text. It dates back to 1914, but with today’s computational power and developments, we can exploit deep learning to enhance handwritten recognition, higher accuracy, multilingual management. In this section in fact, we used Tesseract, which is an open-source OCR engine to encode a manuscript in Latin. In this case we talk about supervised learning because we have a ground truth (= correct answer) to compare it with. We first pre-processed the text by improving the scanned image reducing noise and adjusting contrast and resolution, then we selected the Latin model of Tesseract that would principally do two actions: segment the document in chunks (the image is segmented into sub-segments, for example the documents is divided in lines) and recognise (these lines are subsequently decomposed in words or characters, depending on what you need). The result can be then post-processed, for example comparing what the engine read from the document with a specific language model, to output a document with higher accuracy. To compute accuracy, we usually use scoring methods like WER (Word Error Rate) or CER (Character Error Rate) that compute how many errors are in the OCR file compared to the ground truth, depending on your use case. 

Statistical testing 

During our last day, after a detailed and careful explanation of quantitative statistics, we applied Statistical Testing with Python to a typical Digital Humanities problem in Phylology. More specifically, we analysed the Epistle to the Colossians, in the New Testament of the Bible. Traditionally, the authorship of this letter is attributed to the apostle Paul, but according to modern scholarship, the authorship is debated. We used a stylometry (a field of Linguistics) approach, which is to count if the frequency of functional words (particles and conjunctions) used in the Epistle to the Colossians is different from the frequency of functional words in the letters certainly attributed to Paul. To do so, we used scipy and statsmodel libraries. We pre-processed the text and checked the graphical distribution of the two frequencies using seaborn. We then proceeded to compare the two frequencies with the Student/Welsch t-test, which tests if the means of the two populations are equal. Spoiler alert: with a p-value of 0.03, we rejected H0 and concluded that the two groups are significantly different. 

Conclusion

This summer school gave me the opportunity to deepen my knowledge of Python language in general and of computational thinking, which is actually key to understand how programming language works. I got to know more methodologies for different DH use cases, for example all the Python libraries that are really the power core of the Python environment, which I can then implement in my current and future research practice. I really appreciated the friendly and relaxed atmosphere of the school and had the pleasure to meet fellow PhD students and researchers from Europe, with which we shared common practices even if from different DH fields of application. The city of Metz is fascinating, with its impressive Medieval and Renaissance landmarks.

I want to thank the organisers and tutors — Sophie Robert-Hayek, Frédérique Rey, Mathieu Pister and Celine Lemarinier — for their dedication and thoughtfulness that turned this week into a truly remarkable experience. 

 


OpenEdition vi suggerisce di citare questo post nel modo seguente:
giadapantana (2 Settembre 2025). Py4SHS: A summer school on Python for Digital Humanities. Digital Humanities PhD. Recuperato il 16 Dicembre 2025 da https://doi.org/10.58079/14kif


Potrebbero interessarti anche...

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

This site uses Akismet to reduce spam. Learn how your comment data is processed.