|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""DUVEL : the Detection of Unlimited Variant Ensemble in Literature""" |
|
|
|
|
|
import csv |
|
import datasets |
|
|
|
|
|
|
|
|
|
_CITATION = """\ |
|
@InProceedings{huggingface:dataset, |
|
title = {A great new dataset}, |
|
author={huggingface, Inc. |
|
}, |
|
year={2020} |
|
} |
|
""" |
|
|
|
|
|
_DESCRIPTION = """\ |
|
This dataset was created to identity oligogenic variant combinations, i.e. relation between several genes and their mutations, \ |
|
causing genetic diseases in scientific articles written in english. At the moment, it contains only digenic variant combinations, \ |
|
i.e. relations between two genes and at least two variants. The dataset is intended for binary relation extraction where the \ |
|
entities are masked within the text. |
|
""" |
|
|
|
_HOMEPAGE = "https://github.com/cnachteg/DUVEL" |
|
|
|
_LICENSE = "cc-by-nc-sa-4.0" |
|
|
|
|
|
|
|
_URL = "https://raw.githubusercontent.com/cnachteg/DUVEL/main/" |
|
_URLS = { |
|
"train": _URL + "data/train.csv", |
|
"dev": _URL + "data/validation.csv", |
|
"test": _URL + "data/test.csv" |
|
} |
|
|
|
|
|
|
|
class DUVEL(datasets.GeneratorBasedBuilder): |
|
"""DUVEL : the Detection of Unlimited Variant Ensemble in Literature - Version 1.1.""" |
|
|
|
VERSION = datasets.Version("1.1.0") |
|
|
|
def _info(self): |
|
features = datasets.Features( |
|
{ |
|
'sentence': datasets.Value('string'), |
|
'pmcid': datasets.Value('int32'), |
|
'gene1': datasets.Value('string'), |
|
'gene2': datasets.Value('string'), |
|
'variant1': datasets.Value('string'), |
|
'variant2': datasets.Value('string'), |
|
'label': datasets.ClassLabel(names=[0,1]) |
|
} |
|
) |
|
return datasets.DatasetInfo( |
|
|
|
description=_DESCRIPTION, |
|
|
|
features=features, |
|
|
|
|
|
|
|
|
|
homepage=_HOMEPAGE, |
|
|
|
license=_LICENSE, |
|
|
|
citation=_CITATION, |
|
task_templates=[ |
|
datasets.tasks.TextClassification( |
|
text_column='sentence', label_column='label' |
|
) |
|
], |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
downloaded_files = dl_manager.download_and_extract(_URLS) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={ |
|
"filepath": downloaded_files['train'] |
|
}, |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.VALIDATION, |
|
gen_kwargs={ |
|
"filepath": downloaded_files['dev'], |
|
}, |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TEST, |
|
gen_kwargs={ |
|
"filepath": downloaded_files['test'], |
|
}, |
|
), |
|
] |
|
|
|
def _generate_examples(self, filepath): |
|
with open(filepath, encoding="utf-8") as f: |
|
reader = csv.DictReader(f) |
|
for key, row in enumerate(reader): |
|
yield key, row |