system HF staff commited on
Commit
fba7825
โ€ข
1 Parent(s): a4b90e0

Update files from the datasets library (from 1.1.3)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.1.3

Files changed (2) hide show
  1. dataset_infos.json +1 -1
  2. germeval_14.py +76 -14
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"germeval_14": {"description": "The GermEval 2014 NER Shared Task builds on a new dataset with German Named Entity annotation with the following properties: - The data was sampled from German Wikipedia and News Corpora as a collection of citations. - The dataset covers over 31,000 sentences corresponding to over 590,000 tokens. - The NER annotation uses the NoSta-D guidelines, which extend the T\u00fcbingen Treebank guidelines, using four main NER categories with sub-structure, and annotating embeddings among NEs such as [ORG FC Kickers [LOC Darmstadt]].\n", "citation": "@inproceedings{benikova-etal-2014-nosta,\n title = {NoSta-D Named Entity Annotation for German: Guidelines and Dataset},\n author = {Benikova, Darina and\n Biemann, Chris and\n Reznicek, Marc},\n booktitle = {Proceedings of the Ninth International Conference on Language Resources and Evaluation ({LREC}'14)},\n month = {may},\n year = {2014},\n address = {Reykjavik, Iceland},\n publisher = {European Language Resources Association (ELRA)},\n url = {http://www.lrec-conf.org/proceedings/lrec2014/pdf/276_Paper.pdf},\n pages = {2524--2531},\n}\n", "homepage": "https://sites.google.com/site/germeval2014ner/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "labels": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "nested-labels": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "germ_eval14", "config_name": "germeval_14", "version": {"version_str": "2.0.0", "description": null, "datasets_version_to_prepare": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 11305075, "num_examples": 24000, "dataset_name": "germ_eval14"}, "validation": {"name": "validation", "num_bytes": 1036186, "num_examples": 2200, "dataset_name": "germ_eval14"}, "test": {"name": "test", "num_bytes": 2407839, "num_examples": 5100, "dataset_name": "germ_eval14"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1Jjhbal535VVz2ap4v4r_rN1UEHTdLK5P": {"num_bytes": 7882358, "checksum": "1e5a803d81f5fe6ade54700a7e8e9107a45edba80469d42e41a360550d1758e7"}, "https://drive.google.com/uc?export=download&id=1ZfRcQThdtAR5PPRjIDtrVP7BtXSCUBbm": {"num_bytes": 723876, "checksum": "d69d1347847e3ac0d1bfd14d7e5c0713dcb82899624301ced6df807dbb070056"}, "https://drive.google.com/uc?export=download&id=1u9mb7kNJHWQCWyweMDRMuTFoOHOfeBTH": {"num_bytes": 1682738, "checksum": "9405e49532379f3aee048851d116b35823d31c04e9521b87a9c4e6572c269097"}}, "download_size": 10288972, "post_processing_size": null, "dataset_size": 14749100, "size_in_bytes": 25038072}}
1
+ {"germeval_14": {"description": "The GermEval 2014 NER Shared Task builds on a new dataset with German Named Entity annotation with the following properties: - The data was sampled from German Wikipedia and News Corpora as a collection of citations. - The dataset covers over 31,000 sentences corresponding to over 590,000 tokens. - The NER annotation uses the NoSta-D guidelines, which extend the T\u00fcbingen Treebank guidelines, using four main NER categories with sub-structure, and annotating embeddings among NEs such as [ORG FC Kickers [LOC Darmstadt]].\n", "citation": "@inproceedings{benikova-etal-2014-nosta,\n title = {NoSta-D Named Entity Annotation for German: Guidelines and Dataset},\n author = {Benikova, Darina and\n Biemann, Chris and\n Reznicek, Marc},\n booktitle = {Proceedings of the Ninth International Conference on Language Resources and Evaluation ({LREC}'14)},\n month = {may},\n year = {2014},\n address = {Reykjavik, Iceland},\n publisher = {European Language Resources Association (ELRA)},\n url = {http://www.lrec-conf.org/proceedings/lrec2014/pdf/276_Paper.pdf},\n pages = {2524--2531},\n}\n", "homepage": "https://sites.google.com/site/germeval2014ner/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"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": 25, "names": ["O", "B-LOC", "I-LOC", "B-LOCderiv", "I-LOCderiv", "B-LOCpart", "I-LOCpart", "B-ORG", "I-ORG", "B-ORGderiv", "I-ORGderiv", "B-ORGpart", "I-ORGpart", "B-OTH", "I-OTH", "B-OTHderiv", "I-OTHderiv", "B-OTHpart", "I-OTHpart", "B-PER", "I-PER", "B-PERderiv", "I-PERderiv", "B-PERpart", "I-PERpart"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "nested_ner_tags": {"feature": {"num_classes": 25, "names": ["O", "B-LOC", "I-LOC", "B-LOCderiv", "I-LOCderiv", "B-LOCpart", "I-LOCpart", "B-ORG", "I-ORG", "B-ORGderiv", "I-ORGderiv", "B-ORGpart", "I-ORGpart", "B-OTH", "I-OTH", "B-OTHderiv", "I-OTHderiv", "B-OTHpart", "I-OTHpart", "B-PER", "I-PER", "B-PERderiv", "I-PERderiv", "B-PERpart", "I-PERpart"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "germ_eval14", "config_name": "germeval_14", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 13816714, "num_examples": 24000, "dataset_name": "germ_eval14"}, "validation": {"name": "validation", "num_bytes": 1266974, "num_examples": 2200, "dataset_name": "germ_eval14"}, "test": {"name": "test", "num_bytes": 2943201, "num_examples": 5100, "dataset_name": "germ_eval14"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1Jjhbal535VVz2ap4v4r_rN1UEHTdLK5P": {"num_bytes": 7882358, "checksum": "1e5a803d81f5fe6ade54700a7e8e9107a45edba80469d42e41a360550d1758e7"}, "https://drive.google.com/uc?export=download&id=1ZfRcQThdtAR5PPRjIDtrVP7BtXSCUBbm": {"num_bytes": 723876, "checksum": "d69d1347847e3ac0d1bfd14d7e5c0713dcb82899624301ced6df807dbb070056"}, "https://drive.google.com/uc?export=download&id=1u9mb7kNJHWQCWyweMDRMuTFoOHOfeBTH": {"num_bytes": 1682738, "checksum": "9405e49532379f3aee048851d116b35823d31c04e9521b87a9c4e6572c269097"}}, "download_size": 10288972, "post_processing_size": null, "dataset_size": 18026889, "size_in_bytes": 28315861}}
germeval_14.py CHANGED
@@ -85,8 +85,68 @@ class GermEval14(datasets.GeneratorBasedBuilder):
85
  "id": datasets.Value("string"),
86
  "source": datasets.Value("string"),
87
  "tokens": datasets.Sequence(datasets.Value("string")),
88
- "labels": datasets.Sequence(datasets.Value("string")),
89
- "nested-labels": datasets.Sequence(datasets.Value("string")),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
  ),
92
  supervised_keys=None,
@@ -110,8 +170,8 @@ class GermEval14(datasets.GeneratorBasedBuilder):
110
  data = csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
111
  current_source = ""
112
  current_tokens = []
113
- current_labels = []
114
- current_nested_labels = []
115
  sentence_counter = 0
116
  for row in data:
117
  if row:
@@ -120,37 +180,39 @@ class GermEval14(datasets.GeneratorBasedBuilder):
120
  continue
121
  id_, token, label, nested_label = row[:4]
122
  current_tokens.append(token)
123
- current_labels.append(label)
124
- current_nested_labels.append(nested_label)
125
  else:
126
  # New sentence
127
  if not current_tokens:
128
  # Consecutive empty lines will cause empty sentences
129
  continue
130
- assert len(current_tokens) == len(current_labels), "๐Ÿ’” between len of tokens & labels"
131
- assert len(current_labels) == len(current_nested_labels), "๐Ÿ’” between len of labels & nested labels"
 
 
132
  assert current_source, "๐Ÿ’ฅ Source for new sentence was not set"
133
  sentence = (
134
  sentence_counter,
135
  {
136
  "id": str(sentence_counter),
137
  "tokens": current_tokens,
138
- "labels": current_labels,
139
- "nested-labels": current_nested_labels,
140
  "source": current_source,
141
  },
142
  )
143
  sentence_counter += 1
144
  current_tokens = []
145
- current_labels = []
146
- current_nested_labels = []
147
  current_source = ""
148
  yield sentence
149
  # Don't forget last sentence in dataset ๐Ÿง
150
  yield sentence_counter, {
151
  "id": str(sentence_counter),
152
  "tokens": current_tokens,
153
- "labels": current_labels,
154
- "nested-labels": current_nested_labels,
155
  "source": current_source,
156
  }
85
  "id": datasets.Value("string"),
86
  "source": datasets.Value("string"),
87
  "tokens": datasets.Sequence(datasets.Value("string")),
88
+ "ner_tags": datasets.Sequence(
89
+ datasets.features.ClassLabel(
90
+ names=[
91
+ "O",
92
+ "B-LOC",
93
+ "I-LOC",
94
+ "B-LOCderiv",
95
+ "I-LOCderiv",
96
+ "B-LOCpart",
97
+ "I-LOCpart",
98
+ "B-ORG",
99
+ "I-ORG",
100
+ "B-ORGderiv",
101
+ "I-ORGderiv",
102
+ "B-ORGpart",
103
+ "I-ORGpart",
104
+ "B-OTH",
105
+ "I-OTH",
106
+ "B-OTHderiv",
107
+ "I-OTHderiv",
108
+ "B-OTHpart",
109
+ "I-OTHpart",
110
+ "B-PER",
111
+ "I-PER",
112
+ "B-PERderiv",
113
+ "I-PERderiv",
114
+ "B-PERpart",
115
+ "I-PERpart",
116
+ ]
117
+ )
118
+ ),
119
+ "nested_ner_tags": datasets.Sequence(
120
+ datasets.features.ClassLabel(
121
+ names=[
122
+ "O",
123
+ "B-LOC",
124
+ "I-LOC",
125
+ "B-LOCderiv",
126
+ "I-LOCderiv",
127
+ "B-LOCpart",
128
+ "I-LOCpart",
129
+ "B-ORG",
130
+ "I-ORG",
131
+ "B-ORGderiv",
132
+ "I-ORGderiv",
133
+ "B-ORGpart",
134
+ "I-ORGpart",
135
+ "B-OTH",
136
+ "I-OTH",
137
+ "B-OTHderiv",
138
+ "I-OTHderiv",
139
+ "B-OTHpart",
140
+ "I-OTHpart",
141
+ "B-PER",
142
+ "I-PER",
143
+ "B-PERderiv",
144
+ "I-PERderiv",
145
+ "B-PERpart",
146
+ "I-PERpart",
147
+ ]
148
+ )
149
+ ),
150
  }
151
  ),
152
  supervised_keys=None,
170
  data = csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
171
  current_source = ""
172
  current_tokens = []
173
+ current_ner_tags = []
174
+ current_nested_ner_tags = []
175
  sentence_counter = 0
176
  for row in data:
177
  if row:
180
  continue
181
  id_, token, label, nested_label = row[:4]
182
  current_tokens.append(token)
183
+ current_ner_tags.append(label)
184
+ current_nested_ner_tags.append(nested_label)
185
  else:
186
  # New sentence
187
  if not current_tokens:
188
  # Consecutive empty lines will cause empty sentences
189
  continue
190
+ assert len(current_tokens) == len(current_ner_tags), "๐Ÿ’” between len of tokens & labels"
191
+ assert len(current_ner_tags) == len(
192
+ current_nested_ner_tags
193
+ ), "๐Ÿ’” between len of labels & nested labels"
194
  assert current_source, "๐Ÿ’ฅ Source for new sentence was not set"
195
  sentence = (
196
  sentence_counter,
197
  {
198
  "id": str(sentence_counter),
199
  "tokens": current_tokens,
200
+ "ner_tags": current_ner_tags,
201
+ "nested_ner_tags": current_nested_ner_tags,
202
  "source": current_source,
203
  },
204
  )
205
  sentence_counter += 1
206
  current_tokens = []
207
+ current_ner_tags = []
208
+ current_nested_ner_tags = []
209
  current_source = ""
210
  yield sentence
211
  # Don't forget last sentence in dataset ๐Ÿง
212
  yield sentence_counter, {
213
  "id": str(sentence_counter),
214
  "tokens": current_tokens,
215
+ "ner_tags": current_ner_tags,
216
+ "nested_ner_tags": current_nested_ner_tags,
217
  "source": current_source,
218
  }