王子傲
commited on
Commit
·
c3dc4fd
1
Parent(s):
ef8cbd1
load fix
Browse files- 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 |
-
|
134 |
-
for
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
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 |
|