Download conversion_script.py from thagen/CNCv2: direct link, hf CLI and curl.
- Browser
- Download file 3.26 kB
-
https://huggingface.co/datasets/thagen/CNCv2/resolve/main/conversion_script.py
- Command line
-
hf download hf://datasets/thagen/CNCv2/conversion_script.py
-
curl -L -o conversion_script.py https://huggingface.co/datasets/thagen/CNCv2/resolve/main/conversion_script.py
3.26 kB
| #!/usr/bin/env python3 | |
| """ | |
| Run this script as ./conversion_script.py to convert the Causal News Corpus | |
| (CNC) "V2" -- published as RECESS -- DIRECTLY from its original repository. | |
| ``UniCausal2HF`` already reads a CSV given any path/URL pandas' own | |
| ``read_csv`` accepts, so no manual download/caching step is needed; point | |
| it straight at the raw GitHub URLs. | |
| Citation / original source | |
| --------------------------- | |
| Tan, F. A., Hettiarachchi, H., Hürriyetoğlu, A., Oostdijk, N., Caselli, | |
| T., Nomoto, T., Uca, O., Liza, F. F., & Ng, S.-K. (2023). "RECESS: | |
| Resource for Extracting Cause, Effect, and Signal Spans." IJCNLP-AACL | |
| 2023. https://aclanthology.org/2023.ijcnlp-main.6/ | |
| Repo (verified live, public, no login): github.com/tanfiona/CausalNewsCorpus | |
| License: CC0-1.0 (verified via GitHub API) -- public domain, no restrictions. | |
| This is the actively-maintained release -- the maintainers themselves | |
| recommend using it over the original 2022 "V1" release ("For 2023 Shared | |
| Task, please use V2" -- repo README): far richer span annotations (subtask | |
| 2, Cause/Effect/Signal), 2257 causal relations vs. V1's 183 (verified: | |
| `train_subtask2_grouped.csv` + `dev_subtask2_grouped.csv` row counts). See | |
| ../CNC/conversion_script.py for V1, kept as its own separate dataset for | |
| comparison rather than silently overwritten by this newer version. | |
| Format: the ``_grouped`` CSVs already match causalatee's ``UniCausal2HF`` | |
| grouped format exactly (one row per sentence; ``causal_text_w_pairs`` is a | |
| Python-repr'd list of 0+ independently <ARG0>/<ARG1>/<SIGn>-tagged copies | |
| of that row's ``text``, one per causal relation -- ARG0=cause, ARG1=effect, | |
| confirmed against real "because"/"due to" examples) -- see | |
| causalatee/data/conversion/_unicausal2hf.py for the shared parsing logic | |
| (also used by BECauSEv2, AltLex). | |
| No usable test split: the real held-out test set (``test_subtask2_text.csv``) | |
| has NO gold labels at all and never will -- confirmed directly from | |
| data/V2/README.md: "We will not release the test labels this year as we | |
| might intend to rerun this Shared Task next year." Mapped here as: | |
| upstream train -> causalatee train, upstream dev -> causalatee dev.parquet | |
| -- written as ``dev.parquet``, NOT ``test.parquet`` (fixed 2026-07-20; | |
| previously written as test.parquet, which claimed a real held-out test | |
| set exists when it's actually the upstream dev split). `with_validation_split` | |
| in the evaluation harness treats a dataset with dev but no test as: | |
| promote this dev to serve as the final eval target, and carve a FRESH | |
| validation split out of train for early stopping instead, so the | |
| promoted dev is never touched during training either way -- see its | |
| docstring. | |
| """ | |
| from pathlib import Path | |
| from causalatee.data.constants import Task | |
| from causalatee.data.conversion import UniCausal2HF | |
| _BASE_URL = "https://raw.githubusercontent.com/tanfiona/CausalNewsCorpus/master/data/V2" | |
| converter = UniCausal2HF( | |
| { | |
| "train": f"{_BASE_URL}/train_subtask2_grouped.csv", | |
| "dev": f"{_BASE_URL}/dev_subtask2_grouped.csv", | |
| }, | |
| Path.cwd(), | |
| ) | |
| for split in ["train", "dev"]: | |
| converter.convert(Task.CausalityDetection, split) | |
| converter.convert(Task.CausalCandidateExtraction, split) | |
| converter.convert(Task.CausalityIdentification, split) | |