lara-martin
commited on
Commit
•
f3b066d
1
Parent(s):
1d7219d
Update Scifi_TV_Shows.py
Browse files- Scifi_TV_Shows.py +27 -17
Scifi_TV_Shows.py
CHANGED
@@ -55,12 +55,12 @@ class ScifiTV(datasets.GeneratorBasedBuilder):
|
|
55 |
|
56 |
def _info(self):
|
57 |
features = datasets.Features({
|
58 |
-
'event': datasets.Value('
|
59 |
-
'gen_event': datasets.Value('
|
60 |
'sent': datasets.Value('string'),
|
61 |
'gen_sent': datasets.Value('string'),
|
62 |
-
'story_num': datasets.Value('
|
63 |
-
'entities': datasets.Value('
|
64 |
})
|
65 |
|
66 |
return datasets.DatasetInfo(
|
@@ -79,18 +79,29 @@ class ScifiTV(datasets.GeneratorBasedBuilder):
|
|
79 |
|
80 |
def _split_generators(self, dl_manager):
|
81 |
downloaded_files = dl_manager.download(_URLS)
|
82 |
-
|
83 |
-
for datatype in _URLS.keys():
|
84 |
-
splits.append(
|
85 |
datasets.SplitGenerator(
|
86 |
-
name=
|
87 |
gen_kwargs={
|
88 |
-
'filepath': downloaded_files[
|
89 |
-
"
|
90 |
},
|
91 |
-
)
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
def _generate_examples(self, filepath):
|
96 |
story_count = 0
|
@@ -102,11 +113,10 @@ class ScifiTV(datasets.GeneratorBasedBuilder):
|
|
102 |
for l in story:
|
103 |
event, gen_event, sent, gen_sent = l.split("|||")
|
104 |
line = line.replace("%%%%%%%%%%%%%%%%%", "")
|
105 |
-
|
106 |
-
entities = eval(line)
|
107 |
yield id_, {
|
108 |
-
'event':
|
109 |
-
'gen_event':
|
110 |
'sent': sent,
|
111 |
'gen_sent': gen_sent,
|
112 |
'story_num': story_count,
|
|
|
55 |
|
56 |
def _info(self):
|
57 |
features = datasets.Features({
|
58 |
+
'event': datasets.Value('string'),
|
59 |
+
'gen_event': datasets.Value('string'),
|
60 |
'sent': datasets.Value('string'),
|
61 |
'gen_sent': datasets.Value('string'),
|
62 |
+
'story_num': datasets.Value('int16'),
|
63 |
+
'entities': datasets.Value('string')
|
64 |
})
|
65 |
|
66 |
return datasets.DatasetInfo(
|
|
|
79 |
|
80 |
def _split_generators(self, dl_manager):
|
81 |
downloaded_files = dl_manager.download(_URLS)
|
82 |
+
return[
|
|
|
|
|
83 |
datasets.SplitGenerator(
|
84 |
+
name=datasets.Split.TRAIN,
|
85 |
gen_kwargs={
|
86 |
+
'filepath': downloaded_files['train'],
|
87 |
+
"split": "train",
|
88 |
},
|
89 |
+
),
|
90 |
+
datasets.SplitGenerator(
|
91 |
+
name=datasets.Split.TEST,
|
92 |
+
gen_kwargs={
|
93 |
+
'filepath': downloaded_files['test'],
|
94 |
+
"split": "test",
|
95 |
+
},
|
96 |
+
),
|
97 |
+
datasets.SplitGenerator(
|
98 |
+
name=datasets.Split.VALIDATION,
|
99 |
+
gen_kwargs={
|
100 |
+
'filepath': downloaded_files['val'],
|
101 |
+
"split": "val",
|
102 |
+
},
|
103 |
+
),
|
104 |
+
]
|
105 |
|
106 |
def _generate_examples(self, filepath):
|
107 |
story_count = 0
|
|
|
113 |
for l in story:
|
114 |
event, gen_event, sent, gen_sent = l.split("|||")
|
115 |
line = line.replace("%%%%%%%%%%%%%%%%%", "")
|
116 |
+
entities = line.replace("defaultdict(<type 'list'>, ", "")[:-1]
|
|
|
117 |
yield id_, {
|
118 |
+
'event': event,
|
119 |
+
'gen_event': gen_event,
|
120 |
'sent': sent,
|
121 |
'gen_sent': gen_sent,
|
122 |
'story_num': story_count,
|