system HF staff commited on
Commit
6600efc
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,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - de
8
+ - fr
9
+ - nl
10
+ licenses:
11
+ - cc0-1-0
12
+ multilinguality:
13
+ - multilingual
14
+ size_categories:
15
+ - n<1K
16
+ source_datasets:
17
+ - original
18
+ task_categories:
19
+ - structure-prediction
20
+ task_ids:
21
+ - named-entity-recognition
22
+ ---
23
+
24
+ # Dataset Card for Europeana Newspapers
25
+
26
+ ## Table of Contents
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-instances)
34
+ - [Data Splits](#data-instances)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+
49
+ ## Dataset Description
50
+
51
+ - **Homepage:** [Github](https://github.com/EuropeanaNewspapers/ner-corpora)
52
+ - **Repository:** [Github](https://github.com/EuropeanaNewspapers/ner-corpora)
53
+ - **Paper:** [Aclweb](https://www.aclweb.org/anthology/L16-1689/)
54
+ - **Leaderboard:**
55
+ - **Point of Contact:**
56
+
57
+ ### Dataset Summary
58
+
59
+ [More Information Needed]
60
+
61
+ ### Supported Tasks and Leaderboards
62
+
63
+ [More Information Needed]
64
+
65
+ ### Languages
66
+
67
+ [More Information Needed]
68
+
69
+ ## Dataset Structure
70
+
71
+ ### Data Instances
72
+
73
+ [More Information Needed]
74
+
75
+ ### Data Fields
76
+
77
+ [More Information Needed]
78
+
79
+ ### Data Splits
80
+
81
+ [More Information Needed]
82
+
83
+ ## Dataset Creation
84
+
85
+ ### Curation Rationale
86
+
87
+ [More Information Needed]
88
+
89
+ ### Source Data
90
+
91
+ #### Initial Data Collection and Normalization
92
+
93
+ [More Information Needed]
94
+
95
+ #### Who are the source language producers?
96
+
97
+ [More Information Needed]
98
+
99
+ ### Annotations
100
+
101
+ #### Annotation process
102
+
103
+ [More Information Needed]
104
+
105
+ #### Who are the annotators?
106
+
107
+ [More Information Needed]
108
+
109
+ ### Personal and Sensitive Information
110
+
111
+ [More Information Needed]
112
+
113
+ ## Considerations for Using the Data
114
+
115
+ ### Social Impact of Dataset
116
+
117
+ [More Information Needed]
118
+
119
+ ### Discussion of Biases
120
+
121
+ [More Information Needed]
122
+
123
+ ### Other Known Limitations
124
+
125
+ [More Information Needed]
126
+
127
+ ## Additional Information
128
+
129
+ ### Dataset Curators
130
+
131
+ [More Information Needed]
132
+
133
+ ### Licensing Information
134
+
135
+ [More Information Needed]
136
+
137
+ ### Citation Information
138
+
139
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"fr-bnf": {"description": "The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.\n", "citation": "@InProceedings{NEUDECKER16.110,\n author = {Clemens Neudecker},\n title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},\n booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},\n year = {2016},\n month = {may},\n date = {23-28},\n location = {Portoro\u017e, Slovenia},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n address = {Paris, France},\n isbn = {978-2-9517408-9-1},\n language = {english}\n }\n", "homepage": "https://github.com/EuropeanaNewspapers/ner-corpora", "license": "", "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": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "euro_news", "config_name": "fr-bnf", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3340299, "num_examples": 1, "dataset_name": "euro_news"}}, "download_checksums": {"https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/enp_FR.bnf.bio/enp_FR.bnf.bio": {"num_bytes": 1542418, "checksum": "730402f0f21c4d538b93a969a8eeedbec37edc49d2133cd18a26b925d93b0961"}}, "download_size": 1542418, "post_processing_size": null, "dataset_size": 3340299, "size_in_bytes": 4882717}, "nl-kb": {"description": "The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.\n", "citation": "@InProceedings{NEUDECKER16.110,\n author = {Clemens Neudecker},\n title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},\n booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},\n year = {2016},\n month = {may},\n date = {23-28},\n location = {Portoro\u017e, Slovenia},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n address = {Paris, France},\n isbn = {978-2-9517408-9-1},\n language = {english}\n }\n", "homepage": "https://github.com/EuropeanaNewspapers/ner-corpora", "license": "", "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": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "euro_news", "config_name": "nl-kb", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3104213, "num_examples": 1, "dataset_name": "euro_news"}}, "download_checksums": {"https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/enp_NL.kb.bio/enp_NL.kb.bio": {"num_bytes": 1502162, "checksum": "0928f045ae3de9d5d85dbba4d50f206633b924eb3897783575d4581631d22674"}}, "download_size": 1502162, "post_processing_size": null, "dataset_size": 3104213, "size_in_bytes": 4606375}, "de-sbb": {"description": "The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.\n", "citation": "@InProceedings{NEUDECKER16.110,\n author = {Clemens Neudecker},\n title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},\n booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},\n year = {2016},\n month = {may},\n date = {23-28},\n location = {Portoro\u017e, Slovenia},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n address = {Paris, France},\n isbn = {978-2-9517408-9-1},\n language = {english}\n }\n", "homepage": "https://github.com/EuropeanaNewspapers/ner-corpora", "license": "", "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": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "euro_news", "config_name": "de-sbb", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 817295, "num_examples": 1, "dataset_name": "euro_news"}}, "download_checksums": {"https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/enp_DE.sbb.bio/enp_DE.sbb.bio": {"num_bytes": 407756, "checksum": "6cc234c43dc4f6539feddc339f119bf6afb24c4981ab9eb46cbebd9cb06af3d7"}}, "download_size": 407756, "post_processing_size": null, "dataset_size": 817295, "size_in_bytes": 1225051}, "de-onb": {"description": "The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.\n", "citation": "@InProceedings{NEUDECKER16.110,\n author = {Clemens Neudecker},\n title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},\n booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},\n year = {2016},\n month = {may},\n date = {23-28},\n location = {Portoro\u017e, Slovenia},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n address = {Paris, France},\n isbn = {978-2-9517408-9-1},\n language = {english}\n }\n", "homepage": "https://github.com/EuropeanaNewspapers/ner-corpora", "license": "", "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": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "euro_news", "config_name": "de-onb", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 502369, "num_examples": 1, "dataset_name": "euro_news"}}, "download_checksums": {"https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/enp_DE.onb.bio/enp_DE.onb.bio": {"num_bytes": 271252, "checksum": "479b0862870391cffb6f53f556e4f6160120eeb19a66421f67fe99c0b4ba6bf7"}}, "download_size": 271252, "post_processing_size": null, "dataset_size": 502369, "size_in_bytes": 773621}, "de-lft": {"description": "The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.\n", "citation": "@InProceedings{NEUDECKER16.110,\n author = {Clemens Neudecker},\n title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},\n booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},\n year = {2016},\n month = {may},\n date = {23-28},\n location = {Portoro\u017e, Slovenia},\n editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},\n publisher = {European Language Resources Association (ELRA)},\n address = {Paris, France},\n isbn = {978-2-9517408-9-1},\n language = {english}\n }\n", "homepage": "https://github.com/EuropeanaNewspapers/ner-corpora", "license": "", "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": 7, "names": ["O", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "euro_news", "config_name": "de-lft", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1263429, "num_examples": 1, "dataset_name": "euro_news"}}, "download_checksums": {"https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/enp_DE.lft.bio/enp_DE.lft.bio": {"num_bytes": 677779, "checksum": "477b082283e9897094cf102b3bbdf182639771d93ec6fb0df0df908aeb796bce"}}, "download_size": 677779, "post_processing_size": null, "dataset_size": 1263429, "size_in_bytes": 1941208}}
dummy/de-lft/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c17f438d77f747c11c9d6b035e8268ad625e8d0f3d729d1e0d5c898dcb7b983
3
+ size 277
dummy/de-onb/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e65e454c99473ba81682122b2d2ddcacb963805cbd0e4e10f7777f072d49d8c7
3
+ size 277
dummy/de-sbb/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae7f7e800a12926f146b2004d1524663fe2444ab829ba075c9043546eaf6af8d
3
+ size 443
dummy/fr-bnf/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2b95fc70ac1be3f9f34d975985f0fb2073815cfc1df5b3abe10a9127ff9341c
3
+ size 294
dummy/nl-kb/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:482e6a97a350b39632c0839103a5e18dcb969731382a030def9fa6dc7076f6c5
3
+ size 275
euronews.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 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
+ """Named Entity Recognition corpora for Dutch, French, German from Europeana Newspapers."""
18
+
19
+ import logging
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @InProceedings{NEUDECKER16.110,
26
+ author = {Clemens Neudecker},
27
+ title = {An Open Corpus for Named Entity Recognition in Historic Newspapers},
28
+ booktitle = {Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016)},
29
+ year = {2016},
30
+ month = {may},
31
+ date = {23-28},
32
+ location = {Portorož, Slovenia},
33
+ editor = {Nicoletta Calzolari (Conference Chair) and Khalid Choukri and Thierry Declerck and Sara Goggi and Marko Grobelnik and Bente Maegaard and Joseph Mariani and Helene Mazo and Asuncion Moreno and Jan Odijk and Stelios Piperidis},
34
+ publisher = {European Language Resources Association (ELRA)},
35
+ address = {Paris, France},
36
+ isbn = {978-2-9517408-9-1},
37
+ language = {english}
38
+ }
39
+ """
40
+
41
+ _DESCRIPTION = """\
42
+ The corpora comprise of files per data provider that are encoded in the IOB format (Ramshaw & Marcus, 1995). The IOB format is a simple text chunking format that divides texts into single tokens per line, and, separated by a whitespace, tags to mark named entities. The most commonly used categories for tags are PER (person), LOC (location) and ORG (organization). To mark named entities that span multiple tokens, the tags have a prefix of either B- (beginning of named entity) or I- (inside of named entity). O (outside of named entity) tags are used to mark tokens that are not a named entity.
43
+ """
44
+
45
+ _URL = "https://raw.githubusercontent.com/EuropeanaNewspapers/ner-corpora/master/"
46
+ _FR_BNF = "enp_FR.bnf.bio/enp_FR.bnf.bio"
47
+ _NL_KB = "enp_NL.kb.bio/enp_NL.kb.bio"
48
+ _DE_SBB = "enp_DE.sbb.bio/enp_DE.sbb.bio"
49
+ _DE_ONB = "enp_DE.onb.bio/enp_DE.onb.bio"
50
+ _DE_LFT = "enp_DE.lft.bio/enp_DE.lft.bio"
51
+
52
+ _TAGS = [
53
+ "O",
54
+ "B-PER",
55
+ "I-PER",
56
+ "B-ORG",
57
+ "I-ORG",
58
+ "B-LOC",
59
+ "I-LOC",
60
+ ]
61
+
62
+
63
+ class EuroNewsConfig(datasets.BuilderConfig):
64
+ """BuilderConfig for Europana Newspaper"""
65
+
66
+ def __init__(self, **kwargs):
67
+ """BuilderConfig for Europana Newspaper.
68
+
69
+ Args:
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(EuroNewsConfig, self).__init__(**kwargs)
73
+
74
+
75
+ class Euronews(datasets.GeneratorBasedBuilder):
76
+ """Europana Newspaper dataset."""
77
+
78
+ BUILDER_CONFIGS = [
79
+ EuroNewsConfig(
80
+ name="fr-bnf", version=datasets.Version("1.0.0"), description="National Library of France Dataset"
81
+ ),
82
+ EuroNewsConfig(
83
+ name="nl-kb", version=datasets.Version("1.0.0"), description="National Library of the Netherlands Dataset"
84
+ ),
85
+ EuroNewsConfig(name="de-sbb", version=datasets.Version("1.0.0"), description="Berlin State Library Dataset"),
86
+ EuroNewsConfig(
87
+ name="de-onb", version=datasets.Version("1.0.0"), description="Austrian National Library Dataset"
88
+ ),
89
+ EuroNewsConfig(
90
+ name="de-lft", version=datasets.Version("1.0.0"), description="Dr Friedrich Teßmann Library Dataset"
91
+ ),
92
+ ]
93
+
94
+ def _info(self):
95
+ return datasets.DatasetInfo(
96
+ description=_DESCRIPTION,
97
+ features=datasets.Features(
98
+ {
99
+ "id": datasets.Value("string"),
100
+ "tokens": datasets.Sequence(datasets.Value("string")),
101
+ "ner_tags": datasets.Sequence(datasets.features.ClassLabel(names=_TAGS)),
102
+ }
103
+ ),
104
+ supervised_keys=None,
105
+ homepage="https://github.com/EuropeanaNewspapers/ner-corpora",
106
+ citation=_CITATION,
107
+ )
108
+
109
+ def _split_generators(self, dl_manager):
110
+ """Returns SplitGenerators."""
111
+ if self.config.name == "fr-bnf":
112
+ url_to_download = _URL + _FR_BNF
113
+ elif self.config.name == "nl-kb":
114
+ url_to_download = _URL + _NL_KB
115
+ elif self.config.name == "de-sbb":
116
+ url_to_download = _URL + _DE_SBB
117
+ elif self.config.name == "de-onb":
118
+ url_to_download = _URL + _DE_ONB
119
+ elif self.config.name == "de-lft":
120
+ url_to_download = _URL + _DE_LFT
121
+
122
+ downloaded_files = dl_manager.download_and_extract(url_to_download)
123
+
124
+ return [
125
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
126
+ ]
127
+
128
+ def _generate_examples(self, filepath):
129
+ logging.info("⏳ Generating examples from = %s", filepath)
130
+ with open(filepath, encoding="utf-8") as f:
131
+ guid = 0
132
+ tokens = []
133
+ ner_tags = []
134
+ for line in f:
135
+ splits = line.split()
136
+ if len(splits) != 2:
137
+ continue
138
+ if line == "" or line == "\n":
139
+ if tokens:
140
+ yield guid, {
141
+ "id": str(guid),
142
+ "tokens": tokens,
143
+ "ner_tags": ner_tags,
144
+ }
145
+ guid += 1
146
+ tokens = []
147
+ ner_tags = []
148
+ else:
149
+ # Europana Newspaper tokens are space separated
150
+ tag = splits[1].rstrip().upper()
151
+ if tag not in _TAGS:
152
+ continue
153
+ tokens.append(splits[0])
154
+ ner_tags.append(tag)
155
+ # last example
156
+ yield guid, {
157
+ "id": str(guid),
158
+ "tokens": tokens,
159
+ "ner_tags": ner_tags,
160
+ }