Fix format
Browse files- klue-tc-tsv.py +7 -2
klue-tc-tsv.py
CHANGED
@@ -6,7 +6,10 @@ _URLs = {
|
|
6 |
"valid": _URL + "valid.tsv",
|
7 |
"test": _URL + "test.tsv",
|
8 |
}
|
|
|
|
|
9 |
class KlueTC(datasets.GeneratorBasedBuilder):
|
|
|
10 |
def _info(self):
|
11 |
return datasets.DatasetInfo(
|
12 |
description="KLUE Topic Classification",
|
@@ -21,6 +24,7 @@ class KlueTC(datasets.GeneratorBasedBuilder):
|
|
21 |
homepage="",
|
22 |
citation="",
|
23 |
)
|
|
|
24 |
def _split_generators(self, dl_manager):
|
25 |
downloaded_files = dl_manager.download_and_extract(_URLs)
|
26 |
return [
|
@@ -43,8 +47,9 @@ class KlueTC(datasets.GeneratorBasedBuilder):
|
|
43 |
}
|
44 |
),
|
45 |
]
|
|
|
46 |
def _generate_examples(self, filepath):
|
47 |
-
with open(filepath, "r", encoding='
|
48 |
for idx, line in enumerate(f):
|
49 |
-
text, label = line.split("
|
50 |
yield idx, {"text": text.strip(), "label": label.strip()}
|
|
|
6 |
"valid": _URL + "valid.tsv",
|
7 |
"test": _URL + "test.tsv",
|
8 |
}
|
9 |
+
|
10 |
+
|
11 |
class KlueTC(datasets.GeneratorBasedBuilder):
|
12 |
+
|
13 |
def _info(self):
|
14 |
return datasets.DatasetInfo(
|
15 |
description="KLUE Topic Classification",
|
|
|
24 |
homepage="",
|
25 |
citation="",
|
26 |
)
|
27 |
+
|
28 |
def _split_generators(self, dl_manager):
|
29 |
downloaded_files = dl_manager.download_and_extract(_URLs)
|
30 |
return [
|
|
|
47 |
}
|
48 |
),
|
49 |
]
|
50 |
+
|
51 |
def _generate_examples(self, filepath):
|
52 |
+
with open(filepath, "r", encoding='UTF-8') as f:
|
53 |
for idx, line in enumerate(f):
|
54 |
+
text, label = line.split("\\t")
|
55 |
yield idx, {"text": text.strip(), "label": label.strip()}
|