Delete AMIsum.py
Browse files
AMIsum.py
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import datasets
|
3 |
-
|
4 |
-
|
5 |
-
class ERRNewsConfig(datasets.BuilderConfig):
|
6 |
-
def __init__(self, features, **kwargs):
|
7 |
-
super().__init__(version=datasets.Version("1.0.0"), **kwargs)
|
8 |
-
self.features = features
|
9 |
-
|
10 |
-
|
11 |
-
class ERRNews(datasets.GeneratorBasedBuilder):
|
12 |
-
features = ["transcript", "summary", "id"]
|
13 |
-
|
14 |
-
BUILDER_CONFIGS = [
|
15 |
-
ERRNewsConfig(
|
16 |
-
name="full",
|
17 |
-
features=features
|
18 |
-
)
|
19 |
-
]
|
20 |
-
|
21 |
-
DEFAULT_CONFIG_NAME = "full"
|
22 |
-
|
23 |
-
def _info(self):
|
24 |
-
features = datasets.Features(
|
25 |
-
{
|
26 |
-
"transcript": datasets.Value("string"),
|
27 |
-
"summary": datasets.Value("string"),
|
28 |
-
"id": datasets.Value("string"),
|
29 |
-
})
|
30 |
-
|
31 |
-
return datasets.DatasetInfo(
|
32 |
-
features=features,
|
33 |
-
supervised_keys=None,
|
34 |
-
version=self.config.version,
|
35 |
-
)
|
36 |
-
|
37 |
-
def _split_generators(self, dl_manager):
|
38 |
-
"""Returns SplitGenerators."""
|
39 |
-
train = ".\train.json"
|
40 |
-
test = ".\test.json"
|
41 |
-
val = ".\val.json"
|
42 |
-
|
43 |
-
return [
|
44 |
-
datasets.SplitGenerator(
|
45 |
-
name=datasets.Split.TRAIN,
|
46 |
-
gen_kwargs={
|
47 |
-
"file_path": train,
|
48 |
-
},
|
49 |
-
),
|
50 |
-
datasets.SplitGenerator(
|
51 |
-
name=datasets.Split.VALIDATION,
|
52 |
-
gen_kwargs={
|
53 |
-
"file_path": val,
|
54 |
-
},
|
55 |
-
),
|
56 |
-
datasets.SplitGenerator(
|
57 |
-
name=datasets.Split.TEST,
|
58 |
-
gen_kwargs={
|
59 |
-
"file_path": test,
|
60 |
-
},
|
61 |
-
),
|
62 |
-
]
|
63 |
-
|
64 |
-
def create_dict(self, data):
|
65 |
-
res = dict()
|
66 |
-
for key in self.config.features:
|
67 |
-
res[key] = data[key]
|
68 |
-
return res
|
69 |
-
|
70 |
-
def _generate_examples(self, file_path):
|
71 |
-
with open(file_path) as f:
|
72 |
-
data = json.load(f)
|
73 |
-
for idx, transcript in enumerate(data["transcript"]):
|
74 |
-
id_ = data["id"][idx]
|
75 |
-
yield id_, {
|
76 |
-
"transcript": transcript,
|
77 |
-
"summary": data["summary"][idx],
|
78 |
-
"id": id_,
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|