catalonia_independence_ca / create_dataset.py
Unso's picture
python file that generates datasets
b9ee25b
raw
history blame contribute delete
520 Bytes
from datasets import load_dataset
def main():
raw_data = load_dataset("catalonia_independence", "catalan")
raw_data = raw_data.rename_column("LABEL", "label")
raw_data = raw_data.rename_column("TWEET", "text")
raw_data = raw_data.rename_column("id_str", "id")
labels = raw_data["train"].features["label"]
for split, dataset in raw_data.items():
dataset = dataset.map(lambda x: {"label_text": labels.int2str(x["label"])}, num_proc=4)
dataset.to_json(f"{split}.jsonl")
if __name__ == "__main__":
main()