Datasets:
File size: 9,239 Bytes
f26037b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""British Library Web Classification Dataset."""
import datasets
import csv
_CITATION = """\
TODO
"""
_DESCRIPTION = """\
The dataset comprises a manually curated selective archive produced by UKWA which includes the classification of sites into a two-tiered subject hierarchy.
"""
_HOMEPAGE = "https://doi.org/10.5259/ukwa.ds.1/classification/1"
_LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
_URL = "https://bl.iro.bl.uk/downloads/78e2421a-70ea-426d-8a67-57e4a8b23019?locale=en"
class WebArchiveClassificationDataset(datasets.GeneratorBasedBuilder):
"""Web Archive Classification Dataset"""
VERSION = datasets.Version("1.1.0")
def _info(self):
features = datasets.Features(
{
"primary_category": datasets.ClassLabel(
names=[
"Arts & Humanities",
"Business, Economy & Industry",
"Company Web Sites",
"Computer Science, Information Technology and Web Technology",
"Crime, Criminology, Police and Prisons",
"Digital Society",
"Education & Research",
"Environment",
"Government, Law & Politics",
"History",
"Law and Legal System",
"Libraries, Archives and Museums",
"Life Sciences",
"Literature",
"Medicine & Health",
"Politics, Political Theory and Political Systems",
"Popular Science",
"Publishing, Printing and Bookselling",
"Religion",
"Science & Technology",
"Social Problems and Welfare",
"Society & Culture",
"Sports and Recreation",
"Travel & Tourism",
]
),
"secondary_category": datasets.ClassLabel(
names=[
"Architecture",
"Art and Design",
"Comedy and Humour",
"Dance",
"Family History / Genealogy",
"Film / Cinema",
"Geography",
"History",
"Languages",
"Literature",
"Live Art",
"Local History",
"Music",
"News and Contemporary Events",
"Oral History in the UK",
"Philosophy and Ethics",
"Publishing, Printing and Bookselling",
"Religion",
"TV and Radio",
"Theatre",
"Agriculture, Fishing, and Forestry",
"Banking, Insurance, Accountancy and Financial Economics",
"Business Studies and Management Theory",
"Company Web Sites",
"Credit Crunch",
"Economic Development, Enterprise and Aid",
"Economics and Economic Theory",
"Employment, Unemployment and Labour Economics",
"Energy",
"Industries",
"Marketing and Market Research",
"Trade, Commerce, and Globalisation",
"Transport and Infrastructure",
"Cambridge Network",
"Video Games",
"Governing the Police",
"Blogs",
"Dictionaries, Encyclopaedias, and Reference Works",
"Further Education",
"Higher Education",
"Libraries, Archives and Museums",
"Library Key Issues",
"Lifelong Learning",
"Preschool Education",
"School Education",
"Special Needs Education",
"Vocational Education",
"Indian Ocean Tsunami December 2004",
"Central Government",
"Civil Rights, Pressure Groups, and Trade Unions",
"Crime, Criminology, Police and Prisons",
"Devolved Government",
"European Parliament Elections 2009",
"Inter-Governmental Agencies",
"International Relations, Diplomacy, and Peace",
"Law and Legal System",
"Local Government",
"London Mayoral Election 2008",
"Political Parties",
"Politics, Political Theory and Political Systems",
"Public Inquiries",
"Scottish Parliamentary Election - 2007",
"Spending Cuts 2010: Impact on Social Welfare",
"UK General Election 2005",
"Slavery and Abolition in the Caribbean",
"Religion, politics and law since 2005",
"Evolving role of libraries in the UK",
"History of Libraries Collection",
"Darwin 200",
"19th Century English Literature",
"Alternative Medicine / Complementary Medicine",
"Conditions and Diseases",
"Health Organisations and Services",
"Medicines, Treatments and Therapies",
"Men's Issues",
"Mental Health",
"Pandemic Influenza",
"Personal Experiences of Illness",
"Public Health and Safety",
"Women's Issues",
"Political Action and Communication",
"E-publishing Trends",
"Free Church",
"Quakers",
"Computer Science, Information Technology and Web Technology",
"Engineering",
"Environment",
"Life Sciences",
"Mathematics",
"Physical Sciences",
"Popular Science",
"Zoology, Veterinary Science and Animal Health",
"Communities",
"Digital Society",
"Food and Drink",
"London Terrorist Attack 7th July 2005",
"Queen's Diamond Jubilee, 2012",
"Social Problems and Welfare",
"Sociology, Anthropology and Population Studies",
"Sports and Recreation",
"Travel & Tourism",
"British Countryside",
"Olympic & Paralympic Games 2012",
"Cornwall",
]
),
"title": datasets.Value("string"),
"url": datasets.Value("string"),
}
)
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=features,
homepage=_HOMEPAGE,
license=_LICENSE,
citation=_CITATION,
)
def _split_generators(self, dl_manager):
csv_file = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={"csv_file": csv_file},
),
]
def _generate_examples(self, csv_file):
with open(csv_file) as f:
reader = csv.DictReader(f, dialect="excel-tab")
for id_, row in enumerate(reader):
yield id_, {
"primary_category": row["Primary Category"],
"secondary_category": row["Secondary Category"],
"title": row["Title"],
"url": row["URL"],
}
|