system HF staff commited on
Commit
aba5a20
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.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
+ - found
6
+ languages:
7
+ - de
8
+ licenses:
9
+ - cc-by-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - structure-prediction
18
+ task_ids:
19
+ - named-entity-recognition
20
+ ---
21
+
22
+ # Dataset Card for SmartData
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** https://www.dfki.de/web/forschung/projekte-publikationen/publikationen-uebersicht/publikation/9427/
50
+ - **Repository:** https://github.com/DFKI-NLP/smartdata-corpus
51
+ - **Paper:** https://www.dfki.de/fileadmin/user_upload/import/9427_lrec_smartdata_corpus.pdf
52
+ - **Leaderboard:**
53
+ - **Point of Contact:**
54
+
55
+ ### Dataset Summary
56
+
57
+ DFKI SmartData Corpus is a dataset of 2598 German-language documents
58
+ which has been annotated with fine-grained geo-entities, such as streets,
59
+ stops and routes, as well as standard named entity types. It has also
60
+ been annotated with a set of 15 traffic- and industry-related n-ary
61
+ relations and events, such as Accidents, Traffic jams, Acquisitions,
62
+ and Strikes. The corpus consists of newswire texts, Twitter messages,
63
+ and traffic reports from radio stations, police and railway companies.
64
+ It allows for training and evaluating both named entity recognition
65
+ algorithms that aim for fine-grained typing of geo-entities, as well
66
+ as n-ary relation extraction systems.
67
+
68
+ ### Supported Tasks and Leaderboards
69
+
70
+ NER
71
+
72
+ ### Languages
73
+
74
+ German
75
+
76
+ ## Dataset Structure
77
+
78
+ ### Data Instances
79
+
80
+ [More Information Needed]
81
+
82
+ ### Data Fields
83
+
84
+ - id: an identifier for the article the text came from
85
+ - tokens: a list of string tokens for the text of the article
86
+ - ner_tags: a corresponding list of NER tags in the BIO format
87
+
88
+ ### Data Splits
89
+
90
+ [More Information Needed]
91
+
92
+ ## Dataset Creation
93
+
94
+ ### Curation Rationale
95
+
96
+ [More Information Needed]
97
+
98
+ ### Source Data
99
+
100
+ #### Initial Data Collection and Normalization
101
+
102
+ [More Information Needed]
103
+
104
+ #### Who are the source language producers?
105
+
106
+ [More Information Needed]
107
+
108
+ ### Annotations
109
+
110
+ #### Annotation process
111
+
112
+ [More Information Needed]
113
+
114
+ #### Who are the annotators?
115
+
116
+ [More Information Needed]
117
+
118
+ ### Personal and Sensitive Information
119
+
120
+ [More Information Needed]
121
+
122
+ ## Considerations for Using the Data
123
+
124
+ ### Social Impact of Dataset
125
+
126
+ [More Information Needed]
127
+
128
+ ### Discussion of Biases
129
+
130
+ [More Information Needed]
131
+
132
+ ### Other Known Limitations
133
+
134
+ [More Information Needed]
135
+
136
+ ## Additional Information
137
+
138
+ ### Dataset Curators
139
+
140
+ [More Information Needed]
141
+
142
+ ### Licensing Information
143
+
144
+ CC-BY 4.0
145
+
146
+ ### Citation Information
147
+
148
+ ```
149
+ @InProceedings{SCHIERSCH18.85,
150
+ author = {Martin Schiersch and Veselina Mironova and Maximilian Schmitt and Philippe Thomas and Aleksandra Gabryszak and Leonhard Hennig},
151
+ title = "{A German Corpus for Fine-Grained Named Entity Recognition and Relation Extraction of Traffic and Industry Events}",
152
+ booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)},
153
+ year = {2018},
154
+ month = {May 7-12, 2018},
155
+ address = {Miyazaki, Japan},
156
+ editor = {Nicoletta Calzolari (Conference chair) and Khalid Choukri and Christopher Cieri and Thierry Declerck and Sara Goggi and Koiti Hasida and Hitoshi Isahara and Bente Maegaard and Joseph Mariani and Hélène Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis and Takenobu Tokunaga},
157
+ publisher = {European Language Resources Association (ELRA)},
158
+ isbn = {979-10-95546-00-9},
159
+ language = {english}
160
+ }
161
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"smartdata-v3_20200302": {"description": "DFKI SmartData Corpus is a dataset of 2598 German-language documents\nwhich has been annotated with fine-grained geo-entities, such as streets,\nstops and routes, as well as standard named entity types. It has also\nbeen annotated with a set of 15 traffic- and industry-related n-ary\nrelations and events, such as Accidents, Traffic jams, Acquisitions,\nand Strikes. The corpus consists of newswire texts, Twitter messages,\nand traffic reports from radio stations, police and railway companies.\nIt allows for training and evaluating both named entity recognition\nalgorithms that aim for fine-grained typing of geo-entities, as well\nas n-ary relation extraction systems.", "citation": "@InProceedings{SCHIERSCH18.85,\n author = {Martin Schiersch and Veselina Mironova and Maximilian Schmitt and Philippe Thomas and Aleksandra Gabryszak and Leonhard Hennig},\n title = \"{A German Corpus for Fine-Grained Named Entity Recognition and Relation Extraction of Traffic and Industry Events}\",\n booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)},\n year = {2018},\n month = {May 7-12, 2018},\n address = {Miyazaki, Japan},\n editor = {Nicoletta Calzolari (Conference chair) and Khalid Choukri and Christopher Cieri and Thierry Declerck and Sara Goggi and Koiti Hasida and Hitoshi Isahara and Bente Maegaard and Joseph Mariani and H\u00e9l\u00e8ne Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis and Takenobu Tokunaga},\n publisher = {European Language Resources Association (ELRA)},\n isbn = {979-10-95546-00-9},\n language = {english}\n }\n", "homepage": "https://www.dfki.de/web/forschung/projekte-publikationen/publikationen-uebersicht/publikation/9427/", "license": "CC-BY 4.0", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "ner_tags": {"feature": {"num_classes": 33, "names": ["O", "B-DATE", "I-DATE", "B-DISASTER_TYPE", "I-DISASTER_TYPE", "B-DISTANCE", "I-DISTANCE", "B-DURATION", "I-DURATION", "B-LOCATION", "I-LOCATION", "B-LOCATION_CITY", "I-LOCATION_CITY", "B-LOCATION_ROUTE", "I-LOCATION_ROUTE", "B-LOCATION_STOP", "I-LOCATION_STOP", "B-LOCATION_STREET", "I-LOCATION_STREET", "B-NUMBER", "I-NUMBER", "B-ORGANIZATION", "I-ORGANIZATION", "B-ORGANIZATION_COMPANY", "I-ORGANIZATION_COMPANY", "B-ORG_POSITION", "I-ORG_POSITION", "B-PERSON", "I-PERSON", "B-TIME", "I-TIME", "B-TRIGGER", "I-TRIGGER"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "smartdata", "config_name": "smartdata-v3_20200302", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2124312, "num_examples": 1861, "dataset_name": "smartdata"}, "test": {"name": "test", "num_bytes": 266529, "num_examples": 230, "dataset_name": "smartdata"}, "validation": {"name": "validation", "num_bytes": 258681, "num_examples": 228, "dataset_name": "smartdata"}}, "download_checksums": {"https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/train.json.gz": {"num_bytes": 14946657, "checksum": "9fbf3edc25e2ef94b13abdcafb14a4664f5de14f416865c5be2d17b2b8c3a8bc"}, "https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/dev.json.gz": {"num_bytes": 1825100, "checksum": "440c4ee02dc5d638d08288aeafa8a88cbb214ab1a97f314e9bbc4c46138bb58f"}, "https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/test.json.gz": {"num_bytes": 2109025, "checksum": "0317e79ef66f0b45bdb2e6572e97f345078d0a3ec644f2d20f7c72c681231d54"}}, "download_size": 18880782, "post_processing_size": null, "dataset_size": 2649522, "size_in_bytes": 21530304}}
dummy/smartdata-v3_20200302/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a50c35ed5802c2fcfce92c2f941670c0f4d0b953f438003577e90fb79bf12a7b
3
+ size 34414
smartdata.py ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
+ DFKI SmartData Corpus is a dataset of 2598 German-language documents
17
+ which has been annotated with fine-grained geo-entities, such as streets,
18
+ stops and routes, as well as standard named entity types."""
19
+
20
+ from __future__ import absolute_import, division, print_function
21
+
22
+ import re
23
+ from json import JSONDecodeError, JSONDecoder
24
+
25
+ import datasets
26
+
27
+
28
+ _CITATION = """\
29
+ @InProceedings{SCHIERSCH18.85,
30
+ author = {Martin Schiersch and Veselina Mironova and Maximilian Schmitt and Philippe Thomas and Aleksandra Gabryszak and Leonhard Hennig},
31
+ title = "{A German Corpus for Fine-Grained Named Entity Recognition and Relation Extraction of Traffic and Industry Events}",
32
+ booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)},
33
+ year = {2018},
34
+ month = {May 7-12, 2018},
35
+ address = {Miyazaki, Japan},
36
+ editor = {Nicoletta Calzolari (Conference chair) and Khalid Choukri and Christopher Cieri and Thierry Declerck and Sara Goggi and Koiti Hasida and Hitoshi Isahara and Bente Maegaard and Joseph Mariani and Hélène Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis and Takenobu Tokunaga},
37
+ publisher = {European Language Resources Association (ELRA)},
38
+ isbn = {979-10-95546-00-9},
39
+ language = {english}
40
+ }
41
+ """
42
+
43
+ _DESCRIPTION = """\
44
+ DFKI SmartData Corpus is a dataset of 2598 German-language documents
45
+ which has been annotated with fine-grained geo-entities, such as streets,
46
+ stops and routes, as well as standard named entity types. It has also
47
+ been annotated with a set of 15 traffic- and industry-related n-ary
48
+ relations and events, such as Accidents, Traffic jams, Acquisitions,
49
+ and Strikes. The corpus consists of newswire texts, Twitter messages,
50
+ and traffic reports from radio stations, police and railway companies.
51
+ It allows for training and evaluating both named entity recognition
52
+ algorithms that aim for fine-grained typing of geo-entities, as well
53
+ as n-ary relation extraction systems."""
54
+
55
+ _HOMEPAGE = "https://www.dfki.de/web/forschung/projekte-publikationen/publikationen-uebersicht/publikation/9427/"
56
+
57
+ _LICENSE = "CC-BY 4.0"
58
+
59
+ _URLs = {
60
+ "train": "https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/train.json.gz",
61
+ "dev": "https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/dev.json.gz",
62
+ "test": "https://github.com/DFKI-NLP/smartdata-corpus/raw/master/v3_20200302/test.json.gz",
63
+ }
64
+
65
+
66
+ class Smartdata(datasets.GeneratorBasedBuilder):
67
+ """DFKI SmartData Corpus is a dataset of 2598 German-language documents
68
+ which has been annotated with fine-grained geo-entities, such as streets,
69
+ stops and routes, as well as standard named entity types."""
70
+
71
+ VERSION = datasets.Version("1.1.0")
72
+
73
+ # This is an example of a dataset with multiple configurations.
74
+ # If you don't want/need to define several sub-sets in your dataset,
75
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
76
+
77
+ # If you need to make complex sub-parts in the datasets with configurable options
78
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
79
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
80
+
81
+ # You will be able to load one or the other configurations in the following list with
82
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
83
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
84
+ BUILDER_CONFIGS = [
85
+ datasets.BuilderConfig(name="smartdata-v3_20200302", version=VERSION, description="SmartData v3"),
86
+ ]
87
+
88
+ def _info(self):
89
+ features = datasets.Features(
90
+ {
91
+ "id": datasets.Value("string"),
92
+ "tokens": datasets.Sequence(datasets.Value("string")),
93
+ "ner_tags": datasets.Sequence(
94
+ datasets.features.ClassLabel(
95
+ names=[
96
+ "O",
97
+ "B-DATE",
98
+ "I-DATE",
99
+ "B-DISASTER_TYPE",
100
+ "I-DISASTER_TYPE",
101
+ "B-DISTANCE",
102
+ "I-DISTANCE",
103
+ "B-DURATION",
104
+ "I-DURATION",
105
+ "B-LOCATION",
106
+ "I-LOCATION",
107
+ "B-LOCATION_CITY",
108
+ "I-LOCATION_CITY",
109
+ "B-LOCATION_ROUTE",
110
+ "I-LOCATION_ROUTE",
111
+ "B-LOCATION_STOP",
112
+ "I-LOCATION_STOP",
113
+ "B-LOCATION_STREET",
114
+ "I-LOCATION_STREET",
115
+ "B-NUMBER",
116
+ "I-NUMBER",
117
+ "B-ORGANIZATION",
118
+ "I-ORGANIZATION",
119
+ "B-ORGANIZATION_COMPANY",
120
+ "I-ORGANIZATION_COMPANY",
121
+ "B-ORG_POSITION",
122
+ "I-ORG_POSITION",
123
+ "B-PERSON",
124
+ "I-PERSON",
125
+ "B-TIME",
126
+ "I-TIME",
127
+ "B-TRIGGER",
128
+ "I-TRIGGER",
129
+ ]
130
+ )
131
+ ),
132
+ }
133
+ )
134
+
135
+ return datasets.DatasetInfo(
136
+ # This is the description that will appear on the datasets page.
137
+ description=_DESCRIPTION,
138
+ # This defines the different columns of the dataset and their types
139
+ features=features, # Here we define them above because they are different between the two configurations
140
+ # If there's a common (input, target) tuple from the features,
141
+ # specify them here. They'll be used if as_supervised=True in
142
+ # builder.as_dataset.
143
+ supervised_keys=None,
144
+ # Homepage of the dataset for documentation
145
+ homepage=_HOMEPAGE,
146
+ # License for the dataset if available
147
+ license=_LICENSE,
148
+ # Citation for the dataset
149
+ citation=_CITATION,
150
+ )
151
+
152
+ def _split_generators(self, dl_manager):
153
+ """Returns SplitGenerators."""
154
+
155
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
156
+ # 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.
157
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
158
+ data_dir = dl_manager.download_and_extract(_URLs)
159
+ return [
160
+ datasets.SplitGenerator(
161
+ name=datasets.Split.TRAIN,
162
+ # These kwargs will be passed to _generate_examples
163
+ gen_kwargs={"filepath": data_dir["train"], "split": "train"},
164
+ ),
165
+ datasets.SplitGenerator(
166
+ name=datasets.Split.TEST,
167
+ # These kwargs will be passed to _generate_examples
168
+ gen_kwargs={"filepath": data_dir["test"], "split": "test"},
169
+ ),
170
+ datasets.SplitGenerator(
171
+ name=datasets.Split.VALIDATION,
172
+ # These kwargs will be passed to _generate_examples
173
+ gen_kwargs={"filepath": data_dir["dev"], "split": "dev"},
174
+ ),
175
+ ]
176
+
177
+ def _generate_examples(self, filepath, split):
178
+ """ Yields examples. """
179
+
180
+ NOT_WHITESPACE = re.compile(r"[^\s]")
181
+
182
+ def decode_stacked(document, pos=0, decoder=JSONDecoder()):
183
+ while True:
184
+ match = NOT_WHITESPACE.search(document, pos)
185
+ if not match:
186
+ return
187
+ pos = match.start()
188
+ try:
189
+ obj, pos = decoder.raw_decode(document, pos)
190
+ except JSONDecodeError:
191
+ raise
192
+ yield obj
193
+
194
+ with open(filepath, encoding="utf-8") as f:
195
+ raw = f.read()
196
+
197
+ for a in decode_stacked(raw):
198
+ text = a["text"]["string"]
199
+ aid = a["id"]
200
+ toks = []
201
+ lbls = []
202
+ for x in a["tokens"]["array"]:
203
+ toks.append(text[x["span"]["start"] : x["span"]["end"]])
204
+ lbls.append(x["ner"]["string"])
205
+
206
+ yield aid, {
207
+ "id": aid,
208
+ "tokens": toks,
209
+ "ner_tags": lbls,
210
+ }