Upload karonese_sentiment.py with huggingface_hub
Browse files- karonese_sentiment.py +12 -12
karonese_sentiment.py
CHANGED
|
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
|
|
| 4 |
import datasets
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
-
from
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
|
| 11 |
_CITATION = """\
|
| 12 |
@article{karo2022sentiment,
|
|
@@ -46,7 +46,7 @@ _SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
|
|
| 46 |
|
| 47 |
_SOURCE_VERSION = "1.0.0"
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
|
| 52 |
class KaroneseSentimentDataset(datasets.GeneratorBasedBuilder):
|
|
@@ -55,21 +55,21 @@ class KaroneseSentimentDataset(datasets.GeneratorBasedBuilder):
|
|
| 55 |
"""
|
| 56 |
|
| 57 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 58 |
-
|
| 59 |
|
| 60 |
BUILDER_CONFIGS = [
|
| 61 |
-
|
| 62 |
name="karonese_sentiment_source",
|
| 63 |
version=SOURCE_VERSION,
|
| 64 |
description="Karonese Sentiment source schema",
|
| 65 |
schema="source",
|
| 66 |
subset_id="karonese_sentiment",
|
| 67 |
),
|
| 68 |
-
|
| 69 |
-
name="
|
| 70 |
-
version=
|
| 71 |
description="Karonese Sentiment Nusantara schema",
|
| 72 |
-
schema="
|
| 73 |
subset_id="karonese_sentiment",
|
| 74 |
),
|
| 75 |
]
|
|
@@ -85,7 +85,7 @@ class KaroneseSentimentDataset(datasets.GeneratorBasedBuilder):
|
|
| 85 |
"label": datasets.Value("string"),
|
| 86 |
}
|
| 87 |
)
|
| 88 |
-
elif self.config.schema == "
|
| 89 |
features = schemas.text_features(["negative", "neutral", "positive"])
|
| 90 |
|
| 91 |
return datasets.DatasetInfo(
|
|
@@ -123,7 +123,7 @@ class KaroneseSentimentDataset(datasets.GeneratorBasedBuilder):
|
|
| 123 |
"label": row.label,
|
| 124 |
}
|
| 125 |
yield idx, example
|
| 126 |
-
elif self.config.schema == "
|
| 127 |
for idx, row in df.iterrows():
|
| 128 |
example = {
|
| 129 |
"id": str(idx+1),
|
|
|
|
| 4 |
import datasets
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
+
from seacrowd.utils import schemas
|
| 8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
| 9 |
+
from seacrowd.utils.constants import Tasks
|
| 10 |
|
| 11 |
_CITATION = """\
|
| 12 |
@article{karo2022sentiment,
|
|
|
|
| 46 |
|
| 47 |
_SOURCE_VERSION = "1.0.0"
|
| 48 |
|
| 49 |
+
_SEACROWD_VERSION = "2024.06.20"
|
| 50 |
|
| 51 |
|
| 52 |
class KaroneseSentimentDataset(datasets.GeneratorBasedBuilder):
|
|
|
|
| 55 |
"""
|
| 56 |
|
| 57 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 58 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
| 59 |
|
| 60 |
BUILDER_CONFIGS = [
|
| 61 |
+
SEACrowdConfig(
|
| 62 |
name="karonese_sentiment_source",
|
| 63 |
version=SOURCE_VERSION,
|
| 64 |
description="Karonese Sentiment source schema",
|
| 65 |
schema="source",
|
| 66 |
subset_id="karonese_sentiment",
|
| 67 |
),
|
| 68 |
+
SEACrowdConfig(
|
| 69 |
+
name="karonese_sentiment_seacrowd_text",
|
| 70 |
+
version=SEACROWD_VERSION,
|
| 71 |
description="Karonese Sentiment Nusantara schema",
|
| 72 |
+
schema="seacrowd_text",
|
| 73 |
subset_id="karonese_sentiment",
|
| 74 |
),
|
| 75 |
]
|
|
|
|
| 85 |
"label": datasets.Value("string"),
|
| 86 |
}
|
| 87 |
)
|
| 88 |
+
elif self.config.schema == "seacrowd_text":
|
| 89 |
features = schemas.text_features(["negative", "neutral", "positive"])
|
| 90 |
|
| 91 |
return datasets.DatasetInfo(
|
|
|
|
| 123 |
"label": row.label,
|
| 124 |
}
|
| 125 |
yield idx, example
|
| 126 |
+
elif self.config.schema == "seacrowd_text":
|
| 127 |
for idx, row in df.iterrows():
|
| 128 |
example = {
|
| 129 |
"id": str(idx+1),
|