Upload imdb_jv.py with huggingface_hub
Browse files- imdb_jv.py +12 -12
imdb_jv.py
CHANGED
|
@@ -4,9 +4,9 @@ from typing import Dict, List, Tuple
|
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
|
| 7 |
-
from
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
import pandas as pd
|
| 11 |
|
| 12 |
_CITATION = """\
|
|
@@ -41,27 +41,27 @@ _SUPPORTED_TASKS = [Tasks.SENTIMENT_ANALYSIS]
|
|
| 41 |
|
| 42 |
_SOURCE_VERSION = "1.0.0"
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
class IMDbJv(datasets.GeneratorBasedBuilder):
|
| 47 |
"""Javanese Imdb Movie Reviews Dataset is a Javanese version of the IMDb Movie Reviews dataset by translating the original English dataset to Javanese."""
|
| 48 |
|
| 49 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 50 |
-
|
| 51 |
|
| 52 |
BUILDER_CONFIGS = [
|
| 53 |
-
|
| 54 |
name="imdb_jv_source",
|
| 55 |
version=datasets.Version(_SOURCE_VERSION),
|
| 56 |
description="imdb_jv source schema",
|
| 57 |
schema="source",
|
| 58 |
subset_id="imdb_jv",
|
| 59 |
),
|
| 60 |
-
|
| 61 |
-
name="
|
| 62 |
-
version=datasets.Version(
|
| 63 |
description="imdb_jv Nusantara schema",
|
| 64 |
-
schema="
|
| 65 |
subset_id="imdb_jv",
|
| 66 |
),
|
| 67 |
]
|
|
@@ -77,7 +77,7 @@ class IMDbJv(datasets.GeneratorBasedBuilder):
|
|
| 77 |
"label": datasets.Value("string")
|
| 78 |
}
|
| 79 |
)
|
| 80 |
-
elif self.config.schema == "
|
| 81 |
features = schemas.text_features(['1', '0', '-1'])
|
| 82 |
|
| 83 |
return datasets.DatasetInfo(
|
|
@@ -135,7 +135,7 @@ class IMDbJv(datasets.GeneratorBasedBuilder):
|
|
| 135 |
}
|
| 136 |
yield id, ex
|
| 137 |
|
| 138 |
-
elif self.config.schema == "
|
| 139 |
data = pd.read_csv(filepath)
|
| 140 |
length = len(data['label'])
|
| 141 |
for id in range(length):
|
|
|
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
|
| 7 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
| 8 |
+
from seacrowd.utils.constants import Tasks
|
| 9 |
+
from seacrowd.utils import schemas
|
| 10 |
import pandas as pd
|
| 11 |
|
| 12 |
_CITATION = """\
|
|
|
|
| 41 |
|
| 42 |
_SOURCE_VERSION = "1.0.0"
|
| 43 |
|
| 44 |
+
_SEACROWD_VERSION = "2024.06.20"
|
| 45 |
|
| 46 |
class IMDbJv(datasets.GeneratorBasedBuilder):
|
| 47 |
"""Javanese Imdb Movie Reviews Dataset is a Javanese version of the IMDb Movie Reviews dataset by translating the original English dataset to Javanese."""
|
| 48 |
|
| 49 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
| 50 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
| 51 |
|
| 52 |
BUILDER_CONFIGS = [
|
| 53 |
+
SEACrowdConfig(
|
| 54 |
name="imdb_jv_source",
|
| 55 |
version=datasets.Version(_SOURCE_VERSION),
|
| 56 |
description="imdb_jv source schema",
|
| 57 |
schema="source",
|
| 58 |
subset_id="imdb_jv",
|
| 59 |
),
|
| 60 |
+
SEACrowdConfig(
|
| 61 |
+
name="imdb_jv_seacrowd_text",
|
| 62 |
+
version=datasets.Version(_SEACROWD_VERSION),
|
| 63 |
description="imdb_jv Nusantara schema",
|
| 64 |
+
schema="seacrowd_text",
|
| 65 |
subset_id="imdb_jv",
|
| 66 |
),
|
| 67 |
]
|
|
|
|
| 77 |
"label": datasets.Value("string")
|
| 78 |
}
|
| 79 |
)
|
| 80 |
+
elif self.config.schema == "seacrowd_text":
|
| 81 |
features = schemas.text_features(['1', '0', '-1'])
|
| 82 |
|
| 83 |
return datasets.DatasetInfo(
|
|
|
|
| 135 |
}
|
| 136 |
yield id, ex
|
| 137 |
|
| 138 |
+
elif self.config.schema == "seacrowd_text":
|
| 139 |
data = pd.read_csv(filepath)
|
| 140 |
length = len(data['label'])
|
| 141 |
for id in range(length):
|