Datasets:
Languages:
Portuguese
License:
leonardo-avila
commited on
Commit
•
80d91ba
1
Parent(s):
f603b37
Update fiqa_pt.py
Browse files- fiqa_pt.py +19 -19
fiqa_pt.py
CHANGED
@@ -1,31 +1,28 @@
|
|
1 |
import csv
|
2 |
import json
|
3 |
import os
|
4 |
-
|
5 |
import datasets
|
6 |
|
7 |
-
_DESCRIPTION = ""
|
8 |
-
|
9 |
-
"""
|
10 |
|
11 |
_URLS = {
|
12 |
-
"corpus": "
|
13 |
-
"topics": "
|
14 |
-
"qrel": "
|
15 |
}
|
16 |
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
|
|
21 |
|
22 |
-
# You will be able to load one or the other configurations in the following list with
|
23 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
24 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
25 |
BUILDER_CONFIGS = [
|
26 |
-
datasets.BuilderConfig(
|
27 |
-
|
28 |
-
|
|
|
29 |
]
|
30 |
|
31 |
def _info(self):
|
@@ -51,8 +48,11 @@ class BeirPT(datasets.GeneratorBasedBuilder):
|
|
51 |
)
|
52 |
|
53 |
def _split_generators(self, dl_manager):
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
return [
|
57 |
datasets.SplitGenerator(
|
58 |
name=self.config.name,
|
@@ -62,7 +62,7 @@ class BeirPT(datasets.GeneratorBasedBuilder):
|
|
62 |
]
|
63 |
|
64 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
65 |
-
def _generate_examples(self, filepath
|
66 |
with open(filepath, encoding="utf-8") as f:
|
67 |
if self.config.name in ["corpus", "topics"]:
|
68 |
for line in f:
|
|
|
1 |
import csv
|
2 |
import json
|
3 |
import os
|
|
|
4 |
import datasets
|
5 |
|
6 |
+
_DESCRIPTION = "FIQA Dataset"
|
7 |
+
_SPLITS = ["corpus", "topics", "qrel"]
|
|
|
8 |
|
9 |
_URLS = {
|
10 |
+
"corpus": "corpus_pt.tsv",
|
11 |
+
"topics": "topics_pt.tsv",
|
12 |
+
"qrel": "qrel.tsv",
|
13 |
}
|
14 |
|
15 |
+
URL = ""
|
16 |
+
_URLs = {subset: URL + _URLS[subset] for subset in _SPLITS}
|
17 |
|
18 |
+
class BEIR(datasets.GeneratorBasedBuilder):
|
19 |
+
"""BEIR BenchmarkDataset."""
|
20 |
|
|
|
|
|
|
|
21 |
BUILDER_CONFIGS = [
|
22 |
+
datasets.BuilderConfig(
|
23 |
+
name=name,
|
24 |
+
description=f"This is the {name} in the FiQA dataset.",
|
25 |
+
) for name in _SPLITS
|
26 |
]
|
27 |
|
28 |
def _info(self):
|
|
|
48 |
)
|
49 |
|
50 |
def _split_generators(self, dl_manager):
|
51 |
+
"""Returns SplitGenerators."""
|
52 |
+
|
53 |
+
my_urls = _URLs[self.config.name]
|
54 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
55 |
+
|
56 |
return [
|
57 |
datasets.SplitGenerator(
|
58 |
name=self.config.name,
|
|
|
62 |
]
|
63 |
|
64 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
65 |
+
def _generate_examples(self, filepath):
|
66 |
with open(filepath, encoding="utf-8") as f:
|
67 |
if self.config.name in ["corpus", "topics"]:
|
68 |
for line in f:
|