Delete fever-span-annotated.py
Browse files- fever-span-annotated.py +0 -60
fever-span-annotated.py
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
import gzip
|
2 |
-
import pandas as pd
|
3 |
-
import datasets
|
4 |
-
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split
|
5 |
-
import csv
|
6 |
-
from itertools import islice
|
7 |
-
|
8 |
-
class FeverDataset(GeneratorBasedBuilder):
|
9 |
-
VERSION = "1.0.0"
|
10 |
-
_URLS = [
|
11 |
-
"https://huggingface.co/datasets/jinaai/fever-span-annotated/resolve/main/data/fever-pairs_shard_000000.tsv.gz",
|
12 |
-
"https://huggingface.co/datasets/jinaai/fever-span-annotated/resolve/main/data/fever-pairs_shard_000001.tsv.gz",
|
13 |
-
"https://huggingface.co/datasets/jinaai/fever-span-annotated/resolve/main/data/fever-pairs_shard_000002.tsv.gz",
|
14 |
-
"https://huggingface.co/datasets/jinaai/fever-span-annotated/resolve/main/data/fever-pairs_shard_000003.tsv.gz",
|
15 |
-
"https://huggingface.co/datasets/jinaai/fever-span-annotated/resolve/main/data/fever-pairs_shard_000004.tsv.gz",
|
16 |
-
]
|
17 |
-
|
18 |
-
def _info(self):
|
19 |
-
return DatasetInfo(
|
20 |
-
description="FEVER Dataset with span annotations.",
|
21 |
-
features=datasets.Features({
|
22 |
-
"query": datasets.Value("string"),
|
23 |
-
"document": datasets.Value("string"),
|
24 |
-
"spans": datasets.Value("string"),
|
25 |
-
}),
|
26 |
-
supervised_keys=None,
|
27 |
-
homepage="https://huggingface.co/datasets/jinaai/fever-span-annotated",
|
28 |
-
license="CC BY 4.0",
|
29 |
-
splits={
|
30 |
-
"test": {"num_bytes": 0}, # Placeholder, will be updated later
|
31 |
-
},
|
32 |
-
dataset_size=0,
|
33 |
-
download_size=0
|
34 |
-
)
|
35 |
-
|
36 |
-
def _split_generators(self, dl_manager):
|
37 |
-
urls_to_download = self._URLS
|
38 |
-
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
39 |
-
|
40 |
-
return [
|
41 |
-
SplitGenerator(
|
42 |
-
name=Split.TEST,
|
43 |
-
gen_kwargs={"file_paths": downloaded_files},
|
44 |
-
),
|
45 |
-
]
|
46 |
-
|
47 |
-
def _generate_examples(self, file_paths):
|
48 |
-
for file_path in file_paths:
|
49 |
-
with gzip.open(file_path, 'rt') as file:
|
50 |
-
reader = csv.reader(
|
51 |
-
file,
|
52 |
-
dialect='excel-tab' if self._dialect == 'tsv' else 'excel',
|
53 |
-
)
|
54 |
-
for row in islice(reader, self._current_index, None, self._stride):
|
55 |
-
if len(row) >= 3:
|
56 |
-
yield row[0], {
|
57 |
-
"query": row[0],
|
58 |
-
"document": row[1],
|
59 |
-
"spans": row[2],
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|