Robin Kurtz
commited on
Commit
•
e96a026
1
Parent(s):
d072fee
...
Browse files
suc3_1.py
CHANGED
@@ -54,16 +54,16 @@ _LICENSE = "CC-BY-4.0"
|
|
54 |
# TODO: Add link to the official dataset URLs here
|
55 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
56 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
57 |
-
_URL = "https://huggingface.co/datasets/KBLab/
|
58 |
_URLS = {
|
59 |
"original_tags": {
|
60 |
-
"cased": "original_tags/cased",
|
61 |
-
"lower": "original_tags/lower",
|
62 |
-
"
|
63 |
"simple_tags": {
|
64 |
-
"cased": "simple_tags/cased",
|
65 |
-
"lower": "simple_tags/lower",
|
66 |
-
"
|
67 |
}
|
68 |
|
69 |
|
@@ -118,10 +118,10 @@ class SUC3(datasets.GeneratorBasedBuilder):
|
|
118 |
description="manually annotated & lower",
|
119 |
),
|
120 |
SUC3Config(
|
121 |
-
name="
|
122 |
ner_label_names=_NER_LABEL_NAMES_ORIGINAL,
|
123 |
-
data_url=_URLS["original_tags"]["
|
124 |
-
description="manually annotated &
|
125 |
),
|
126 |
SUC3Config(
|
127 |
name="simple_cased",
|
@@ -136,18 +136,18 @@ class SUC3(datasets.GeneratorBasedBuilder):
|
|
136 |
description="automatically annotated & lower",
|
137 |
),
|
138 |
SUC3Config(
|
139 |
-
name="
|
140 |
ner_label_names=_NER_LABEL_NAMES_SIMPLE,
|
141 |
-
data_url=_URLS["simple_tags"]["
|
142 |
-
description="autimatically annotated &
|
143 |
),
|
144 |
]
|
145 |
|
146 |
def _info(self):
|
147 |
features = {"id": datasets.Value("string"),
|
148 |
"tokens": datasets.features.Sequence(datasets.Value("string")),
|
149 |
-
"pos_tags": datasets.features.Sequence(
|
150 |
-
"ner_tags": datasets.features.Sequence(
|
151 |
|
152 |
return datasets.DatasetInfo(
|
153 |
description=_DESCRIPTION + self.config.description,
|
@@ -159,7 +159,7 @@ class SUC3(datasets.GeneratorBasedBuilder):
|
|
159 |
|
160 |
def _split_generators(self, dl_manager):
|
161 |
dl_dir = dl_manager.download_and_extract(_URL + self.config.data_url)
|
162 |
-
dl_dir = os.path.join(dl_dir)
|
163 |
return [
|
164 |
datasets.SplitGenerator(
|
165 |
name=datasets.Split.TRAIN,
|
|
|
54 |
# TODO: Add link to the official dataset URLs here
|
55 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
56 |
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
57 |
+
_URL = "https://huggingface.co/datasets/KBLab/suc3_1/resolve/main/data/"
|
58 |
_URLS = {
|
59 |
"original_tags": {
|
60 |
+
"cased": "original_tags/cased.tar.gz",
|
61 |
+
"lower": "original_tags/lower.tar.gz",
|
62 |
+
"lower_mix": "original_tags/lower_mix.tar.gz"},
|
63 |
"simple_tags": {
|
64 |
+
"cased": "simple_tags/cased.tar.gz",
|
65 |
+
"lower": "simple_tags/lower.tar.gz",
|
66 |
+
"lower_mix": "simple_tags/lower_mix.tar.gz"}
|
67 |
}
|
68 |
|
69 |
|
|
|
118 |
description="manually annotated & lower",
|
119 |
),
|
120 |
SUC3Config(
|
121 |
+
name="original_lower_mix",
|
122 |
ner_label_names=_NER_LABEL_NAMES_ORIGINAL,
|
123 |
+
data_url=_URLS["original_tags"]["lower_mix"],
|
124 |
+
description="manually annotated & lower_mix",
|
125 |
),
|
126 |
SUC3Config(
|
127 |
name="simple_cased",
|
|
|
136 |
description="automatically annotated & lower",
|
137 |
),
|
138 |
SUC3Config(
|
139 |
+
name="simple_lower_mix",
|
140 |
ner_label_names=_NER_LABEL_NAMES_SIMPLE,
|
141 |
+
data_url=_URLS["simple_tags"]["lower_mix"],
|
142 |
+
description="autimatically annotated & lower_mix",
|
143 |
),
|
144 |
]
|
145 |
|
146 |
def _info(self):
|
147 |
features = {"id": datasets.Value("string"),
|
148 |
"tokens": datasets.features.Sequence(datasets.Value("string")),
|
149 |
+
"pos_tags": datasets.features.Sequence(_POS_LABEL_NAMES),
|
150 |
+
"ner_tags": datasets.features.Sequence(self.config.ner_label_names)}
|
151 |
|
152 |
return datasets.DatasetInfo(
|
153 |
description=_DESCRIPTION + self.config.description,
|
|
|
159 |
|
160 |
def _split_generators(self, dl_manager):
|
161 |
dl_dir = dl_manager.download_and_extract(_URL + self.config.data_url)
|
162 |
+
dl_dir = os.path.join(dl_dir, dl_dir.split("/")[-1].split(".")[0])
|
163 |
return [
|
164 |
datasets.SplitGenerator(
|
165 |
name=datasets.Split.TRAIN,
|