Sean MacAvaney commited on
Commit
0df0cd0
·
1 Parent(s): 0e540f3

commit files to HF hub

Browse files
Files changed (2) hide show
  1. README.md +29 -0
  2. antique.py +44 -0
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: '`antique`'
3
+ viewer: false
4
+ ---
5
+
6
+ # Dataset Card for `antique`
7
+
8
+ This dataset provides the `antique` IR dataset, provided by the [ir-datasets](https://ir-datasets.com/) package.
9
+
10
+ Find more information about the dataset [here](https://ir-datasets.com/antique#antique).
11
+
12
+ ## Usage
13
+
14
+ ```python
15
+ from datasets import load_dataset
16
+ dataset = load_dataset('irds/antique')
17
+ ```
18
+
19
+
20
+ ## Citation Information
21
+
22
+ ```
23
+ @inproceedings{Hashemi2020Antique,
24
+ title={ANTIQUE: A Non-Factoid Question Answering Benchmark},
25
+ author={Helia Hashemi and Mohammad Aliannejadi and Hamed Zamani and Bruce Croft},
26
+ booktitle={ECIR},
27
+ year={2020}
28
+ }
29
+ ```
antique.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 = 'antique'
11
+ IRDS_ENTITY_TYPES = {'docs': {'doc_id': 'string', 'text': 'string'}}
12
+
13
+ _CITATION = '@inproceedings{Hashemi2020Antique,\n title={ANTIQUE: A Non-Factoid Question Answering Benchmark},\n author={Helia Hashemi and Mohammad Aliannejadi and Hamed Zamani and Bruce Croft},\n booktitle={ECIR},\n year={2020}\n}'
14
+
15
+ _DESCRIPTION = "" # TODO
16
+
17
+ class antique(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/antique#antique",
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)