File size: 366 Bytes
db6e2f8 2a10d49 db6e2f8 fc4c647 db6e2f8 fc4c647 db6e2f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from datasets import load_dataset
dataset = load_dataset("go_emotions", split="train")
emotions = dataset.info.features["labels"].feature.names
def query_emotion(start, end):
rows = dataset[start:end]
observations = [
{"text": r[0], "emotion": emotions[r[1][0]]}
for r in zip(rows["text"], rows["labels"])
]
return observations
|