v0.2.0: UFSAC training corpora (SemCor, WNGT, MASC, Senseval lex-sample)
Browse files
README.md
CHANGED
|
@@ -10,10 +10,9 @@ tags:
|
|
| 10 |
- wsd
|
| 11 |
- wordnet
|
| 12 |
- oewn
|
|
|
|
| 13 |
- semeval
|
| 14 |
- senseval
|
| 15 |
-
size_categories:
|
| 16 |
-
- 1K<n<10K
|
| 17 |
configs:
|
| 18 |
- config_name: en-senseval2-aw
|
| 19 |
data_files:
|
|
@@ -35,6 +34,34 @@ configs:
|
|
| 35 |
data_files:
|
| 36 |
- split: test
|
| 37 |
path: data/en-semeval2015-aw/test.parquet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
---
|
| 39 |
|
| 40 |
# pywsd-datasets
|
|
@@ -44,16 +71,31 @@ Unified Word Sense Disambiguation benchmark datasets, normalized to **modern
|
|
| 44 |
|
| 45 |
Companion to [pywsd](https://pypi.org/project/pywsd/) ≥ 1.3.0.
|
| 46 |
|
| 47 |
-
## What's
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
| Config
|
| 50 |
-
|-----------------------
|
| 51 |
-
| `en-
|
| 52 |
-
| `en-
|
| 53 |
-
| `en-
|
| 54 |
-
| `en-
|
| 55 |
-
| `en-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
## Install
|
| 59 |
|
|
@@ -65,8 +107,14 @@ pip install pywsd-datasets
|
|
| 65 |
|
| 66 |
```python
|
| 67 |
from datasets import load_dataset
|
|
|
|
|
|
|
| 68 |
ds = load_dataset("alvations/pywsd-datasets", "en-senseval2-aw")
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
# {'instance_id': 'd000.s000.t000', 'dataset': 'senseval2_aw',
|
| 71 |
# 'split': 'test', 'lang': 'en',
|
| 72 |
# 'tokens': ['The', 'art', 'of', 'change-ringing', ...],
|
|
@@ -80,8 +128,13 @@ ds["test"][0]
|
|
| 80 |
## Use via the loader package
|
| 81 |
|
| 82 |
```python
|
| 83 |
-
from pywsd_datasets.loaders.raganato import iter_instances
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
print(inst.target_lemma, inst.sense_ids_wordnet)
|
| 86 |
```
|
| 87 |
|
|
@@ -89,8 +142,29 @@ for inst in iter_instances("senseval2"):
|
|
| 89 |
|
| 90 |
```bash
|
| 91 |
pip install pywsd-datasets[dev]
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
|
| 96 |
## Schema
|
|
@@ -109,15 +183,29 @@ doc_id, sent_id
|
|
| 109 |
`sense_ids_wordnet` is list-valued to handle multi-gold instances and any
|
| 110 |
PWN-3.0 key that splits into multiple OEWN 2024 synsets.
|
| 111 |
|
| 112 |
-
##
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
| 121 |
|
| 122 |
## Citation
|
| 123 |
|
|
@@ -125,13 +213,17 @@ If you use these datasets please cite the original sources:
|
|
| 125 |
|
| 126 |
* Raganato, Camacho-Collados, Navigli (2017). *Word Sense Disambiguation:
|
| 127 |
A Unified Evaluation Framework and Empirical Comparison.* EACL.
|
| 128 |
-
*
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
## License
|
| 132 |
|
| 133 |
MIT for the code. Each dataset keeps its original license — see the source
|
| 134 |
-
papers. Raganato bundle and SemEval shared-task data are
|
|
|
|
| 135 |
|
| 136 |
## Sense-ID mapping details
|
| 137 |
|
|
@@ -146,8 +238,8 @@ so the coverage report can flag them. Background:
|
|
| 146 |
|
| 147 |
## Known issues
|
| 148 |
|
| 149 |
-
* `lcl.uniroma1.it` serves a
|
| 150 |
-
|
| 151 |
-
to the
|
| 152 |
-
* UFSAC v2.1
|
| 153 |
-
|
|
|
|
| 10 |
- wsd
|
| 11 |
- wordnet
|
| 12 |
- oewn
|
| 13 |
+
- semcor
|
| 14 |
- semeval
|
| 15 |
- senseval
|
|
|
|
|
|
|
| 16 |
configs:
|
| 17 |
- config_name: en-senseval2-aw
|
| 18 |
data_files:
|
|
|
|
| 34 |
data_files:
|
| 35 |
- split: test
|
| 36 |
path: data/en-semeval2015-aw/test.parquet
|
| 37 |
+
- config_name: en-semcor
|
| 38 |
+
data_files:
|
| 39 |
+
- split: train
|
| 40 |
+
path: data/en-semcor/train.parquet
|
| 41 |
+
- config_name: en-wngt
|
| 42 |
+
data_files:
|
| 43 |
+
- split: train
|
| 44 |
+
path: data/en-wngt/train.parquet
|
| 45 |
+
- config_name: en-masc
|
| 46 |
+
data_files:
|
| 47 |
+
- split: train
|
| 48 |
+
path: data/en-masc/train.parquet
|
| 49 |
+
- config_name: en-senseval2_ls
|
| 50 |
+
data_files:
|
| 51 |
+
- split: train
|
| 52 |
+
path: data/en-senseval2_ls/train.parquet
|
| 53 |
+
- split: test
|
| 54 |
+
path: data/en-senseval2_ls/test.parquet
|
| 55 |
+
- config_name: en-senseval3_ls
|
| 56 |
+
data_files:
|
| 57 |
+
- split: train
|
| 58 |
+
path: data/en-senseval3_ls/train.parquet
|
| 59 |
+
- split: test
|
| 60 |
+
path: data/en-senseval3_ls/test.parquet
|
| 61 |
+
- config_name: en-semeval2007_t17_ls
|
| 62 |
+
data_files:
|
| 63 |
+
- split: test
|
| 64 |
+
path: data/en-semeval2007_t17_ls/test.parquet
|
| 65 |
---
|
| 66 |
|
| 67 |
# pywsd-datasets
|
|
|
|
| 71 |
|
| 72 |
Companion to [pywsd](https://pypi.org/project/pywsd/) ≥ 1.3.0.
|
| 73 |
|
| 74 |
+
## What's shipped (v0.2)
|
| 75 |
+
|
| 76 |
+
**English, test-only Raganato all-words benchmark:**
|
| 77 |
+
|
| 78 |
+
| Config | Instances | OEWN 2024 coverage |
|
| 79 |
+
|-----------------------|-----------|--------------------|
|
| 80 |
+
| `en-senseval2-aw` | 2,282 | 99.43 % |
|
| 81 |
+
| `en-senseval3-aw` | 1,850 | 99.51 % |
|
| 82 |
+
| `en-semeval2007-aw` | 455 | 99.78 % |
|
| 83 |
+
| `en-semeval2013-aw` | 1,644 | 100.00 % |
|
| 84 |
+
| `en-semeval2015-aw` | 1,022 | 99.32 % |
|
| 85 |
+
|
| 86 |
+
**English, training corpora (via UFSAC v2.1):**
|
| 87 |
|
| 88 |
+
| Config | Split | OEWN 2024 coverage |
|
| 89 |
+
|---------------------------|-------|--------------------|
|
| 90 |
+
| `en-semcor` | train | see coverage_report |
|
| 91 |
+
| `en-wngt` | train | see coverage_report |
|
| 92 |
+
| `en-masc` | train | see coverage_report |
|
| 93 |
+
| `en-senseval2_ls` | train + test | lexical-sample |
|
| 94 |
+
| `en-senseval3_ls` | train + test | lexical-sample |
|
| 95 |
+
| `en-semeval2007_t17_ls` | test | lexical-sample |
|
| 96 |
+
|
| 97 |
+
Run `python -m pywsd_datasets.scripts.coverage_report` locally to get
|
| 98 |
+
up-to-date OEWN resolution rates after rebuilding.
|
| 99 |
|
| 100 |
## Install
|
| 101 |
|
|
|
|
| 107 |
|
| 108 |
```python
|
| 109 |
from datasets import load_dataset
|
| 110 |
+
|
| 111 |
+
# Raganato all-words evaluation set
|
| 112 |
ds = load_dataset("alvations/pywsd-datasets", "en-senseval2-aw")
|
| 113 |
+
|
| 114 |
+
# SemCor training data
|
| 115 |
+
ds = load_dataset("alvations/pywsd-datasets", "en-semcor")
|
| 116 |
+
|
| 117 |
+
ds["test"][0] if "test" in ds else ds["train"][0]
|
| 118 |
# {'instance_id': 'd000.s000.t000', 'dataset': 'senseval2_aw',
|
| 119 |
# 'split': 'test', 'lang': 'en',
|
| 120 |
# 'tokens': ['The', 'art', 'of', 'change-ringing', ...],
|
|
|
|
| 128 |
## Use via the loader package
|
| 129 |
|
| 130 |
```python
|
| 131 |
+
from pywsd_datasets.loaders.raganato import iter_instances as iter_raganato
|
| 132 |
+
from pywsd_datasets.loaders.ufsac import iter_instances as iter_ufsac
|
| 133 |
+
|
| 134 |
+
for inst in iter_raganato("senseval2"):
|
| 135 |
+
print(inst.target_lemma, inst.sense_ids_wordnet)
|
| 136 |
+
|
| 137 |
+
for inst in iter_ufsac("semcor", "/path/to/ufsac-public-2.1"):
|
| 138 |
print(inst.target_lemma, inst.sense_ids_wordnet)
|
| 139 |
```
|
| 140 |
|
|
|
|
| 142 |
|
| 143 |
```bash
|
| 144 |
pip install pywsd-datasets[dev]
|
| 145 |
+
|
| 146 |
+
# Raganato only (always works, ~1 MB fetch from our GH release mirror)
|
| 147 |
+
python -m pywsd_datasets.scripts.build_all
|
| 148 |
+
|
| 149 |
+
# With UFSAC corpora — download ufsac-public-2.1 separately (see below)
|
| 150 |
+
python -m pywsd_datasets.scripts.build_all \
|
| 151 |
+
--ufsac-root ~/.cache/pywsd-datasets/ufsac/ufsac-public-2.1
|
| 152 |
+
|
| 153 |
+
# Coverage report across every built parquet:
|
| 154 |
+
python -m pywsd_datasets.scripts.coverage_report
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
### UFSAC download
|
| 158 |
+
|
| 159 |
+
UFSAC v2.1 is distributed as a single Google Drive tarball
|
| 160 |
+
(`ufsac-public-2.1.tar.xz`, ~196 MB). Fetch with `gdown`:
|
| 161 |
+
|
| 162 |
+
```bash
|
| 163 |
+
pip install gdown
|
| 164 |
+
mkdir -p ~/.cache/pywsd-datasets/ufsac
|
| 165 |
+
gdown 'https://drive.google.com/uc?id=1kwBMIDBTf6heRno9bdLvF-DahSLHIZyV' \
|
| 166 |
+
-O ~/.cache/pywsd-datasets/ufsac/ufsac-public-2.1.tar.xz
|
| 167 |
+
cd ~/.cache/pywsd-datasets/ufsac && tar -xf ufsac-public-2.1.tar.xz
|
| 168 |
```
|
| 169 |
|
| 170 |
## Schema
|
|
|
|
| 183 |
`sense_ids_wordnet` is list-valued to handle multi-gold instances and any
|
| 184 |
PWN-3.0 key that splits into multiple OEWN 2024 synsets.
|
| 185 |
|
| 186 |
+
## Multilingual / XL-WSD / BabelNet — deferred
|
| 187 |
|
| 188 |
+
`loaders/xl_wsd.py` exists as a stub and raises `NotImplementedError`.
|
| 189 |
+
`mappers/babelnet_to_wn.py` is similarly unused. **Why:**
|
| 190 |
+
|
| 191 |
+
* XL-WSD uses BabelNet synset IDs as gold labels; resolving them to
|
| 192 |
+
modern `wn` lexicon IDs requires the BabelNet → PWN 3.0 bridge file,
|
| 193 |
+
which is distributed **only with a BabelNet academic license**.
|
| 194 |
+
* XL-WSD itself is CC-BY-NC 4.0 — we don't redistribute the data.
|
| 195 |
+
|
| 196 |
+
Reviving this path requires (a) a BabelNet license, (b) loading
|
| 197 |
+
`bn_to_wn.txt` via `babelnet_to_wn.load_bn_to_pwn3_map()`, (c) selecting
|
| 198 |
+
per-language OMW lexicons via `mappers.omw_lookup.lexicon_for(lang)`,
|
| 199 |
+
then (d) chaining through `pwn3_to_oewn.pwn3_sensekey_to_wn(key, lexicon=...)`.
|
| 200 |
+
All four pieces are in place — wiring them is blocked on the BabelNet
|
| 201 |
+
mapping file. See the module docstrings for details.
|
| 202 |
+
|
| 203 |
+
## Roadmap
|
| 204 |
|
| 205 |
+
* **v0.2** (this release): Raganato all-words evaluation + UFSAC training
|
| 206 |
+
corpora (SemCor, WNGT, MASC, Senseval lexical-sample).
|
| 207 |
+
* **v0.3** (planned): WiC (CC-BY-NC — loader-only), CoarseWSD-20.
|
| 208 |
+
* **Deferred:** XL-WSD multilingual (needs BabelNet academic license).
|
| 209 |
|
| 210 |
## Citation
|
| 211 |
|
|
|
|
| 213 |
|
| 214 |
* Raganato, Camacho-Collados, Navigli (2017). *Word Sense Disambiguation:
|
| 215 |
A Unified Evaluation Framework and Empirical Comparison.* EACL.
|
| 216 |
+
* Vial, Lecouteux, Schwab (2018). *UFSAC: Unification of Sense Annotated
|
| 217 |
+
Corpora and Tools.* LREC.
|
| 218 |
+
* Plus the specific evaluation or training set paper (Senseval-2 / 3,
|
| 219 |
+
SemEval-2007 T17, SemEval-2013 T12, SemEval-2015 T13, SemCor,
|
| 220 |
+
WNGT/Princeton Gloss Corpus, MASC).
|
| 221 |
|
| 222 |
## License
|
| 223 |
|
| 224 |
MIT for the code. Each dataset keeps its original license — see the source
|
| 225 |
+
papers. Raganato bundle and SemEval shared-task data are
|
| 226 |
+
research-unrestricted; UFSAC is MIT.
|
| 227 |
|
| 228 |
## Sense-ID mapping details
|
| 229 |
|
|
|
|
| 238 |
|
| 239 |
## Known issues
|
| 240 |
|
| 241 |
+
* The upstream Raganato zip at `http://lcl.uniroma1.it/wsdeval/` serves a
|
| 242 |
+
mismatched TLS cert; our loader prefers the mirror on this repo's
|
| 243 |
+
GitHub release assets and falls back to the original URL over HTTP.
|
| 244 |
+
* UFSAC v2.1 is distributed as a Google Drive tarball; the loader assumes
|
| 245 |
+
you have it unpacked locally. A future release may mirror it.
|