Datasets:
Tasks:
Token Classification
Modalities:
Text
Formats:
parquet
Languages:
Thai
Size:
100K - 1M
Tags:
word-tokenization
License:
Convert dataset to Parquet
#3
by
albertvillanova
HF staff
- opened
- README.md +13 -5
- best2009.py +0 -138
- best2009/test-00000-of-00001.parquet +3 -0
- best2009/train-00000-of-00001.parquet +3 -0
- dataset_infos.json +0 -1
README.md
CHANGED
@@ -20,6 +20,7 @@ pretty_name: best2009
|
|
20 |
tags:
|
21 |
- word-tokenization
|
22 |
dataset_info:
|
|
|
23 |
features:
|
24 |
- name: fname
|
25 |
dtype: string
|
@@ -47,16 +48,23 @@ dataset_info:
|
|
47 |
names:
|
48 |
'0': neg
|
49 |
'1': pos
|
50 |
-
config_name: best2009
|
51 |
splits:
|
52 |
- name: train
|
53 |
-
num_bytes:
|
54 |
num_examples: 148995
|
55 |
- name: test
|
56 |
-
num_bytes:
|
57 |
num_examples: 2252
|
58 |
-
download_size:
|
59 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
---
|
61 |
|
62 |
# Dataset Card for `best2009`
|
|
|
20 |
tags:
|
21 |
- word-tokenization
|
22 |
dataset_info:
|
23 |
+
config_name: best2009
|
24 |
features:
|
25 |
- name: fname
|
26 |
dtype: string
|
|
|
48 |
names:
|
49 |
'0': neg
|
50 |
'1': pos
|
|
|
51 |
splits:
|
52 |
- name: train
|
53 |
+
num_bytes: 483129698
|
54 |
num_examples: 148995
|
55 |
- name: test
|
56 |
+
num_bytes: 10498706
|
57 |
num_examples: 2252
|
58 |
+
download_size: 28084787
|
59 |
+
dataset_size: 493628404
|
60 |
+
configs:
|
61 |
+
- config_name: best2009
|
62 |
+
data_files:
|
63 |
+
- split: train
|
64 |
+
path: best2009/train-*
|
65 |
+
- split: test
|
66 |
+
path: best2009/test-*
|
67 |
+
default: true
|
68 |
---
|
69 |
|
70 |
# Dataset Card for `best2009`
|
best2009.py
DELETED
@@ -1,138 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from functools import reduce
|
3 |
-
from pathlib import Path
|
4 |
-
|
5 |
-
import datasets
|
6 |
-
|
7 |
-
|
8 |
-
_CITATION = """\
|
9 |
-
@inproceedings{kosawat2009best,
|
10 |
-
title={BEST 2009: Thai word segmentation software contest},
|
11 |
-
author={Kosawat, Krit and Boriboon, Monthika and Chootrakool, Patcharika and Chotimongkol, Ananlada and Klaithin, Supon and Kongyoung, Sarawoot and Kriengket, Kanyanut and Phaholphinyo, Sitthaa and Purodakananda, Sumonmas and Thanakulwarapas, Tipraporn and others},
|
12 |
-
booktitle={2009 Eighth International Symposium on Natural Language Processing},
|
13 |
-
pages={83--88},
|
14 |
-
year={2009},
|
15 |
-
organization={IEEE}
|
16 |
-
}
|
17 |
-
@inproceedings{boriboon2009best,
|
18 |
-
title={Best corpus development and analysis},
|
19 |
-
author={Boriboon, Monthika and Kriengket, Kanyanut and Chootrakool, Patcharika and Phaholphinyo, Sitthaa and Purodakananda, Sumonmas and Thanakulwarapas, Tipraporn and Kosawat, Krit},
|
20 |
-
booktitle={2009 International Conference on Asian Language Processing},
|
21 |
-
pages={322--327},
|
22 |
-
year={2009},
|
23 |
-
organization={IEEE}
|
24 |
-
}
|
25 |
-
"""
|
26 |
-
|
27 |
-
_LICENSE = "CC-BY-NC-SA 3.0"
|
28 |
-
|
29 |
-
_DESCRIPTION = """\
|
30 |
-
`best2009` is a Thai word-tokenization dataset from encyclopedia, novels, news and articles by
|
31 |
-
[NECTEC](https://www.nectec.or.th/) (148,995/2,252 lines of train/test). It was created for
|
32 |
-
[BEST 2010: Word Tokenization Competition](https://thailang.nectec.or.th/archive/indexa290.html?q=node/10).
|
33 |
-
The test set answers are not provided publicly.
|
34 |
-
"""
|
35 |
-
|
36 |
-
|
37 |
-
class Best2009Config(datasets.BuilderConfig):
|
38 |
-
def __init__(self, **kwargs):
|
39 |
-
"""BuilderConfig
|
40 |
-
|
41 |
-
Args:
|
42 |
-
**kwargs: keyword arguments forwarded to super.
|
43 |
-
"""
|
44 |
-
super(Best2009Config, self).__init__(**kwargs)
|
45 |
-
|
46 |
-
|
47 |
-
class Best2009(datasets.GeneratorBasedBuilder):
|
48 |
-
|
49 |
-
_DOWNLOAD_URL = "https://archive.org/download/best_dataset/data.zip"
|
50 |
-
_TRAIN_FOLDER = "train"
|
51 |
-
_TEST_FOLDER = "test"
|
52 |
-
|
53 |
-
_USELESS_TAGS = {"<NE>": "", "</NE>": "", "<AB>": "", "</AB>": ""}
|
54 |
-
# character type mapping from https://github.com/rkcosmos/deepcut/blob/master/deepcut/utils.py
|
55 |
-
_CHAR_TYPES_DICT = {
|
56 |
-
"กขฃคฆงจชซญฎฏฐฑฒณดตถทธนบปพฟภมยรลวศษสฬอ": "c",
|
57 |
-
"ฅฉผฟฌหฮ": "n",
|
58 |
-
"ะาำิีืึุู": "v", # า ะ ำ ิ ี ึ ื ั ู ุ
|
59 |
-
"เแโใไ": "w",
|
60 |
-
"่้๊๋": "t", # วรรณยุกต์ ่ ้ ๊ ๋
|
61 |
-
"์ๆฯ.": "s", # ์ ๆ ฯ .
|
62 |
-
"0123456789๑๒๓๔๕๖๗๘๙": "d",
|
63 |
-
'"': "q",
|
64 |
-
"‘": "q",
|
65 |
-
"’": "q",
|
66 |
-
"'": "q",
|
67 |
-
" ": "p",
|
68 |
-
"abcdefghijklmnopqrstuvwxyz": "s_e",
|
69 |
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZ": "b_e",
|
70 |
-
}
|
71 |
-
_CHAR_TYPE_FLATTEN = {}
|
72 |
-
for ks, v in _CHAR_TYPES_DICT.items():
|
73 |
-
for k in ks:
|
74 |
-
_CHAR_TYPE_FLATTEN[k] = v
|
75 |
-
_CHAR_TYPES = ["b_e", "c", "d", "n", "o", "p", "q", "s", "s_e", "t", "v", "w"]
|
76 |
-
|
77 |
-
BUILDER_CONFIGS = [
|
78 |
-
Best2009Config(
|
79 |
-
name="best2009",
|
80 |
-
version=datasets.Version("1.0.0"),
|
81 |
-
description=_DESCRIPTION,
|
82 |
-
),
|
83 |
-
]
|
84 |
-
|
85 |
-
def _info(self):
|
86 |
-
return datasets.DatasetInfo(
|
87 |
-
description=_DESCRIPTION,
|
88 |
-
features=datasets.Features(
|
89 |
-
{
|
90 |
-
"fname": datasets.Value("string"),
|
91 |
-
"char": datasets.Sequence(datasets.Value("string")),
|
92 |
-
"char_type": datasets.Sequence(datasets.features.ClassLabel(names=self._CHAR_TYPES)),
|
93 |
-
"is_beginning": datasets.Sequence(datasets.features.ClassLabel(names=["neg", "pos"])),
|
94 |
-
}
|
95 |
-
),
|
96 |
-
supervised_keys=None,
|
97 |
-
homepage="https://aiforthai.in.th/",
|
98 |
-
citation=_CITATION,
|
99 |
-
license=_LICENSE,
|
100 |
-
)
|
101 |
-
|
102 |
-
def _split_generators(self, dl_manager):
|
103 |
-
arch_path = dl_manager.download_and_extract(self._DOWNLOAD_URL)
|
104 |
-
data_dir = os.path.join(arch_path, "data")
|
105 |
-
return [
|
106 |
-
datasets.SplitGenerator(
|
107 |
-
name=datasets.Split.TRAIN,
|
108 |
-
gen_kwargs={"filepath": os.path.join(data_dir, self._TRAIN_FOLDER), "split": "train"},
|
109 |
-
),
|
110 |
-
datasets.SplitGenerator(
|
111 |
-
name=datasets.Split.TEST,
|
112 |
-
gen_kwargs={"filepath": os.path.join(data_dir, self._TEST_FOLDER), "split": "train"},
|
113 |
-
),
|
114 |
-
]
|
115 |
-
|
116 |
-
def _generate_examples(self, filepath, split):
|
117 |
-
for file_idx, fname in enumerate(sorted(Path(filepath).rglob("*.txt"))):
|
118 |
-
with open(fname, encoding="utf-8") as f:
|
119 |
-
for line_idx, line in enumerate(f):
|
120 |
-
chars = []
|
121 |
-
char_types = []
|
122 |
-
is_beginnings = []
|
123 |
-
# replace useless tokens
|
124 |
-
line = reduce(lambda a, kv: a.replace(*kv), self._USELESS_TAGS.items(), line)
|
125 |
-
# tokens are pipe separated
|
126 |
-
splits = line.split("|")
|
127 |
-
for token in splits:
|
128 |
-
for i in range(len(token)):
|
129 |
-
chars.append(token[i])
|
130 |
-
char_types.append(self._CHAR_TYPE_FLATTEN.get(token[i], "o"))
|
131 |
-
is_beginning = 1 if i == 0 else 0
|
132 |
-
is_beginnings.append(is_beginning)
|
133 |
-
yield f"{file_idx}_{line_idx}", {
|
134 |
-
"fname": fname.name,
|
135 |
-
"char": chars,
|
136 |
-
"char_type": char_types,
|
137 |
-
"is_beginning": is_beginnings if split == "train" else [0 for i in range(len(chars))],
|
138 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
best2009/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4cd580b1e8f2761e72c587eae89c018fde26fe638537c9539fb796981ab1238a
|
3 |
+
size 493105
|
best2009/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8fcc077d023b90cb389f2ffd9341b4fb87f56c34cd7cd540ca0b4deff28e71f1
|
3 |
+
size 27591682
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"best2009": {"description": "`best2009` is a Thai word-tokenization dataset from encyclopedia, novels, news and articles by\n[NECTEC](https://www.nectec.or.th/) (148,995/2,252 lines of train/test). It was created for\n[BEST 2010: Word Tokenization Competition](https://thailang.nectec.or.th/archive/indexa290.html?q=node/10).\nThe test set answers are not provided publicly.\n", "citation": "@inproceedings{kosawat2009best,\n title={BEST 2009: Thai word segmentation software contest},\n author={Kosawat, Krit and Boriboon, Monthika and Chootrakool, Patcharika and Chotimongkol, Ananlada and Klaithin, Supon and Kongyoung, Sarawoot and Kriengket, Kanyanut and Phaholphinyo, Sitthaa and Purodakananda, Sumonmas and Thanakulwarapas, Tipraporn and others},\n booktitle={2009 Eighth International Symposium on Natural Language Processing},\n pages={83--88},\n year={2009},\n organization={IEEE}\n}\n@inproceedings{boriboon2009best,\n title={Best corpus development and analysis},\n author={Boriboon, Monthika and Kriengket, Kanyanut and Chootrakool, Patcharika and Phaholphinyo, Sitthaa and Purodakananda, Sumonmas and Thanakulwarapas, Tipraporn and Kosawat, Krit},\n booktitle={2009 International Conference on Asian Language Processing},\n pages={322--327},\n year={2009},\n organization={IEEE}\n}\n", "homepage": "https://aiforthai.in.th/", "license": "CC-BY-NC-SA 3.0", "features": {"fname": {"dtype": "string", "id": null, "_type": "Value"}, "char": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "char_type": {"feature": {"num_classes": 12, "names": ["b_e", "c", "d", "n", "o", "p", "q", "s", "s_e", "t", "v", "w"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "is_beginning": {"feature": {"num_classes": 2, "names": ["neg", "pos"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "best2009", "config_name": "best2009", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 483129998, "num_examples": 148995, "dataset_name": "best2009"}, "test": {"name": "test", "num_bytes": 10498726, "num_examples": 2252, "dataset_name": "best2009"}}, "download_checksums": {"https://archive.org/download/best_dataset/data.zip": {"num_bytes": 13891260, "checksum": "009386ea03aab2abd194bcb3b86c01b81038f460296c447ce2c0e561d3eca64f"}}, "download_size": 13891260, "post_processing_size": null, "dataset_size": 493628724, "size_in_bytes": 507519984}}
|
|
|
|