Datasets:
Commit
·
dea761a
1
Parent(s):
0b12f60
fix(tsv): skip empty lines
Browse files- mvl-sib200.py +8 -0
mvl-sib200.py
CHANGED
@@ -8,6 +8,8 @@ import datasets
|
|
8 |
import numpy as np
|
9 |
import pandas as pd
|
10 |
|
|
|
|
|
11 |
# fmt: off
|
12 |
LANGS = [
|
13 |
"ace_Arab", "ace_Latn", "acm_Arab", "acq_Arab", "aeb_Arab", "afr_Latn", "ajp_Arab",
|
@@ -136,6 +138,12 @@ def read_tsv_to_dict_list(file_path: Union[str, Path]) -> List[Dict[str, Any]]:
|
|
136 |
|
137 |
# Start enumerating from line 2 to account for the header line
|
138 |
for _, row in enumerate(reader, start=2):
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
# Convert index_id to integer
|
140 |
index_id = int(row["index_id"])
|
141 |
# Strip leading/trailing whitespace
|
|
|
8 |
import numpy as np
|
9 |
import pandas as pd
|
10 |
|
11 |
+
file_path = "/network/scratch/s/schmidtf/.cache/huggingface/hub/datasets--wuenlp--mvl-sib200/snapshots/0b12f60218de86836d2f048f12b13b8eb7ab7ac2/data/sib200/arb_Latn/train.tsv"
|
12 |
+
|
13 |
# fmt: off
|
14 |
LANGS = [
|
15 |
"ace_Arab", "ace_Latn", "acm_Arab", "acq_Arab", "aeb_Arab", "afr_Latn", "ajp_Arab",
|
|
|
138 |
|
139 |
# Start enumerating from line 2 to account for the header line
|
140 |
for _, row in enumerate(reader, start=2):
|
141 |
+
#
|
142 |
+
if all(
|
143 |
+
(row[key].strip() == key) or (row[key].strip() == "")
|
144 |
+
for key in expected_headers
|
145 |
+
):
|
146 |
+
continue
|
147 |
# Convert index_id to integer
|
148 |
index_id = int(row["index_id"])
|
149 |
# Strip leading/trailing whitespace
|