File size: 934 Bytes
23b70be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 BioCause 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="biocause",
    filters={"source": CRESTSource.BioCause},
)

for split in ["train", "dev", "test"]:
    converter.convert(Task.CausalityDetection, split)
    converter.convert(Task.CausalCandidateExtraction, split)
    converter.convert(Task.CausalityIdentification, split)