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

Update files from the datasets library (from 1.18.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.18.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,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - ar
8
+ - da
9
+ - de
10
+ - fi
11
+ - fr
12
+ - lb
13
+ - nl
14
+ - pt
15
+ licenses:
16
+ - cc0-1-0
17
+ multilinguality:
18
+ - multilingual
19
+ pretty_name: BnL newspapers
20
+ size_categories:
21
+ - 100K<n<1M
22
+ source_datasets:
23
+ - original
24
+ task_categories:
25
+ - sequence-modeling
26
+ task_ids:
27
+ - language-modeling
28
+ ---
29
+
30
+ # Dataset Card for BnL Newspapers
31
+
32
+ ## Table of Contents
33
+ - [Table of Contents](#table-of-contents)
34
+ - [Dataset Description](#dataset-description)
35
+ - [Dataset Summary](#dataset-summary)
36
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
37
+ - [Languages](#languages)
38
+ - [Dataset Structure](#dataset-structure)
39
+ - [Data Instances](#data-instances)
40
+ - [Data Fields](#data-fields)
41
+ - [Data Splits](#data-splits)
42
+ - [Dataset Creation](#dataset-creation)
43
+ - [Curation Rationale](#curation-rationale)
44
+ - [Source Data](#source-data)
45
+ - [Annotations](#annotations)
46
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
47
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
48
+ - [Social Impact of Dataset](#social-impact-of-dataset)
49
+ - [Discussion of Biases](#discussion-of-biases)
50
+ - [Other Known Limitations](#other-known-limitations)
51
+ - [Additional Information](#additional-information)
52
+ - [Dataset Curators](#dataset-curators)
53
+ - [Licensing Information](#licensing-information)
54
+ - [Citation Information](#citation-information)
55
+ - [Contributions](#contributions)
56
+
57
+ ## Dataset Description
58
+
59
+ - **Homepage:** https://data.bnl.lu/data/historical-newspapers/
60
+ - **Repository:**
61
+ - **Paper:**
62
+ - **Leaderboard:**
63
+ - **Point of Contact:** opendata@bnl.etat.lu
64
+
65
+ ### Dataset Summary
66
+
67
+ The BnL has digitised over 800.000 pages of Luxembourg newspapers. This dataset currently has one configuration covering a subset of these newspapers, which sit under the "Processed Datasets" collection. The BNL:
68
+
69
+ > processed all newspapers and monographs that are in the public domain and extracted the full text and associated meta data of every single article, section, advertisement… The result is a large number of small, easy to use XML files formatted using Dublin Core.
70
+
71
+ [More Information Needed]
72
+
73
+ ### Supported Tasks and Leaderboards
74
+
75
+ [More Information Needed]
76
+
77
+ ### Languages
78
+
79
+ [More Information Needed]
80
+
81
+ ## Dataset Structure
82
+
83
+ The dataset currently contains a single configuration.
84
+
85
+ ### Data Instances
86
+
87
+ An example instance from the datasets:
88
+
89
+ ``` python
90
+ {'id': 'https://persist.lu/ark:/70795/wx8r4c/articles/DTL47',
91
+ 'article_type': 8,
92
+ 'extent': 49,
93
+ 'ispartof': 'Luxemburger Wort',
94
+ 'pub_date': datetime.datetime(1853, 3, 23, 0, 0),
95
+ 'publisher': 'Verl. der St-Paulus-Druckerei',
96
+ 'source': 'newspaper/luxwort/1853-03-23',
97
+ 'text': 'Asien. Eine neue Nedcrland-Post ist angekommen mil Nachrichten aus Calcutta bis zum 5. Febr.; Vom» vay, 12. Febr. ; Nangun und HongKong, 13. Jan. Die durch die letzte Post gebrachle Nachricht, der König von Ava sei durch seinen Bruder enlhronl worden, wird bestätigt. (K. Z.) Verantwortl. Herausgeber, F. Schümann.',
98
+ 'title': 'Asien.',
99
+ 'url': 'http://www.eluxemburgensia.lu/webclient/DeliveryManager?pid=209701#panel:pp|issue:209701|article:DTL47'}
100
+ ```
101
+
102
+
103
+ ### Data Fields
104
+
105
+ - 'id': This is a unique and persistent identifier using ARK.
106
+ - 'article_type': The type of the exported data, possible values ('ADVERTISEMENT_SECTION',
107
+ 'BIBLIOGRAPHY',
108
+ 'CHAPTER',
109
+ 'INDEX',
110
+ 'CONTRIBUTION',
111
+ 'TABLE_OF_CONTENTS',
112
+ 'WEATHER',
113
+ 'SHIPPING',
114
+ 'SECTION',
115
+ 'ARTICLE',
116
+ 'TITLE_SECTION',
117
+ 'DEATH_NOTICE',
118
+ 'SUPPLEMENT',
119
+ 'TABLE',
120
+ 'ADVERTISEMENT',
121
+ 'CHART_DIAGRAM',
122
+ 'ILLUSTRATION',
123
+ 'ISSUE')
124
+ - 'extent': The number of words in the text field
125
+ - 'ispartof: The complete title of the source document e.g. “Luxemburger Wort”.
126
+ - 'pub_date': The publishing date of the document e.g “1848-12-15”
127
+ - 'publisher':The publisher of the document e.g. “Verl. der St-Paulus-Druckerei”.
128
+ - 'source': Describes the source of the document. For example
129
+ <dc:source>newspaper/luxwort/1848-12-15</dc:source> means that this article comes from the newspaper “luxwort” (ID for Luxemburger Wort) issued on 15.12.1848.
130
+ - 'text': The full text of the entire article, section, advertisement etc. It includes any titles and subtitles as well. The content does not contain layout information, such as headings, paragraphs or lines.
131
+ - 'title': The main title of the article, section, advertisement, etc.
132
+ - 'url': The link to the BnLViewer on eluxemburgensia.lu to view the resource online.
133
+ - 'language': The language of the text, possible values ('ar', 'da', 'de', 'fi', 'fr', 'lb', 'nl', 'pt')
134
+
135
+ ### Data Splits
136
+
137
+ This dataset contains a single split `train`.
138
+
139
+ ## Dataset Creation
140
+
141
+ ### Curation Rationale
142
+
143
+ [More Information Needed]
144
+
145
+ ### Source Data
146
+
147
+ #### Initial Data Collection and Normalization
148
+
149
+ [More Information Needed]
150
+
151
+ #### Who are the source language producers?
152
+
153
+ [More Information Needed]
154
+
155
+ ### Annotations
156
+
157
+ #### Annotation process
158
+
159
+ [More Information Needed]
160
+
161
+ #### Who are the annotators?
162
+
163
+ [More Information Needed]
164
+
165
+ ### Personal and Sensitive Information
166
+
167
+ [More Information Needed]
168
+
169
+ ## Considerations for Using the Data
170
+
171
+ ### Social Impact of Dataset
172
+
173
+ [More Information Needed]
174
+
175
+ ### Discussion of Biases
176
+
177
+ [More Information Needed]
178
+
179
+ ### Other Known Limitations
180
+
181
+ [More Information Needed]
182
+
183
+ ## Additional Information
184
+
185
+ ### Dataset Curators
186
+
187
+ [More Information Needed]
188
+
189
+ ### Licensing Information
190
+
191
+ [More Information Needed]
192
+
193
+ ### Citation Information
194
+
195
+ ```
196
+ @misc{bnl_newspapers,
197
+ title={Historical Newspapers},
198
+ url={https://data.bnl.lu/data/historical-newspapers/},
199
+ author={ Bibliothèque nationale du Luxembourg},
200
+ ```
201
+
202
+ ### Contributions
203
+
204
+ Thanks to [@davanstrien](https://github.com/davanstrien) for adding this dataset.
bnl_newspapers.py ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2021 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
+ """Digitised historic newspapers from the BNL"""
16
+
17
+ import xml.etree.ElementTree as ET
18
+ from datetime import datetime
19
+ from pathlib import Path
20
+
21
+ import datasets
22
+ from datasets.tasks import LanguageModeling
23
+
24
+
25
+ _CITATION = """\
26
+ @misc{bnl_newspapers,
27
+ title={Historical Newspapers},
28
+ url={https://data.bnl.lu/data/historical-newspapers/},
29
+ author={ Bibliothèque nationale du Luxembourg},
30
+ """
31
+
32
+ _DESCRIPTION = """\
33
+ Digitised historic newspapers from the Bibliothèque nationale (BnL) - the National Library of Luxembourg.
34
+ """
35
+
36
+ _HOMEPAGE = "https://data.bnl.lu/data/historical-newspapers/"
37
+
38
+ _LICENSE = "CC0"
39
+
40
+
41
+ _URLs = {"processed": "https://data.bnl.lu/open-data/digitization/newspapers/export01-newspapers1841-1878.zip"}
42
+
43
+
44
+ class BNLNewspapersConfig(datasets.BuilderConfig):
45
+ """Builder config for BNLNewspapers"""
46
+
47
+ def __init__(self, data_url, citation, url, **kwargs):
48
+ """
49
+ Args:
50
+ data_url: `string`, url to download the zip file from.
51
+ citation: `string`, citation for the data set.
52
+ url: `string`, url for information about the data set.
53
+ **kwargs: keyword arguments forwarded to super.
54
+ """
55
+ super(BNLNewspapersConfig, self).__init__(version=datasets.Version("1.17.0"), **kwargs)
56
+ self.data_url = data_url
57
+ self.citation = citation
58
+ self.url = url
59
+
60
+
61
+ class BNLNewspapers(datasets.GeneratorBasedBuilder):
62
+ """Historic newspapers from the BNL"""
63
+
64
+ BUILDER_CONFIGS = [
65
+ BNLNewspapersConfig(
66
+ name="processed",
67
+ description="""This dataset covers the 'processed newspapers' portion of the BnL newspapers.
68
+ These newspapers cover 38 years of news (1841-1878) and include 510,505 extracted articles.
69
+ """,
70
+ data_url=_URLs["processed"],
71
+ citation=_CITATION,
72
+ url=_HOMEPAGE,
73
+ ),
74
+ ]
75
+
76
+ DEFAULT_CONFIG_NAME = "processed"
77
+
78
+ def _info(self):
79
+ features = datasets.Features(
80
+ {
81
+ "id": datasets.Value("string"),
82
+ "source": datasets.Value("string"),
83
+ "url": datasets.Value("string"),
84
+ "title": datasets.Value("string"),
85
+ "ispartof": datasets.Value("string"),
86
+ "text": datasets.Value("string"),
87
+ "pub_date": datasets.Value("timestamp[s]"),
88
+ "publisher": datasets.Value("string"),
89
+ "language": datasets.Value("string"),
90
+ "article_type": datasets.ClassLabel(
91
+ names=[
92
+ "ADVERTISEMENT_SECTION",
93
+ "BIBLIOGRAPHY",
94
+ "CHAPTER",
95
+ "INDEX",
96
+ "CONTRIBUTION",
97
+ "TABLE_OF_CONTENTS",
98
+ "WEATHER",
99
+ "SHIPPING",
100
+ "SECTION",
101
+ "ARTICLE",
102
+ "TITLE_SECTION",
103
+ "DEATH_NOTICE",
104
+ "SUPPLEMENT",
105
+ "TABLE",
106
+ "ADVERTISEMENT",
107
+ "CHART_DIAGRAM",
108
+ "ILLUSTRATION",
109
+ "ISSUE",
110
+ ]
111
+ ),
112
+ "extent": datasets.Value("int32"),
113
+ }
114
+ )
115
+ return datasets.DatasetInfo(
116
+ # This is the description that will appear on the datasets page.
117
+ description=_DESCRIPTION,
118
+ # This defines the different columns of the dataset and their types
119
+ features=features, # Here we define them above because they are different between the two configurations
120
+ # If there's a common (input, target) tuple from the features,
121
+ # specify them here. They'll be used if as_supervised=True in
122
+ # builder.as_dataset.
123
+ supervised_keys=None,
124
+ # Homepage of the dataset for documentation
125
+ homepage=_HOMEPAGE,
126
+ # License for the dataset if available
127
+ license=_LICENSE,
128
+ # Citation for the dataset
129
+ citation=_CITATION,
130
+ task_templates=[LanguageModeling(text_column="text")],
131
+ )
132
+
133
+ def _split_generators(self, dl_manager):
134
+ """Returns SplitGenerators."""
135
+ _URL = self.config.data_url
136
+ data_dir = dl_manager.download_and_extract(_URL)
137
+ return [
138
+ datasets.SplitGenerator(
139
+ name=datasets.Split.TRAIN,
140
+ # These kwargs will be passed to _generate_examples
141
+ gen_kwargs={
142
+ "dirpath": data_dir,
143
+ },
144
+ ),
145
+ ]
146
+
147
+ def _generate_examples(
148
+ self,
149
+ dirpath,
150
+ ):
151
+ """Yields examples as (key, example) tuples."""
152
+ ns = {
153
+ "": "http://www.openarchives.org/OAI/2.0/",
154
+ "xsi": "http://www.w3.org/2001/XMLSchema-instance",
155
+ "oai_dc": "http://www.openarchives.org/OAI/2.0/oai_dc/",
156
+ "dc": "http://purl.org/dc/elements/1.1/",
157
+ "dcterms": "http://purl.org/dc/terms/",
158
+ }
159
+ for id_, xml in enumerate(Path(dirpath).rglob("**/*.xml")):
160
+ tree = ET.parse(open(xml, encoding="utf-8"))
161
+ source = tree.find(".//dc:source", ns).text
162
+ ark_id = tree.find(".//dc:identifier", ns).text
163
+ ispartof = tree.find(".//dcterms:isPartOf", ns).text
164
+ date = tree.find(".//dc:date", ns).text
165
+ if date:
166
+ date = datetime.strptime(date, "%Y-%m-%d")
167
+ publisher = tree.find(".//dc:publisher", ns)
168
+ if publisher is not None:
169
+ publisher = publisher.text
170
+ hasversion = tree.find(".//dcterms:hasVersion", ns).text
171
+ description = tree.find(".//dc:description", ns).text
172
+ title = tree.find(".//dc:title", ns).text
173
+ article_type = tree.find(".//dc:type", ns).text
174
+ extent = tree.find(".//dcterms:extent", ns).text
175
+ language = tree.find(".//dc:language", ns)
176
+ if language is not None:
177
+ language = language.text
178
+ yield id_, {
179
+ "id": ark_id,
180
+ "source": source,
181
+ "url": hasversion,
182
+ "title": title,
183
+ "text": description,
184
+ "pub_date": date,
185
+ "publisher": publisher,
186
+ "article_type": article_type,
187
+ "extent": extent,
188
+ "ispartof": ispartof,
189
+ "language": language,
190
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"processed": {"description": "Digitised historic newspapers from the Biblioth\u00e8que nationale (BnL) - the National Library of Luxembourg.\n", "citation": "@misc{bnl_newspapers,\ntitle={Historical Newspapers},\nurl={https://data.bnl.lu/data/historical-newspapers/},\nauthor={ Biblioth\u00e8que nationale du Luxembourg},\n", "homepage": "https://data.bnl.lu/data/historical-newspapers/", "license": "CC0", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "url": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "ispartof": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "pub_date": {"dtype": "timestamp[s]", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "article_type": {"num_classes": 18, "names": ["ADVERTISEMENT_SECTION", "BIBLIOGRAPHY", "CHAPTER", "INDEX", "CONTRIBUTION", "TABLE_OF_CONTENTS", "WEATHER", "SHIPPING", "SECTION", "ARTICLE", "TITLE_SECTION", "DEATH_NOTICE", "SUPPLEMENT", "TABLE", "ADVERTISEMENT", "CHART_DIAGRAM", "ILLUSTRATION", "ISSUE"], "names_file": null, "id": null, "_type": "ClassLabel"}, "extent": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "language-modeling", "text_column": "text"}], "builder_name": "bnl_newspapers", "config_name": "processed", "version": {"version_str": "1.17.0", "description": null, "major": 1, "minor": 17, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1611620156, "num_examples": 537558, "dataset_name": "bnl_newspapers"}}, "download_checksums": {"https://data.bnl.lu/open-data/digitization/newspapers/export01-newspapers1841-1878.zip": {"num_bytes": 1224029060, "checksum": "72032d30d93eb367c567651db970bdb6f645fa6377b2d6a2453d30cf870df946"}}, "download_size": 1224029060, "post_processing_size": null, "dataset_size": 1611620156, "size_in_bytes": 2835649216}}
dummy/processed/1.17.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bdde4422da444cfef8aa00cdda3b0de5bd4902b76a46039f2196d9168748bf3e
3
+ size 9731