lara-martin commited on
Commit
d0ddbcf
1 Parent(s): e3472b5

Update Scifi_TV_Shows.py

Browse files
Files changed (1) hide show
  1. Scifi_TV_Shows.py +15 -13
Scifi_TV_Shows.py CHANGED
@@ -78,24 +78,25 @@ class ScifiTV(datasets.GeneratorBasedBuilder):
78
  )
79
 
80
  def _split_generators(self, dl_manager):
81
- data = self.config.name
82
  downloaded_files = dl_manager.download(_URLS)
83
-
84
- splits = [
85
- datasets.SplitGenerator(
86
- name=data,
87
- gen_kwargs={
88
- 'filepath': downloaded_files[data],
89
- },
90
- ),
91
- ]
 
92
  return splits
93
 
94
  def _generate_examples(self, filepath):
95
  story_count = 0
96
  with open(filepath, encoding="utf-8") as f:
97
  story = []
98
- for id_, line in enumerate(f):
 
99
  if "%%%%%%" in line:
100
  for l in story:
101
  event, gen_event, sent, gen_sent = l.split("|||")
@@ -112,8 +113,9 @@ class ScifiTV(datasets.GeneratorBasedBuilder):
112
  }
113
  story = []
114
  story_count+=1
115
- elif "<EOS>" in line: continue
 
116
  else:
117
- story.append(line.strip())
118
 
119
 
 
78
  )
79
 
80
  def _split_generators(self, dl_manager):
 
81
  downloaded_files = dl_manager.download(_URLS)
82
+ splits = []
83
+ for datatype in _URLS.keys():
84
+ splits.append(
85
+ datasets.SplitGenerator(
86
+ name=datatype,
87
+ gen_kwargs={
88
+ 'filepath': downloaded_files[datatype],
89
+ },
90
+ )
91
+ )
92
  return splits
93
 
94
  def _generate_examples(self, filepath):
95
  story_count = 0
96
  with open(filepath, encoding="utf-8") as f:
97
  story = []
98
+ for id_, line in enumerate(f.readlines()):
99
+ line = line.strip()
100
  if "%%%%%%" in line:
101
  for l in story:
102
  event, gen_event, sent, gen_sent = l.split("|||")
 
113
  }
114
  story = []
115
  story_count+=1
116
+ elif "<EOS>" in line:
117
+ continue
118
  else:
119
+ story.append(line)
120
 
121