mnaguib commited on
Commit
926edf1
·
1 Parent(s): 09dfecd

Revert "feat : loading script"

Browse files

This reverts commit 09dfecddee9a7912787580a5a828b8b05d32936b.

Files changed (1) hide show
  1. QuaeroFrenchMed.py +0 -160
QuaeroFrenchMed.py DELETED
@@ -1,160 +0,0 @@
1
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # TODO: Address all TODOs and remove all explanatory comments
15
- """TODO: Add a description here."""
16
-
17
-
18
- import csv
19
- import json
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- # Find for instance the citation on arxiv or on the dataset repo/website
26
- _CITATION = """
27
- @article{neveol2014quaero,
28
- title={The QUAERO French medical corpus: A ressource for medical entity recognition and normalization},
29
- author={N{\'e}v{\'e}ol, Aur{\'e}lie and Grouin, Cyril and Leixa, Jeremy and Rosset, Sophie and Zweigenbaum, Pierre},
30
- journal={Proc of BioTextMining Work},
31
- pages={24--30},
32
- year={2014}
33
- }
34
- """
35
-
36
- # You can copy an official description
37
- _DESCRIPTION = """\
38
- The QUAEROFrenchMed is a manually annotated corpus developed as a resource for named entity named recognition and normalization.
39
- """
40
-
41
- # TODO: Add a link to an official homepage for the dataset here
42
- _HOMEPAGE = "https://quaerofrenchmed.limsi.fr/"
43
-
44
-
45
- # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
46
- class NewDataset(datasets.GeneratorBasedBuilder):
47
- """TODO: Short description of my dataset.
48
- The QUAERO French Medical Corpus has been initially developed as a resource for named entity recognition and normalization [1]. It was then improved with the purpose of creating a gold standard set of normalized entities for French biomedical text, that was used in the CLEF eHealth evaluation lab [2][3].
49
- A selection of MEDLINE titles and EMEA documents were manually annotated. The annotation process was guided by concepts in the Unified Medical Language System (UMLS):
50
- 1. Ten types of clinical entities, as defined by the following UMLS Semantic Groups (Bodenreider and McCray 2003) were annotated: Anatomy (ANAT), Chemical and Drugs (CHEM), Devices (DEVI), Disorders (DISO), Geographic Areas (GEOG), Living Beings (LIVB), Objects (OBJC), Phenomena (PHEN), Physiology (PHYS), Procedures (PROC).
51
- 2. The annotations were made in a comprehensive fashion, so that nested entities were marked, and entities could be mapped to more than one UMLS concept. In particular: (a) If a mention can refer to more than one Semantic Group, all the relevant Semantic Groups should be annotated. For instance, the mention “récidive” (recurrence) in the phrase “prévention des récidives” (recurrence prevention) should be annotated with the category “DISORDER” (CUI C2825055) and the category “PHENOMENON” (CUI C0034897); (b) If a mention can refer to more than one UMLS concept within the same Semantic Group, all the relevant concepts should be annotated. For instance, the mention “maniaques” (obsessive) in the phrase “patients maniaques” (obsessive patients) should be annotated with CUIs C0564408 and C0338831 (category “DISORDER”); (c) Entities which span overlaps with that of another entity should still be annotated. For instance, in the phrase “infarctus du myocarde” (myocardial infarction), the mention “myocarde” (myocardium) should be annotated with category “ANATOMY” (CUI C0027061) and the mention “infarctus du myocarde” should be annotated with category “DISORDER” (CUI C0027051)
52
- """
53
-
54
- VERSION = datasets.Version("1.1.0")
55
-
56
- # This is an example of a dataset with multiple configurations.
57
- # If you don't want/need to define several sub-sets in your dataset,
58
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
59
-
60
- # If you need to make complex sub-parts in the datasets with configurable options
61
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
62
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
63
-
64
- # You will be able to load one or the other configurations in the following list with
65
- BUILDER_CONFIGS = [
66
- datasets.BuilderConfig(name="EMEA", version=VERSION, description="information on marketed drugs from the European Medicines Agency (EMEA)"),
67
- datasets.BuilderConfig(name="MEDLINE", version=VERSION, description="The titles of MEDLINE-indexed articles"),
68
- ]
69
-
70
- def _info(self):
71
- # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
72
- if self.config.name == "EMEA": # This is the name of the configuration selected in BUILDER_CONFIGS above
73
- features = datasets.Features(
74
- {
75
- "docid": datasets.Value("string"),
76
- "words": datasets.Sequence(datasets.Value("string")),
77
- "ner_tags": datasets.Sequence(datasets.Value("int32")),
78
- # These are the features of your dataset like images, labels ...
79
- }
80
- )
81
- else: # This is an example to show how to have different features for "first_domain" and "second_domain"
82
- features = datasets.Features(
83
- {
84
- "docid": datasets.Value("string"),
85
- "words": datasets.Sequence(datasets.Value("string")),
86
- "ner_tags": datasets.Sequence(datasets.Value("int32")),
87
- # These are the features of your dataset like images, labels ...
88
- }
89
- )
90
- return datasets.DatasetInfo(
91
- # This is the description that will appear on the datasets page.
92
- description=_DESCRIPTION,
93
- # This defines the different columns of the dataset and their types
94
- features=features, # Here we define them above because they are different between the two configurations
95
- # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
96
- # specify them. They'll be used if as_supervised=True in builder.as_dataset.
97
- # supervised_keys=("sentence", "label"),
98
- # Homepage of the dataset for documentation
99
- homepage=_HOMEPAGE,
100
- # License for the dataset if available
101
- # Citation for the dataset
102
- citation=_CITATION,
103
- )
104
-
105
- # def _split_generators(self, dl_manager):
106
- # # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
107
- # # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
108
-
109
- # # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
110
- # # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
111
- # # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
112
- # urls = _URLS[self.config.name]
113
- # data_dir = dl_manager.download_and_extract(urls)
114
- # return [
115
- # datasets.SplitGenerator(
116
- # name=datasets.Split.TRAIN,
117
- # # These kwargs will be passed to _generate_examples
118
- # gen_kwargs={
119
- # "filepath": os.path.join(data_dir, "train.jsonl"),
120
- # "split": "train",
121
- # },
122
- # ),
123
- # datasets.SplitGenerator(
124
- # name=datasets.Split.VALIDATION,
125
- # # These kwargs will be passed to _generate_examples
126
- # gen_kwargs={
127
- # "filepath": os.path.join(data_dir, "dev.jsonl"),
128
- # "split": "dev",
129
- # },
130
- # ),
131
- # datasets.SplitGenerator(
132
- # name=datasets.Split.TEST,
133
- # # These kwargs will be passed to _generate_examples
134
- # gen_kwargs={
135
- # "filepath": os.path.join(data_dir, "test.jsonl"),
136
- # "split": "test"
137
- # },
138
- # ),
139
- # ]
140
-
141
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
142
- def _generate_examples(self, filepath, split):
143
- # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
144
- # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
145
- with open(filepath, encoding="utf-8") as f:
146
- for key, row in enumerate(f):
147
- data = json.loads(row)
148
- if self.config.name == "EMEA":
149
- yield key, {
150
- "docid": data["docid"],
151
- "words": data["words"],
152
- "ner_tags": data["ner_tags"],
153
- }
154
- else:
155
- yield key, {
156
- "docid": data["docid"],
157
- "words": data["words"],
158
- "ner_tags": data["ner_tags"],
159
- }
160
-