This repository contains code for data extraction, embeddings, classification, clustering and analysis for the article:
[Anonymous]. (under review). Performing Gender on the Early Modern Stage. A Computational and Cross-Lingual Approach to Male and Female Speech in European Drama.
european-gender-drama/ the main folder contains the Python files to extract data, get embeddings, train classifiers and run clustering experiments/notebooks/ contains a notebook exploring the extracted speech texts/data/ contains the per-language speech/gender corpora and corpus statistics/results/ contains results of the classification, clustering and temporal experiments/figs/ contains the figures generated from those resultsThe extracted and classified dataset will be made available upon acceptance.
Speech data is drawn from DraCor (Dutch, English, French, German, Italian and Spanish/Catalan corpora). Sentence embeddings are pushed to and loaded from HuggingFace. Links will be added later.
βββ README.md <- The top-level README for developers using this project.
β
βββ requirements.txt <- Python dependencies.
β
βββ clustering_task.py <- Clustering task (KMeans + V-measure) to choose the best embedding model per language.
β
βββ check_chunksize.py <- Inspects how many usable speech chunks result from different chunk sizes / top-speaker cutoffs.
β
βββ get_embeddings_europe.py <- Chunk speech data and push sentence embeddings (BGE-M3 etc.) for all languages to the Hugging Face Hub.
β
βββ train_classifiers_europe.py <- Train logistic regression classifiers (TF-IDF and embeddings) to predict speaker gender, per language.
β
βββ train_temporal_fre.py <- Temporal version of the classification task: trains classifiers on 25-year subcorpora (1625β1800) of the French corpus.
β
βββ add_year_to_ndjson.py <- Adds publication year (from DraCor metadata) to the per-language NDJSON files.
β
βββ add_year_to_hf_dataset.py <- Propagates the 'year' column from the NDJSON files to the pushed Hugging Face embedding datasets.
β
βββ push_to_hub.py <- Merges per-language local embedding datasets and pushes the combined dataset to the Hugging Face Hub.
β
βββ visualize_corpus_stats.py <- Figures on corpus composition: plays per decade, % female characters/lines, centrality by gender, speech length over time, and % female lines/characters over time for the French corpus.
β
βββ visualize_method_comparison.py <- Figures comparing classification accuracy across languages and embedding/TF-IDF methods.
β
βββ visualize_temporal_results.py <- Figures for the temporal French classification results.
β
βββ data/ <- Per-language speech/gender NDJSON files (zipped), plus corpus_stats/ (per-play and per-character CSVs) created by the notebooks.
β
βββ notebooks/ <- Jupyter notebooks.
β β
β βββ explore_speech_texts.ipynb <- Exploratory look at the extracted speech texts.
β
βββ figs/ <- Figures generated by the visualize_*.py scripts.
β
βββ results/ <- Results from the clustering, classification and temporal experiments (incl. v_measures/ subfolder).
23 commits
Python
72.1%
Jupyter Notebook
27.9%
This repository contains code for data extraction, embeddings, classification, clustering and analysis for the article:
[Anonymous]. (under review). Performing Gender on the Early Modern Stage. A Computational and Cross-Lingual Approach to Male and Female Speech in European Drama.
european-gender-drama/ the main folder contains the Python files to extract data, get embeddings, train classifiers and run clustering experiments/notebooks/ contains a notebook exploring the extracted speech texts/data/ contains the per-language speech/gender corpora and corpus statistics/results/ contains results of the classification, clustering and temporal experiments/figs/ contains the figures generated from those resultsThe extracted and classified dataset will be made available upon acceptance.
Speech data is drawn from DraCor (Dutch, English, French, German, Italian and Spanish/Catalan corpora). Sentence embeddings are pushed to and loaded from HuggingFace. Links will be added later.
βββ README.md <- The top-level README for developers using this project.
β
βββ requirements.txt <- Python dependencies.
β
βββ clustering_task.py <- Clustering task (KMeans + V-measure) to choose the best embedding model per language.
β
βββ check_chunksize.py <- Inspects how many usable speech chunks result from different chunk sizes / top-speaker cutoffs.
β
βββ get_embeddings_europe.py <- Chunk speech data and push sentence embeddings (BGE-M3 etc.) for all languages to the Hugging Face Hub.
β
βββ train_classifiers_europe.py <- Train logistic regression classifiers (TF-IDF and embeddings) to predict speaker gender, per language.
β
βββ train_temporal_fre.py <- Temporal version of the classification task: trains classifiers on 25-year subcorpora (1625β1800) of the French corpus.
β
βββ add_year_to_ndjson.py <- Adds publication year (from DraCor metadata) to the per-language NDJSON files.
β
βββ add_year_to_hf_dataset.py <- Propagates the 'year' column from the NDJSON files to the pushed Hugging Face embedding datasets.
β
βββ push_to_hub.py <- Merges per-language local embedding datasets and pushes the combined dataset to the Hugging Face Hub.
β
βββ visualize_corpus_stats.py <- Figures on corpus composition: plays per decade, % female characters/lines, centrality by gender, speech length over time, and % female lines/characters over time for the French corpus.
β
βββ visualize_method_comparison.py <- Figures comparing classification accuracy across languages and embedding/TF-IDF methods.
β
βββ visualize_temporal_results.py <- Figures for the temporal French classification results.
β
βββ data/ <- Per-language speech/gender NDJSON files (zipped), plus corpus_stats/ (per-play and per-character CSVs) created by the notebooks.
β
βββ notebooks/ <- Jupyter notebooks.
β β
β βββ explore_speech_texts.ipynb <- Exploratory look at the extracted speech texts.
β
βββ figs/ <- Figures generated by the visualize_*.py scripts.
β
βββ results/ <- Results from the clustering, classification and temporal experiments (incl. v_measures/ subfolder).
23 commits
Python
72.1%
Jupyter Notebook
27.9%