Master's thesis code. It studies whether the different meanings of a Spanish word can be separated automatically from BERT contextual embeddings.
The idea: take an ambiguous word (e.g. mono = monkey / overalls / cute), collect many sentences using it, embed each occurrence with a Spanish BERT model, and check if the meanings form distinct clusters in embedding space.
| Folder | What it is |
|---|---|
src/semantic_analysis/ | Core: embed sentences, extract the target word vector, plot/evaluate. |
src/utils/ | Shared helpers: embeddings, clustering, metrics, datasets, plots. |
src/experiments/ | Scripts for generating the results, as well as some exploratory analysis. |
src/scrapers/ | Scrape example sentences (Reverso, SpanishDict). |
src/latex/ | Generate the thesis figures and tables. |
scripts/ | Data extraction (AnCora, XL-WSD) and sentence generation. |
experiments/ | Notebooks used for exploratory analysis. |
data/ | Datasets (scraped sentences, XL-WSD Spanish, AnCora anchors). |
results/, visualizations/ | Output. |
Needs Python 3.14 and uv.
uv sync
uv run semantic-analysis # core analysis (default: word "mono")
Most work lives in the notebooks under experiments/ and the scripts under
src/experiments/.
Master's thesis code. It studies whether the different meanings of a Spanish word can be separated automatically from BERT contextual embeddings.
The idea: take an ambiguous word (e.g. mono = monkey / overalls / cute), collect many sentences using it, embed each occurrence with a Spanish BERT model, and check if the meanings form distinct clusters in embedding space.
| Folder | What it is |
|---|---|
src/semantic_analysis/ | Core: embed sentences, extract the target word vector, plot/evaluate. |
src/utils/ | Shared helpers: embeddings, clustering, metrics, datasets, plots. |
src/experiments/ | Scripts for generating the results, as well as some exploratory analysis. |
src/scrapers/ | Scrape example sentences (Reverso, SpanishDict). |
src/latex/ | Generate the thesis figures and tables. |
scripts/ | Data extraction (AnCora, XL-WSD) and sentence generation. |
experiments/ | Notebooks used for exploratory analysis. |
data/ | Datasets (scraped sentences, XL-WSD Spanish, AnCora anchors). |
results/, visualizations/ | Output. |
Needs Python 3.14 and uv.
uv sync
uv run semantic-analysis # core analysis (default: word "mono")
Most work lives in the notebooks under experiments/ and the scripts under
src/experiments/.