Datasets:
Update magpie.py
Browse files
magpie.py
CHANGED
@@ -107,19 +107,17 @@ class Magpie(datasets.GeneratorBasedBuilder):
|
|
107 |
name=datasets.Split.TRAIN,
|
108 |
gen_kwargs={
|
109 |
"filepath": data_file,
|
110 |
-
"split": "train",
|
111 |
"features": self.config.features,
|
112 |
},
|
113 |
),
|
114 |
]
|
115 |
|
116 |
-
def _generate_examples(self, filepath: str,
|
117 |
"""Yields examples as (key, example) tuples."""
|
118 |
with open(filepath, encoding="utf8") as f:
|
119 |
for id_, row in enumerate(f):
|
120 |
if id_ == 0:
|
121 |
continue
|
122 |
-
ex_split = None
|
123 |
fields = row.strip().split("\t")
|
124 |
if len(fields) < 5:
|
125 |
fields[1] = True if fields[1] == "yes" else False
|
|
|
107 |
name=datasets.Split.TRAIN,
|
108 |
gen_kwargs={
|
109 |
"filepath": data_file,
|
|
|
110 |
"features": self.config.features,
|
111 |
},
|
112 |
),
|
113 |
]
|
114 |
|
115 |
+
def _generate_examples(self, filepath: str, features: List[str]):
|
116 |
"""Yields examples as (key, example) tuples."""
|
117 |
with open(filepath, encoding="utf8") as f:
|
118 |
for id_, row in enumerate(f):
|
119 |
if id_ == 0:
|
120 |
continue
|
|
|
121 |
fields = row.strip().split("\t")
|
122 |
if len(fields) < 5:
|
123 |
fields[1] = True if fields[1] == "yes" else False
|