Sean MacAvaney
commited on
Commit
·
3edf353
1
Parent(s):
3c2c947
commit files to HF hub
Browse files- README.md +36 -0
- aquaint.py +44 -0
README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: '`aquaint`'
|
| 3 |
+
viewer: false
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Dataset Card for `aquaint`
|
| 7 |
+
|
| 8 |
+
The `aquaint` IR dataset, provided by the [ir-datasets](https://ir-datasets.com/) package.
|
| 9 |
+
|
| 10 |
+
This dataset provides:
|
| 11 |
+
- `docs` (documents, i.e., the corpus)
|
| 12 |
+
|
| 13 |
+
This dataset is used by: [`aquaint_trec-robust-2005`](https://huggingface.co/datasets/irds/aquaint_trec-robust-2005)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
Find more information about the dataset [here](https://ir-datasets.com/{dsid.split('/')[0]}#{dsid}).
|
| 17 |
+
|
| 18 |
+
## Usage
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from datasets import load_dataset
|
| 22 |
+
dataset = load_dataset({repr("irds/"+hgf_id)})
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## Citation Information
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
@misc{Graff2002Aquaint,
|
| 30 |
+
title={The AQUAINT Corpus of English News Text},
|
| 31 |
+
author={David Graff},
|
| 32 |
+
year={2002},
|
| 33 |
+
url={https://catalog.ldc.upenn.edu/LDC2002T31},
|
| 34 |
+
publisher={Linguistic Data Consortium}
|
| 35 |
+
}
|
| 36 |
+
```
|
aquaint.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
"""
|
| 3 |
+
""" # TODO
|
| 4 |
+
try:
|
| 5 |
+
import ir_datasets
|
| 6 |
+
except ImportError as e:
|
| 7 |
+
raise ImportError('ir-datasets package missing; `pip install ir-datasets`')
|
| 8 |
+
import datasets
|
| 9 |
+
|
| 10 |
+
IRDS_ID = 'aquaint'
|
| 11 |
+
IRDS_ENTITY_TYPES = {'docs': {'doc_id': 'string', 'text': 'string', 'marked_up_doc': 'string'}}
|
| 12 |
+
|
| 13 |
+
_CITATION = '@misc{Graff2002Aquaint,\n title={The AQUAINT Corpus of English News Text},\n author={David Graff},\n year={2002},\n url={https://catalog.ldc.upenn.edu/LDC2002T31},\n publisher={Linguistic Data Consortium}\n}'
|
| 14 |
+
|
| 15 |
+
_DESCRIPTION = "" # TODO
|
| 16 |
+
|
| 17 |
+
class aquaint(datasets.GeneratorBasedBuilder):
|
| 18 |
+
BUILDER_CONFIGS = [datasets.BuilderConfig(name=e) for e in IRDS_ENTITY_TYPES]
|
| 19 |
+
DEFAULT_CONFIG_NAME = list(IRDS_ENTITY_TYPES)[0]
|
| 20 |
+
|
| 21 |
+
def _info(self):
|
| 22 |
+
return datasets.DatasetInfo(
|
| 23 |
+
description=_DESCRIPTION,
|
| 24 |
+
features=datasets.Features({k: datasets.Value(v) for k, v in IRDS_ENTITY_TYPES[self.config.name].items()}),
|
| 25 |
+
homepage=f"https://ir-datasets.com/aquaint#aquaint",
|
| 26 |
+
citation=_CITATION,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
def _split_generators(self, dl_manager):
|
| 30 |
+
return [datasets.SplitGenerator(name=self.config.name)]
|
| 31 |
+
|
| 32 |
+
def _generate_examples(self):
|
| 33 |
+
dataset = ir_datasets.load(IRDS_ID)
|
| 34 |
+
for i, item in enumerate(getattr(dataset, self.config.name)):
|
| 35 |
+
key = i
|
| 36 |
+
if self.config.name == 'docs':
|
| 37 |
+
key = item.doc_id
|
| 38 |
+
elif self.config.name == 'queries':
|
| 39 |
+
key = item.query_id
|
| 40 |
+
yield key, item._asdict()
|
| 41 |
+
|
| 42 |
+
def as_dataset(self, split=None, *args, **kwargs):
|
| 43 |
+
split = self.config.name # always return split corresponding with this config to avid returning a redundant DatasetDict layer
|
| 44 |
+
return super().as_dataset(split, *args, **kwargs)
|