Add dataset files
Browse files- README.md +3 -0
- data/label.txt +7 -0
- data/test.tsv +0 -0
- data/train.tsv +0 -0
- data/valid.tsv +0 -0
- klue-tc-dev-tsv.py +55 -0
README.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
This is a in-house development version of KLUE Topic Classification benchmark, as the test split is not released by the KLUE team.
|
2 |
+
|
3 |
+
We randomly split the original validation set (9,107 instances) into in-house validation set (5,107 instances) and the in-house test set (4,000 instances).
|
data/label.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
정치
|
2 |
+
세계
|
3 |
+
IT과학
|
4 |
+
스포츠
|
5 |
+
사회
|
6 |
+
경제
|
7 |
+
생활문화
|
data/test.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/train.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/valid.tsv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
klue-tc-dev-tsv.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import absolute_import, division, print_function
|
2 |
+
import datasets
|
3 |
+
_URL = "data/"
|
4 |
+
_URLs = {
|
5 |
+
"train": _URL + "train.tsv",
|
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 (Dev Split)",
|
16 |
+
features=datasets.Features(
|
17 |
+
{
|
18 |
+
"text": datasets.Value("string"),
|
19 |
+
"label": datasets.features.ClassLabel(names=['정치', '세계', 'IT과학', '스포츠', '사회', '경제', '생활문화']),
|
20 |
+
}
|
21 |
+
),
|
22 |
+
supervised_keys=None,
|
23 |
+
license="",
|
24 |
+
homepage="",
|
25 |
+
citation="",
|
26 |
+
)
|
27 |
+
|
28 |
+
def _split_generators(self, dl_manager):
|
29 |
+
downloaded_files = dl_manager.download_and_extract(_URLs)
|
30 |
+
return [
|
31 |
+
datasets.SplitGenerator(
|
32 |
+
name=datasets.Split.TRAIN,
|
33 |
+
gen_kwargs={
|
34 |
+
"filepath": downloaded_files["train"],
|
35 |
+
}
|
36 |
+
),
|
37 |
+
datasets.SplitGenerator(
|
38 |
+
name=datasets.Split.VALIDATION,
|
39 |
+
gen_kwargs={
|
40 |
+
"filepath": downloaded_files["valid"],
|
41 |
+
}
|
42 |
+
),
|
43 |
+
datasets.SplitGenerator(
|
44 |
+
name=datasets.Split.TEST,
|
45 |
+
gen_kwargs={
|
46 |
+
"filepath": downloaded_files["test"],
|
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()}
|