Commit 
							
							·
						
						4aab736
	
0
								Parent(s):
							
							
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +161 -0
- dataset_infos.json +1 -0
- dummy/1.0.0/dummy_data.zip +3 -0
- medal.py +146 -0
    	
        .gitattributes
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            *.7z filter=lfs diff=lfs merge=lfs -text
         | 
| 2 | 
            +
            *.arrow filter=lfs diff=lfs merge=lfs -text
         | 
| 3 | 
            +
            *.bin filter=lfs diff=lfs merge=lfs -text
         | 
| 4 | 
            +
            *.bin.* filter=lfs diff=lfs merge=lfs -text
         | 
| 5 | 
            +
            *.bz2 filter=lfs diff=lfs merge=lfs -text
         | 
| 6 | 
            +
            *.ftz filter=lfs diff=lfs merge=lfs -text
         | 
| 7 | 
            +
            *.gz filter=lfs diff=lfs merge=lfs -text
         | 
| 8 | 
            +
            *.h5 filter=lfs diff=lfs merge=lfs -text
         | 
| 9 | 
            +
            *.joblib filter=lfs diff=lfs merge=lfs -text
         | 
| 10 | 
            +
            *.lfs.* filter=lfs diff=lfs merge=lfs -text
         | 
| 11 | 
            +
            *.model filter=lfs diff=lfs merge=lfs -text
         | 
| 12 | 
            +
            *.msgpack filter=lfs diff=lfs merge=lfs -text
         | 
| 13 | 
            +
            *.onnx filter=lfs diff=lfs merge=lfs -text
         | 
| 14 | 
            +
            *.ot filter=lfs diff=lfs merge=lfs -text
         | 
| 15 | 
            +
            *.parquet filter=lfs diff=lfs merge=lfs -text
         | 
| 16 | 
            +
            *.pb filter=lfs diff=lfs merge=lfs -text
         | 
| 17 | 
            +
            *.pt filter=lfs diff=lfs merge=lfs -text
         | 
| 18 | 
            +
            *.pth filter=lfs diff=lfs merge=lfs -text
         | 
| 19 | 
            +
            *.rar filter=lfs diff=lfs merge=lfs -text
         | 
| 20 | 
            +
            saved_model/**/* filter=lfs diff=lfs merge=lfs -text
         | 
| 21 | 
            +
            *.tar.* filter=lfs diff=lfs merge=lfs -text
         | 
| 22 | 
            +
            *.tflite filter=lfs diff=lfs merge=lfs -text
         | 
| 23 | 
            +
            *.tgz filter=lfs diff=lfs merge=lfs -text
         | 
| 24 | 
            +
            *.xz filter=lfs diff=lfs merge=lfs -text
         | 
| 25 | 
            +
            *.zip filter=lfs diff=lfs merge=lfs -text
         | 
| 26 | 
            +
            *.zstandard filter=lfs diff=lfs merge=lfs -text
         | 
| 27 | 
            +
            *tfevents* filter=lfs diff=lfs merge=lfs -text
         | 
    	
        README.md
    ADDED
    
    | @@ -0,0 +1,161 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            annotations_creators:
         | 
| 3 | 
            +
            - expert-generated
         | 
| 4 | 
            +
            language_creators:
         | 
| 5 | 
            +
            - expert-generated
         | 
| 6 | 
            +
            languages:
         | 
| 7 | 
            +
            - en
         | 
| 8 | 
            +
            licenses:
         | 
| 9 | 
            +
            - unknown
         | 
| 10 | 
            +
            multilinguality:
         | 
| 11 | 
            +
            - monolingual
         | 
| 12 | 
            +
            size_categories:
         | 
| 13 | 
            +
            - n<1K
         | 
| 14 | 
            +
            source_datasets:
         | 
| 15 | 
            +
            - original
         | 
| 16 | 
            +
            task_categories:
         | 
| 17 | 
            +
            - other
         | 
| 18 | 
            +
            task_ids:
         | 
| 19 | 
            +
            - other-other-disambiguation
         | 
| 20 | 
            +
            ---
         | 
| 21 | 
            +
            # Dataset Card Creation Guide
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## Table of Contents
         | 
| 24 | 
            +
            - [Dataset Description](#dataset-description)
         | 
| 25 | 
            +
              - [Dataset Summary](#dataset-summary)
         | 
| 26 | 
            +
              - [Supported Tasks](#supported-tasks-and-leaderboards)
         | 
| 27 | 
            +
              - [Languages](#languages)
         | 
| 28 | 
            +
            - [Dataset Structure](#dataset-structure)
         | 
| 29 | 
            +
              - [Data Instances](#data-instances)
         | 
| 30 | 
            +
              - [Data Fields](#data-instances)
         | 
| 31 | 
            +
              - [Data Splits](#data-instances)
         | 
| 32 | 
            +
            - [Dataset Creation](#dataset-creation)
         | 
| 33 | 
            +
              - [Curation Rationale](#curation-rationale)
         | 
| 34 | 
            +
              - [Source Data](#source-data)
         | 
| 35 | 
            +
              - [Annotations](#annotations)
         | 
| 36 | 
            +
              - [Personal and Sensitive Information](#personal-and-sensitive-information)
         | 
| 37 | 
            +
            - [Considerations for Using the Data](#considerations-for-using-the-data)
         | 
| 38 | 
            +
              - [Social Impact of Dataset](#social-impact-of-dataset)
         | 
| 39 | 
            +
              - [Discussion of Biases](#discussion-of-biases)
         | 
| 40 | 
            +
              - [Other Known Limitations](#other-known-limitations)
         | 
| 41 | 
            +
            - [Additional Information](#additional-information)
         | 
| 42 | 
            +
              - [Dataset Curators](#dataset-curators)
         | 
| 43 | 
            +
              - [Licensing Information](#licensing-information)
         | 
| 44 | 
            +
              - [Citation Information](#citation-information)
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            ## Dataset Description
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            - **Homepage:** []()
         | 
| 49 | 
            +
            - **Repository:** [https://github.com/BruceWen120/medal]()
         | 
| 50 | 
            +
            - **Paper:** [https://www.aclweb.org/anthology/2020.clinicalnlp-1.15/]()
         | 
| 51 | 
            +
            - **Dataset (Kaggle):** [https://www.kaggle.com/xhlulu/medal-emnlp]()
         | 
| 52 | 
            +
            - **Dataset (Zenodo):** [https://zenodo.org/record/4265632]()
         | 
| 53 | 
            +
            - **Pretrained model:** [https://huggingface.co/xhlu/electra-medal]()
         | 
| 54 | 
            +
            - **Leaderboard:** []()
         | 
| 55 | 
            +
            - **Point of Contact:** []()
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            ### Dataset Summary
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            A large medical text dataset (14Go) curated to 4Go for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. For example, DHF can be disambiguated to dihydrofolate, diastolic heart failure, dengue hemorragic fever or dihydroxyfumarate
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            ### Supported Tasks and Leaderboards
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            Medical abbreviation disambiguation
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            ### Languages
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            English (en)
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            ## Dataset Structure
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            [More Information Needed]
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            ### Data Instances
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            [More Information Needed]
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            ### Data Fields
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            [More Information Needed]
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            ### Data Splits
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            [More Information Needed]
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            ## Dataset Creation
         | 
| 86 | 
            +
             | 
| 87 | 
            +
             | 
| 88 | 
            +
            ### Curation Rationale
         | 
| 89 | 
            +
             | 
| 90 | 
            +
            [More Information Needed]
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            ### Source Data
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            [More Information Needed]
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            #### Initial Data Collection and Normalization
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            [More Information Needed]
         | 
| 99 | 
            +
             | 
| 100 | 
            +
            #### Who are the source language producers?
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            [More Information Needed]
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            ### Annotations
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            [More Information Needed]
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            #### Annotation process
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            [More Information Needed]
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            #### Who are the annotators?
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            [More Information Needed]
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            ### Personal and Sensitive Information
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            [More Information Needed]
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            ## Considerations for Using the Data
         | 
| 121 | 
            +
             | 
| 122 | 
            +
            ### Social Impact of Dataset
         | 
| 123 | 
            +
             | 
| 124 | 
            +
            [More Information Needed]
         | 
| 125 | 
            +
             | 
| 126 | 
            +
            ### Discussion of Biases
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            [More Information Needed]
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            ### Other Known Limitations
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            [More Information Needed]
         | 
| 133 | 
            +
             | 
| 134 | 
            +
            ## Additional Information
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            ### Dataset Curators
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            [More Information Needed]
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            ### Licensing Information
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            [More Information Needed]
         | 
| 143 | 
            +
             | 
| 144 | 
            +
            ### Citation Information
         | 
| 145 | 
            +
             | 
| 146 | 
            +
            ```
         | 
| 147 | 
            +
            @inproceedings{wen-etal-2020-medal,
         | 
| 148 | 
            +
                title = "{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining",
         | 
| 149 | 
            +
                author = "Wen, Zhi  and
         | 
| 150 | 
            +
                  Lu, Xing Han  and
         | 
| 151 | 
            +
                  Reddy, Siva",
         | 
| 152 | 
            +
                booktitle = "Proceedings of the 3rd Clinical Natural Language Processing Workshop",
         | 
| 153 | 
            +
                month = nov,
         | 
| 154 | 
            +
                year = "2020",
         | 
| 155 | 
            +
                address = "Online",
         | 
| 156 | 
            +
                publisher = "Association for Computational Linguistics",
         | 
| 157 | 
            +
                url = "https://www.aclweb.org/anthology/2020.clinicalnlp-1.15",
         | 
| 158 | 
            +
                pages = "130--135",
         | 
| 159 | 
            +
                abstract = "One of the biggest challenges that prohibit the use of many current NLP methods in clinical settings is the availability of public datasets. In this work, we present MeDAL, a large medical text dataset curated for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. We pre-trained several models of common architectures on this dataset and empirically showed that such pre-training leads to improved performance and convergence speed when fine-tuning on downstream medical tasks.",
         | 
| 160 | 
            +
            }
         | 
| 161 | 
            +
            ```
         | 
    	
        dataset_infos.json
    ADDED
    
    | @@ -0,0 +1 @@ | |
|  | 
|  | |
| 1 | 
            +
            {"default": {"description": "A large medical text dataset (14Go) curated to 4Go for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. For example, DHF can be disambiguated to dihydrofolate, diastolic heart failure, dengue hemorragic fever or dihydroxyfumarate\n", "citation": "@inproceedings{wen-etal-2020-medal,\n    title = \"{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining\",\n    author = \"Wen, Zhi  and\n      Lu, Xing Han  and\n      Reddy, Siva\",\n    booktitle = \"Proceedings of the 3rd Clinical Natural Language Processing Workshop\",\n    month = nov,\n    year = \"2020\",\n    address = \"Online\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://www.aclweb.org/anthology/2020.clinicalnlp-1.15\",\n    pages = \"130--135\",\n    abstract = \"One of the biggest challenges that prohibit the use of many current NLP methods in clinical settings is the availability of public datasets. In this work, we present MeDAL, a large medical text dataset curated for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. We pre-trained several models of common architectures on this dataset and empirically showed that such pre-training leads to improved performance and convergence speed when fine-tuning on downstream medical tasks.\",\n}", "homepage": "https://github.com/BruceWen120/medal", "license": "", "features": {"abstract_id": {"dtype": "int32", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "location": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "label": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "medal", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3573399948, "num_examples": 3000000, "dataset_name": "medal"}, "test": {"name": "test", "num_bytes": 1190766821, "num_examples": 1000000, "dataset_name": "medal"}, "validation": {"name": "validation", "num_bytes": 1191410723, "num_examples": 1000000, "dataset_name": "medal"}, "full": {"name": "full", "num_bytes": 15536883723, "num_examples": 14393619, "dataset_name": "medal"}}, "download_checksums": {"https://zenodo.org/record/4276178/files/train.csv": {"num_bytes": 3541556520, "checksum": "c5fef2feebd1ecd35b4fe7a0aec266b631c0ac511d4d6b685835328b1ffbf32d"}, "https://zenodo.org/record/4276178/files/test.csv": {"num_bytes": 1180152075, "checksum": "ad391a63449c2bbbdbdf8d1827da4c053607a8586f4162174ba4ccf13efd8f86"}, "https://zenodo.org/record/4276178/files/valid.csv": {"num_bytes": 1180795804, "checksum": "08a0a6c2ee40747744ec15675ab5dc1e2b04491ca951b14c15d8d7bf9d33694d"}, "https://zenodo.org/record/4276178/files/full_data.csv": {"num_bytes": 15158424679, "checksum": "70f1ad891bdf98a42395a8907b48284457ae36d17fcc5a0a9c65c0b6b45ecf8d"}}, "download_size": 21060929078, "post_processing_size": null, "dataset_size": 21492461215, "size_in_bytes": 42553390293}}
         | 
    	
        dummy/1.0.0/dummy_data.zip
    ADDED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:5d4a921d222c4bbe5efd7ee2ce77bf13e0dbe7d5a848206327ff44d679109026
         | 
| 3 | 
            +
            size 3772
         | 
    	
        medal.py
    ADDED
    
    | @@ -0,0 +1,146 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            # coding=utf-8
         | 
| 2 | 
            +
            # Copyright 2020 the HuggingFace Datasets Authors.
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Licensed under the Apache License, Version 2.0 (the "License");
         | 
| 5 | 
            +
            # you may not use this file except in compliance with the License.
         | 
| 6 | 
            +
            # You may obtain a copy of the License at
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            #     http://www.apache.org/licenses/LICENSE-2.0
         | 
| 9 | 
            +
            #
         | 
| 10 | 
            +
            # Unless required by applicable law or agreed to in writing, software
         | 
| 11 | 
            +
            # distributed under the License is distributed on an "AS IS" BASIS,
         | 
| 12 | 
            +
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         | 
| 13 | 
            +
            # See the License for the specific language governing permissions and
         | 
| 14 | 
            +
            # limitations under the License.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            # Lint as: python3
         | 
| 17 | 
            +
            """MeDAL: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining"""
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            from __future__ import absolute_import, division, print_function
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            import csv
         | 
| 22 | 
            +
            import logging
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            import datasets
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            logger = logging.getLogger(__name__)
         | 
| 28 | 
            +
             | 
| 29 | 
            +
             | 
| 30 | 
            +
            _CITATION = """\
         | 
| 31 | 
            +
            @inproceedings{wen-etal-2020-medal,
         | 
| 32 | 
            +
                title = "{M}e{DAL}: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining",
         | 
| 33 | 
            +
                author = "Wen, Zhi  and
         | 
| 34 | 
            +
                  Lu, Xing Han  and
         | 
| 35 | 
            +
                  Reddy, Siva",
         | 
| 36 | 
            +
                booktitle = "Proceedings of the 3rd Clinical Natural Language Processing Workshop",
         | 
| 37 | 
            +
                month = nov,
         | 
| 38 | 
            +
                year = "2020",
         | 
| 39 | 
            +
                address = "Online",
         | 
| 40 | 
            +
                publisher = "Association for Computational Linguistics",
         | 
| 41 | 
            +
                url = "https://www.aclweb.org/anthology/2020.clinicalnlp-1.15",
         | 
| 42 | 
            +
                pages = "130--135",
         | 
| 43 | 
            +
                abstract = "One of the biggest challenges that prohibit the use of many current NLP methods in clinical settings is the availability of public datasets. In this work, we present MeDAL, a large medical text dataset curated for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. We pre-trained several models of common architectures on this dataset and empirically showed that such pre-training leads to improved performance and convergence speed when fine-tuning on downstream medical tasks.",
         | 
| 44 | 
            +
            }"""
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            _DESCRIPTION = """\
         | 
| 47 | 
            +
            A large medical text dataset (14Go) curated to 4Go for abbreviation disambiguation, designed for natural language understanding pre-training in the medical domain. For example, DHF can be disambiguated to dihydrofolate, diastolic heart failure, dengue hemorragic fever or dihydroxyfumarate
         | 
| 48 | 
            +
            """
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            _URL = "https://zenodo.org/record/4276178/files/"
         | 
| 51 | 
            +
            _URLS = {
         | 
| 52 | 
            +
                "train": _URL + "train.csv",
         | 
| 53 | 
            +
                "test": _URL + "test.csv",
         | 
| 54 | 
            +
                "valid": _URL + "valid.csv",
         | 
| 55 | 
            +
                "full": _URL + "full_data.csv",
         | 
| 56 | 
            +
            }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
             | 
| 59 | 
            +
            class Medal(datasets.GeneratorBasedBuilder):
         | 
| 60 | 
            +
                """Medal: Medical Abbreviation Disambiguation Dataset for Natural Language Understanding Pretraining"""
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                VERSION = datasets.Version("1.0.0")
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                def _info(self):
         | 
| 65 | 
            +
                    return datasets.DatasetInfo(
         | 
| 66 | 
            +
                        # This is the description that will appear on the datasets page.
         | 
| 67 | 
            +
                        description=_DESCRIPTION,
         | 
| 68 | 
            +
                        # datasets.features.FeatureConnectors
         | 
| 69 | 
            +
                        features=datasets.Features(
         | 
| 70 | 
            +
                            {
         | 
| 71 | 
            +
                                "abstract_id": datasets.Value("int32"),
         | 
| 72 | 
            +
                                "text": datasets.Value("string"),
         | 
| 73 | 
            +
                                "location": datasets.Sequence(datasets.Value("int32")),
         | 
| 74 | 
            +
                                "label": datasets.Sequence(datasets.Value("string")),
         | 
| 75 | 
            +
                                # These are the features of your dataset like images, labels ...
         | 
| 76 | 
            +
                            }
         | 
| 77 | 
            +
                        ),
         | 
| 78 | 
            +
                        # If there's a common (input, target) tuple from the features,
         | 
| 79 | 
            +
                        # specify them here. They'll be used if as_supervised=True in
         | 
| 80 | 
            +
                        # builder.as_dataset.
         | 
| 81 | 
            +
                        supervised_keys=None,
         | 
| 82 | 
            +
                        # Homepage of the dataset for documentation
         | 
| 83 | 
            +
                        homepage="https://github.com/BruceWen120/medal",
         | 
| 84 | 
            +
                        citation=_CITATION,
         | 
| 85 | 
            +
                    )
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                def _split_generators(self, dl_manager):
         | 
| 88 | 
            +
                    """Returns SplitGenerators."""
         | 
| 89 | 
            +
                    # dl_manager is a datasets.download.DownloadManager that can be used to
         | 
| 90 | 
            +
                    # download and extract URLs
         | 
| 91 | 
            +
                    urls_to_dl = _URLS
         | 
| 92 | 
            +
                    try:
         | 
| 93 | 
            +
                        dl_dir = dl_manager.download_and_extract(urls_to_dl)
         | 
| 94 | 
            +
                    except Exception:
         | 
| 95 | 
            +
                        logger.warning(
         | 
| 96 | 
            +
                            "This dataset is downloaded through Zenodo which is flaky. If this download failed try a few times before reporting an issue"
         | 
| 97 | 
            +
                        )
         | 
| 98 | 
            +
                        raise
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                    return [
         | 
| 101 | 
            +
                        datasets.SplitGenerator(
         | 
| 102 | 
            +
                            name=datasets.Split.TRAIN,
         | 
| 103 | 
            +
                            # These kwargs will be passed to _generate_examples
         | 
| 104 | 
            +
                            gen_kwargs={"filepath": dl_dir["train"], "split": "train"},
         | 
| 105 | 
            +
                        ),
         | 
| 106 | 
            +
                        datasets.SplitGenerator(
         | 
| 107 | 
            +
                            name=datasets.Split.TEST,
         | 
| 108 | 
            +
                            # These kwargs will be passed to _generate_examples
         | 
| 109 | 
            +
                            gen_kwargs={"filepath": dl_dir["test"], "split": "test"},
         | 
| 110 | 
            +
                        ),
         | 
| 111 | 
            +
                        datasets.SplitGenerator(
         | 
| 112 | 
            +
                            name=datasets.Split.VALIDATION,
         | 
| 113 | 
            +
                            # These kwargs will be passed to _generate_examples
         | 
| 114 | 
            +
                            gen_kwargs={"filepath": dl_dir["valid"], "split": "val"},
         | 
| 115 | 
            +
                        ),
         | 
| 116 | 
            +
                        datasets.SplitGenerator(
         | 
| 117 | 
            +
                            name="full",
         | 
| 118 | 
            +
                            # These kwargs will be passed to _generate_examples
         | 
| 119 | 
            +
                            gen_kwargs={"filepath": dl_dir["full"], "split": "full"},
         | 
| 120 | 
            +
                        ),
         | 
| 121 | 
            +
                    ]
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                def _generate_examples(self, filepath, split):
         | 
| 124 | 
            +
                    """Yields examples."""
         | 
| 125 | 
            +
                    with open(filepath, encoding="utf-8") as f:
         | 
| 126 | 
            +
                        data = csv.reader(f)
         | 
| 127 | 
            +
                        # Skip header
         | 
| 128 | 
            +
                        next(data)
         | 
| 129 | 
            +
                        # print(split, filepath, next(data))
         | 
| 130 | 
            +
                        if split == "full":
         | 
| 131 | 
            +
                            id_ = 0
         | 
| 132 | 
            +
                            for id_, row in enumerate(data):
         | 
| 133 | 
            +
                                yield id_, {
         | 
| 134 | 
            +
                                    "abstract_id": -1,
         | 
| 135 | 
            +
                                    "text": row[0],
         | 
| 136 | 
            +
                                    "location": [int(location) for location in row[1].split("|")],
         | 
| 137 | 
            +
                                    "label": row[2].split("|"),
         | 
| 138 | 
            +
                                }
         | 
| 139 | 
            +
                        else:
         | 
| 140 | 
            +
                            for id_, row in enumerate(data):
         | 
| 141 | 
            +
                                yield id_, {
         | 
| 142 | 
            +
                                    "abstract_id": int(row[0]),
         | 
| 143 | 
            +
                                    "text": row[1],
         | 
| 144 | 
            +
                                    "location": [int(row[2])],
         | 
| 145 | 
            +
                                    "label": [row[3]],
         | 
| 146 | 
            +
                                }
         | 

