File size: 952 Bytes
d0bfe65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/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)
|