EventCausality / conversion_script.py
thagen's picture
current state
80e79f5
Raw
History Blame Contribute Delete
2.74 kB
#!/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.
KNOWN UNFIXABLE (2026-07-11) -- do not "fix" this by pointing it at
CogComp/TCR's data. Researched at length trying to find a direct source
to replace CREST for this dataset (as was done for CaTeRS, BioCause,
COPA, TCR): EventCausality's original release (Do, Chan & Roth, EMNLP
2011, 580 manually-annotated causal links on 25 CNN articles) was never
publicly archived anywhere reachable -- confirmed by reading the paper
itself (which only promises "we plan to make this dataset available
soon" via a CogComp resource-page URL that is now a dead/JS-templated
page with no static fallback), and by searching the whole CogComp GitHub
org (no matching repo).
The only accessible data touching these same 25 documents is
github.com/CogComp/TCR (see ../TCR/conversion_script.py) -- but that is a
DIFFERENT, later, re-annotated dataset built for a different paper (Ning
et al., ACL 2018): events were re-extracted with ClearTK rather than
reusing Do et al.'s original manual event set, and causal links were
independently re-annotated and pruned (580 -> 172, a different label
scheme too: TCR's binary causes/caused_by vs. EventCausality's
causality/relatedness). Repointing this converter at TCR's data would
silently conflate two distinct datasets under one citation -- decided
NOT to do that. This script is therefore left exactly as it was: still fed by
CREST's own (independently confirmed corrupted/incomplete: 0 train rows)
aggregation, which is the best available approximation of the true
EventCausality data until/unless a first-party archive of the original
release resurfaces. If you're comparing models against "EventCausality"
using this data, treat effectiveness numbers on it as unreliable for
that reason -- it is not a data-loading bug in the usual sense.
"""
# 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 causalatee.data.constants import Task
from causalatee.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)