lara-martin commited on
Commit
f3b066d
1 Parent(s): 1d7219d

Update Scifi_TV_Shows.py

Browse files
Files changed (1) hide show
  1. 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('list'),
59
- 'gen_event': datasets.Value('list'),
60
  'sent': datasets.Value('string'),
61
  'gen_sent': datasets.Value('string'),
62
- 'story_num': datasets.Value('int'),
63
- 'entities': datasets.Value('dict')
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
- 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
- "files": dl_manager.iter_archive(archive),
90
  },
91
- )
92
- )
93
- return splits
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- line = line.replace("defaultdict(<type 'list'>, ", "")[:-1]
106
- entities = eval(line)
107
  yield id_, {
108
- 'event': eval(event),
109
- 'gen_event': eval(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,