#!/usr/bin/env python3 """ Run this script as ./conversion_script.py to convert the EventCausality entries from the CREST v2 aggregation file to HF-compatible parquet files. """ # 1) Install dependencies: # pip install git+https://github.com/TheMrSheldon/causality-toolkit.git # 2) Source file (fetched automatically via pandas): # - https://raw.githubusercontent.com/phosseini/CREST/master/data/crest_v2.xlsx from pathlib import Path from ctk.data.constants import Task from ctk.data.conversion import CREST2HF, CRESTSource converter = CREST2HF( "https://raw.githubusercontent.com/phosseini/CREST/master/data/crest_v2.xlsx", Path.cwd(), prefix="eventcausality", filters={"source": CRESTSource.EventCausality}, ) for split in ["train", "dev", "test"]: converter.convert(Task.CausalityDetection, split) converter.convert(Task.CausalCandidateExtraction, split) converter.convert(Task.CausalityIdentification, split)