Rachel Wicks
commited on
Commit
·
7752c7f
1
Parent(s):
3b16600
change split name and file reading
Browse files- paradocs.py +5 -3
paradocs.py
CHANGED
@@ -111,7 +111,7 @@ class ParaDocs(datasets.GeneratorBasedBuilder):
|
|
111 |
|
112 |
return [
|
113 |
datasets.SplitGenerator(
|
114 |
-
name="
|
115 |
gen_kwargs={
|
116 |
"filepaths": dl_manager.download(data_sources[lang])
|
117 |
}
|
@@ -139,7 +139,7 @@ class ParaDocs(datasets.GeneratorBasedBuilder):
|
|
139 |
for filepath in filepaths:
|
140 |
# logger.info("Generating examples from = %s", filepath)
|
141 |
try:
|
142 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
143 |
rstream = csv.DictReader(f,
|
144 |
delimiter='\t',
|
145 |
fieldnames = [
|
@@ -166,5 +166,7 @@ class ParaDocs(datasets.GeneratorBasedBuilder):
|
|
166 |
for example in rstream:
|
167 |
yield id_, example
|
168 |
id_ += 1
|
169 |
-
except:
|
|
|
170 |
print("Error reading file:", filepath)
|
|
|
|
111 |
|
112 |
return [
|
113 |
datasets.SplitGenerator(
|
114 |
+
name="train",
|
115 |
gen_kwargs={
|
116 |
"filepaths": dl_manager.download(data_sources[lang])
|
117 |
}
|
|
|
139 |
for filepath in filepaths:
|
140 |
# logger.info("Generating examples from = %s", filepath)
|
141 |
try:
|
142 |
+
with xz.open(filepath, "r", encoding="utf-8") as f:
|
143 |
rstream = csv.DictReader(f,
|
144 |
delimiter='\t',
|
145 |
fieldnames = [
|
|
|
166 |
for example in rstream:
|
167 |
yield id_, example
|
168 |
id_ += 1
|
169 |
+
except Exception as e:
|
170 |
+
print(e, filepath)
|
171 |
print("Error reading file:", filepath)
|
172 |
+
|