Upload 3 files
Browse files- corpus.jsonl.gz +3 -0
- gis-pl.py +57 -0
- queries.jsonl.gz +3 -0
corpus.jsonl.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:48b31e8ab4438f5ffd1d95988732b95186f2f564dc3ac522dc5f3d2b08c3e643
|
3 |
+
size 15801571
|
gis-pl.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import csv
|
3 |
+
import os
|
4 |
+
import datasets
|
5 |
+
|
6 |
+
logger = datasets.logging.get_logger(__name__)
|
7 |
+
|
8 |
+
_DESCRIPTION = "cqadupstack gis Dataset"
|
9 |
+
_SPLITS = ["corpus", "queries"]
|
10 |
+
|
11 |
+
URL = ""
|
12 |
+
_URLs = {subset: URL + f"{subset}.jsonl.gz" for subset in _SPLITS}
|
13 |
+
|
14 |
+
class Gis(datasets.GeneratorBasedBuilder):
|
15 |
+
|
16 |
+
BUILDER_CONFIGS = [
|
17 |
+
datasets.BuilderConfig(
|
18 |
+
name=name,
|
19 |
+
description=f"This is the {name} in the BEIR-PL dataset.",
|
20 |
+
) for name in _SPLITS
|
21 |
+
]
|
22 |
+
|
23 |
+
def _info(self):
|
24 |
+
|
25 |
+
return datasets.DatasetInfo(
|
26 |
+
description=_DESCRIPTION,
|
27 |
+
features=datasets.Features({
|
28 |
+
"_id": datasets.Value("string"),
|
29 |
+
"title": datasets.Value("string"),
|
30 |
+
"text": datasets.Value("string"),
|
31 |
+
}),
|
32 |
+
supervised_keys=None,
|
33 |
+
)
|
34 |
+
|
35 |
+
def _split_generators(self, dl_manager):
|
36 |
+
"""Returns SplitGenerators."""
|
37 |
+
|
38 |
+
my_urls = _URLs[self.config.name]
|
39 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
40 |
+
|
41 |
+
return [
|
42 |
+
datasets.SplitGenerator(
|
43 |
+
name=self.config.name,
|
44 |
+
# These kwargs will be passed to _generate_examples
|
45 |
+
gen_kwargs={"filepath": data_dir},
|
46 |
+
),
|
47 |
+
]
|
48 |
+
|
49 |
+
def _generate_examples(self, filepath):
|
50 |
+
"""Yields examples."""
|
51 |
+
with open(filepath, encoding="utf-8") as f:
|
52 |
+
texts = f.readlines()
|
53 |
+
for i, text in enumerate(texts):
|
54 |
+
text = json.loads(text)
|
55 |
+
if 'metadata' in text: del text['metadata']
|
56 |
+
if "title" not in text: text["title"] = ""
|
57 |
+
yield i, text
|
queries.jsonl.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:64e7b9f5b573d3e4ad97dff54157e22f7491a243470035ad48431bc243d90090
|
3 |
+
size 235364563
|