王子傲 commited on
Commit
c3dc4fd
·
1 Parent(s): ef8cbd1
Files changed (1) hide show
  1. roc_stories.py +9 -7
roc_stories.py CHANGED
@@ -130,11 +130,13 @@ class RocStories(datasets.GeneratorBasedBuilder):
130
  def _generate_examples(self, filepath, split):
131
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
132
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
133
- df = pd.read_csv(filepath)
134
- for index, row in df.iterrows():
135
- yield index, {
136
- "storyid": row["storyid"],
137
- "storytitle": row["storytitle"],
138
- "story": row["sentence1"] + ' ' + row["sentence2"] + ' ' + row["sentence3"] + ' ' + row["sentence4"] + ' ' + row["sentence5"],
139
- }
 
 
140
 
 
130
  def _generate_examples(self, filepath, split):
131
  # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
132
  # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
133
+
134
+ for file_name in filepath:
135
+ df = pd.read_csv(filepath)
136
+ for index, row in df.iterrows():
137
+ yield index, {
138
+ "storyid": row["storyid"],
139
+ "storytitle": row["storytitle"],
140
+ "story": row["sentence1"] + ' ' + row["sentence2"] + ' ' + row["sentence3"] + ' ' + row["sentence4"] + ' ' + row["sentence5"],
141
+ }
142