GoemotionEsp / goemotions_es.py
Rhaosody's picture
Upload 6 files
34a454b verified
import json
import datasets
class GoEmotionsESConfig(datasets.BuilderConfig):
def __init__(self, **kwargs):
super(GoEmotionsESConfig, self).__init__(**kwargs)
class GoEmotionsES(datasets.GeneratorBasedBuilder):
BUILDER_CONFIGS = [
GoEmotionsESConfig(name="default", version=datasets.Version("1.0.0"), description="GoEmotions en español")
]
def _info(self):
return datasets.DatasetInfo(
description="GoEmotions traducido y adaptado al español, por Lucio-Rhapsody",
features=datasets.Features({
"persona": datasets.Sequence(datasets.Value("string")),
"historia": datasets.Sequence({
"from": datasets.Value("string"),
"value": datasets.Value("string")
}),
"metadatos": {
"coherente": datasets.Value("bool"),
"perplexity": datasets.Value("float"),
"emotion_manual": datasets.Value("string"),
"energy_level": datasets.Value("int32"),
"context_topic": datasets.Value("string"),
"memory_reference": datasets.Value("string"),
"intent": datasets.Value("string"),
"nivel_reflexion": datasets.Value("string"),
"tipo_vinculo": datasets.Value("string"),
"tono_conversacional": datasets.Value("string"),
"inspiracion_lucio": datasets.Value("bool")
}
}),
license="CC-BY-4.0",
homepage="https://huggingface.co/datasets/Lucio-Rhapsody/goemotions-es",
)
def _split_generators(self, dl_manager):
path = dl_manager.download_and_extract("goemotions_es_unificadoDefinitivo.json")
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": path})]
def _generate_examples(self, filepath):
with open(filepath, encoding="utf-8") as f:
data = json.load(f)
for idx, row in enumerate(data):
yield idx, row