Giguru Scheuer
commited on
Commit
·
83d7c40
1
Parent(s):
9985d44
Add `topics_with_context`
Browse files- trec-cast-2019-multi-turn.py +13 -2
trec-cast-2019-multi-turn.py
CHANGED
|
@@ -48,6 +48,7 @@ _LICENSE = ""
|
|
| 48 |
_URL = "https://huggingface.co/datasets/uva-irlab/trec-cast-2019-multi-turn/resolve/main/"
|
| 49 |
_URLs = {
|
| 50 |
'topics': _URL+"cast2019_test_annotated.tsv",
|
|
|
|
| 51 |
'qrels': _URL+"2019qrels.txt",
|
| 52 |
'test_collection': {
|
| 53 |
'car': "http://trec-car.cs.unh.edu/datareleases/v2.0/paragraphCorpus.v2.0.tar.xz",
|
|
@@ -76,8 +77,11 @@ class TrecCast2019MultiTurn(datasets.GeneratorBasedBuilder):
|
|
| 76 |
version=VERSION,
|
| 77 |
description=""),
|
| 78 |
datasets.BuilderConfig(name="topics",
|
| 79 |
-
version=
|
| 80 |
description="The topics contain the queries, query IDs and their history."),
|
|
|
|
|
|
|
|
|
|
| 81 |
datasets.BuilderConfig(name="test_collection",
|
| 82 |
version=VERSION,
|
| 83 |
description="The test collection will provide the passages of TREC CAR and MSMARCO"),
|
|
@@ -99,6 +103,12 @@ class TrecCast2019MultiTurn(datasets.GeneratorBasedBuilder):
|
|
| 99 |
"query": datasets.Value("string"),
|
| 100 |
})
|
| 101 |
download_size = 1138032
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
elif self.config.name == "qrels":
|
| 103 |
features = datasets.Features({
|
| 104 |
"qid": datasets.Value("string"),
|
|
@@ -143,6 +153,7 @@ class TrecCast2019MultiTurn(datasets.GeneratorBasedBuilder):
|
|
| 143 |
urlkey = 'test_collection' if self.config.name == 'test_collection_sample' else self.config.name
|
| 144 |
my_urls = _URLs[urlkey]
|
| 145 |
downloaded_files = dl_manager.download_and_extract(my_urls)
|
|
|
|
| 146 |
return [
|
| 147 |
datasets.SplitGenerator(
|
| 148 |
name=datasets.Split.TEST,
|
|
@@ -172,7 +183,7 @@ class TrecCast2019MultiTurn(datasets.GeneratorBasedBuilder):
|
|
| 172 |
for qid in qrels.keys():
|
| 173 |
yield qid, {'qid': qid, 'qrels': qrels[qid]}
|
| 174 |
|
| 175 |
-
elif split == 'topics':
|
| 176 |
topics_file = csv.reader(open(file), delimiter="\t")
|
| 177 |
topics = defaultdict(list)
|
| 178 |
for row in topics_file:
|
|
|
|
| 48 |
_URL = "https://huggingface.co/datasets/uva-irlab/trec-cast-2019-multi-turn/resolve/main/"
|
| 49 |
_URLs = {
|
| 50 |
'topics': _URL+"cast2019_test_annotated.tsv",
|
| 51 |
+
'topics_with_context': _URL+"cast2019_test_annotated_with_context.tsv",
|
| 52 |
'qrels': _URL+"2019qrels.txt",
|
| 53 |
'test_collection': {
|
| 54 |
'car': "http://trec-car.cs.unh.edu/datareleases/v2.0/paragraphCorpus.v2.0.tar.xz",
|
|
|
|
| 77 |
version=VERSION,
|
| 78 |
description=""),
|
| 79 |
datasets.BuilderConfig(name="topics",
|
| 80 |
+
version="1.0.1",
|
| 81 |
description="The topics contain the queries, query IDs and their history."),
|
| 82 |
+
datasets.BuilderConfig(name="topics_with_context",
|
| 83 |
+
version=VERSION,
|
| 84 |
+
description="The topics contain the queries with relevant terms from the history, query IDs and their history."),
|
| 85 |
datasets.BuilderConfig(name="test_collection",
|
| 86 |
version=VERSION,
|
| 87 |
description="The test collection will provide the passages of TREC CAR and MSMARCO"),
|
|
|
|
| 103 |
"query": datasets.Value("string"),
|
| 104 |
})
|
| 105 |
download_size = 1138032
|
| 106 |
+
elif self.config.name == "topics_with_context":
|
| 107 |
+
features = datasets.Features({
|
| 108 |
+
"qid": datasets.Value("string"),
|
| 109 |
+
"history": datasets.features.Sequence(feature=datasets.Value('string')),
|
| 110 |
+
"query": datasets.Value("string"),
|
| 111 |
+
})
|
| 112 |
elif self.config.name == "qrels":
|
| 113 |
features = datasets.Features({
|
| 114 |
"qid": datasets.Value("string"),
|
|
|
|
| 153 |
urlkey = 'test_collection' if self.config.name == 'test_collection_sample' else self.config.name
|
| 154 |
my_urls = _URLs[urlkey]
|
| 155 |
downloaded_files = dl_manager.download_and_extract(my_urls)
|
| 156 |
+
|
| 157 |
return [
|
| 158 |
datasets.SplitGenerator(
|
| 159 |
name=datasets.Split.TEST,
|
|
|
|
| 183 |
for qid in qrels.keys():
|
| 184 |
yield qid, {'qid': qid, 'qrels': qrels[qid]}
|
| 185 |
|
| 186 |
+
elif split == 'topics' or split == 'topics_with_context':
|
| 187 |
topics_file = csv.reader(open(file), delimiter="\t")
|
| 188 |
topics = defaultdict(list)
|
| 189 |
for row in topics_file:
|