Datasets:
GEM
/

Languages:
English
Multilinguality:
unknown
Size Categories:
unknown
Language Creators:
unknown
Annotations Creators:
none
Source Datasets:
original
Tags:
License:
File size: 2,899 Bytes
32beafc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import csv
import json
import os
import datasets

_CITATION = """\
@inproceedings{devaraj-etal-2021-paragraph,
    title = "Paragraph-level Simplification of Medical Texts",
    author = "Devaraj, Ashwin  and
      Marshall, Iain  and
      Wallace, Byron  and
      Li, Junyi Jessy",
    booktitle = "Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
    month = jun,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.naacl-main.395",
    doi = "10.18653/v1/2021.naacl-main.395",
    pages = "4972--4984",
}
"""

_DESCRIPTION = """\
This dataset measures the ability for a model to simplify paragraphs of medical text through the omission non-salient information and simplification of medical jargon.
"""

_URLs = {
    "train": "train.json",
    "validation": "validation.json",
    "test": "test.json",
}


class Cochrane(datasets.GeneratorBasedBuilder):
    VERSION = datasets.Version("1.0.0")
    DEFAULT_CONFIG_NAME = "cochrane-simplification"

    def _info(self):
        features = datasets.Features(
            {
                "gem_id": datasets.Value("string"),
                "gem_parent_id": datasets.Value("string"),
                "source": datasets.Value("string"),
                "target": datasets.Value("string"),
                "doi": datasets.Value("string"),
                "references": [datasets.Value("string")],
            }
        )
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            supervised_keys=datasets.info.SupervisedKeysData(
                input="source", output="target"
            ),
            homepage="https://github.com/AshOlogn/Paragraph-level-Simplification-of-Medical-Texts ",
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        """Returns SplitGenerators."""
        dl_dir = dl_manager.download_and_extract(_URLs)
        return [
            datasets.SplitGenerator(
                name=spl, gen_kwargs={"filepath": dl_dir[spl], "split": spl}
            )
            for spl in ["train", "validation", "test"]
        ]

    def _generate_examples(self, filepath, split):
        """Yields examples."""
        with open(filepath, encoding="utf-8") as f:
            reader = json.load(f)
            for id_, example in enumerate(reader):
                yield id_, {
                    "gem_id": f"cochrane-simplification-{split}-{id_}",
                    "gem_parent_id": f"cochrane-simplification-{split}-{id_}",
                    "source": example["source"],
                    "target": example["target"],
                    "doi": example["doi"],
                    "references": [example["target"]],
                }