holylovenia
commited on
Commit
•
6eb0910
1
Parent(s):
1fa9c68
Upload id_wsd.py with huggingface_hub
Browse files
id_wsd.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import os
|
2 |
from pathlib import Path
|
3 |
from typing import Dict, List, Tuple
|
4 |
-
from
|
5 |
-
from
|
6 |
|
7 |
import datasets
|
8 |
import json
|
9 |
|
10 |
-
from
|
11 |
|
12 |
_CITATION = """\
|
13 |
@inproceedings{mahendra-etal-2018-cross,
|
@@ -31,7 +31,7 @@ _CITATION = """\
|
|
31 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
32 |
_LOCAL = False
|
33 |
|
34 |
-
_DATASETNAME = "
|
35 |
|
36 |
_DESCRIPTION = """\
|
37 |
Word Sense Disambiguation (WSD) is a task to determine the correct sense of an ambiguous word.
|
@@ -52,7 +52,7 @@ _SUPPORTED_TASKS = [Tasks.WORD_SENSE_DISAMBIGUATION]
|
|
52 |
|
53 |
_SOURCE_VERSION = "1.0.0"
|
54 |
|
55 |
-
|
56 |
|
57 |
_LABELS = [
|
58 |
{
|
@@ -84,22 +84,22 @@ _LABELS = [
|
|
84 |
class IndonesianWSD(datasets.GeneratorBasedBuilder):
|
85 |
|
86 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
87 |
-
|
88 |
|
89 |
BUILDER_CONFIGS = [
|
90 |
-
|
91 |
-
name="
|
92 |
version=SOURCE_VERSION,
|
93 |
description="Indonesian WSD source schema",
|
94 |
schema="source",
|
95 |
-
subset_id="
|
96 |
),
|
97 |
-
|
98 |
-
name="
|
99 |
-
version=
|
100 |
description="Indonesian WSD Nusantara schema",
|
101 |
-
schema="
|
102 |
-
subset_id="
|
103 |
),
|
104 |
]
|
105 |
|
@@ -115,7 +115,7 @@ class IndonesianWSD(datasets.GeneratorBasedBuilder):
|
|
115 |
}
|
116 |
)
|
117 |
|
118 |
-
elif self.config.schema == "
|
119 |
features = schemas.text2text_features
|
120 |
|
121 |
return datasets.DatasetInfo(
|
@@ -170,7 +170,7 @@ class IndonesianWSD(datasets.GeneratorBasedBuilder):
|
|
170 |
yield key, example
|
171 |
key+=1
|
172 |
|
173 |
-
elif self.config.schema == "
|
174 |
key = 0
|
175 |
for each_data in data:
|
176 |
example = {
|
|
|
1 |
import os
|
2 |
from pathlib import Path
|
3 |
from typing import Dict, List, Tuple
|
4 |
+
from seacrowd.utils.constants import Tasks
|
5 |
+
from seacrowd.utils import schemas
|
6 |
|
7 |
import datasets
|
8 |
import json
|
9 |
|
10 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
11 |
|
12 |
_CITATION = """\
|
13 |
@inproceedings{mahendra-etal-2018-cross,
|
|
|
31 |
_LANGUAGES = ["ind"] # We follow ISO639-3 language code (https://iso639-3.sil.org/code_tables/639/data)
|
32 |
_LOCAL = False
|
33 |
|
34 |
+
_DATASETNAME = "id_wsd"
|
35 |
|
36 |
_DESCRIPTION = """\
|
37 |
Word Sense Disambiguation (WSD) is a task to determine the correct sense of an ambiguous word.
|
|
|
52 |
|
53 |
_SOURCE_VERSION = "1.0.0"
|
54 |
|
55 |
+
_SEACROWD_VERSION = "2024.06.20"
|
56 |
|
57 |
_LABELS = [
|
58 |
{
|
|
|
84 |
class IndonesianWSD(datasets.GeneratorBasedBuilder):
|
85 |
|
86 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
87 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
88 |
|
89 |
BUILDER_CONFIGS = [
|
90 |
+
SEACrowdConfig(
|
91 |
+
name="id_wsd_source",
|
92 |
version=SOURCE_VERSION,
|
93 |
description="Indonesian WSD source schema",
|
94 |
schema="source",
|
95 |
+
subset_id="id_wsd",
|
96 |
),
|
97 |
+
SEACrowdConfig(
|
98 |
+
name="id_wsd_seacrowd_t2t",
|
99 |
+
version=SEACROWD_VERSION,
|
100 |
description="Indonesian WSD Nusantara schema",
|
101 |
+
schema="seacrowd_t2t",
|
102 |
+
subset_id="id_wsd",
|
103 |
),
|
104 |
]
|
105 |
|
|
|
115 |
}
|
116 |
)
|
117 |
|
118 |
+
elif self.config.schema == "seacrowd_t2t":
|
119 |
features = schemas.text2text_features
|
120 |
|
121 |
return datasets.DatasetInfo(
|
|
|
170 |
yield key, example
|
171 |
key+=1
|
172 |
|
173 |
+
elif self.config.schema == "seacrowd_t2t":
|
174 |
key = 0
|
175 |
for each_data in data:
|
176 |
example = {
|