Datasets:
Commit
•
a2ffbfa
1
Parent(s):
67b651c
Convert dataset to Parquet (#1)
Browse files- Convert dataset to Parquet (d78c52fa51a12e0bfae395c6ba7d0917b9545a73)
- Delete loading script (f3e1b9904ed692273fecbadd8889e2effabdef64)
- README.md +14 -9
- data/train-00000-of-00001.parquet +3 -0
- on_the_books.py +0 -81
README.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
---
|
|
|
|
|
2 |
license: cc-by-3.0
|
|
|
|
|
|
|
|
|
|
|
3 |
dataset_info:
|
4 |
features:
|
5 |
- name: id
|
@@ -26,16 +33,14 @@ dataset_info:
|
|
26 |
- name: train
|
27 |
num_bytes: 2119395
|
28 |
num_examples: 1785
|
29 |
-
download_size:
|
30 |
dataset_size: 2119395
|
31 |
-
task_categories:
|
32 |
-
- text-classification
|
33 |
-
language:
|
34 |
-
- en
|
35 |
tags:
|
36 |
- lam
|
37 |
- legal
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
license: cc-by-3.0
|
5 |
+
size_categories:
|
6 |
+
- 1K<n<10K
|
7 |
+
task_categories:
|
8 |
+
- text-classification
|
9 |
+
pretty_name: On the Books Training Set
|
10 |
dataset_info:
|
11 |
features:
|
12 |
- name: id
|
|
|
33 |
- name: train
|
34 |
num_bytes: 2119395
|
35 |
num_examples: 1785
|
36 |
+
download_size: 944579
|
37 |
dataset_size: 2119395
|
|
|
|
|
|
|
|
|
38 |
tags:
|
39 |
- lam
|
40 |
- legal
|
41 |
+
configs:
|
42 |
+
- config_name: default
|
43 |
+
data_files:
|
44 |
+
- split: train
|
45 |
+
path: data/train-*
|
46 |
+
---
|
data/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bf1a870b62efb102b9f976adfe846937d0d66ec0a9a0316ab9e7f4c47415370e
|
3 |
+
size 944579
|
on_the_books.py
DELETED
@@ -1,81 +0,0 @@
|
|
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 |
-
"""On the Books Dataset"""
|
16 |
-
|
17 |
-
import csv
|
18 |
-
|
19 |
-
import datasets
|
20 |
-
|
21 |
-
|
22 |
-
_CITATION = """TODO"""
|
23 |
-
|
24 |
-
_DESCRIPTION = """\
|
25 |
-
This file is the training set that was used to train an algorithm to identify Jim Crow laws.
|
26 |
-
It contains laws that are labeled as "Jim Crow" (jim_crow=1) or "Not Jim Crow" (jim_crow=0).
|
27 |
-
The source of the determination is also provided.
|
28 |
-
|
29 |
-
"""
|
30 |
-
|
31 |
-
_HOMEPAGE = "https://onthebooks.lib.unc.edu/"
|
32 |
-
|
33 |
-
_LICENSE = "CC BY 3.0"
|
34 |
-
|
35 |
-
_URL = "https://cdr.lib.unc.edu/downloads/76537b20b?locale=en"
|
36 |
-
|
37 |
-
|
38 |
-
class OnTheBooks(datasets.GeneratorBasedBuilder):
|
39 |
-
VERSION = datasets.Version("1.1.0")
|
40 |
-
|
41 |
-
def _info(self):
|
42 |
-
features = datasets.Features(
|
43 |
-
{
|
44 |
-
"id": datasets.Value("string"),
|
45 |
-
"source": datasets.Value("string"),
|
46 |
-
"jim_crow": datasets.ClassLabel(names=["no_jim_crow", "jim_crow"]),
|
47 |
-
"type": datasets.Value("string"),
|
48 |
-
"chapter_num": datasets.Value("int32"),
|
49 |
-
"section_num": datasets.Value("int32"),
|
50 |
-
"chapter_text": datasets.Value("string"),
|
51 |
-
"section_text": datasets.Value("string"),
|
52 |
-
}
|
53 |
-
)
|
54 |
-
|
55 |
-
return datasets.DatasetInfo(
|
56 |
-
description=_DESCRIPTION,
|
57 |
-
features=features,
|
58 |
-
supervised_keys=None,
|
59 |
-
homepage=_HOMEPAGE,
|
60 |
-
license=_LICENSE,
|
61 |
-
citation=_CITATION,
|
62 |
-
)
|
63 |
-
|
64 |
-
def _split_generators(self, dl_manager):
|
65 |
-
"""Returns SplitGenerators."""
|
66 |
-
|
67 |
-
data_file = dl_manager.download(_URL)
|
68 |
-
return [
|
69 |
-
datasets.SplitGenerator(
|
70 |
-
name=datasets.Split.TRAIN,
|
71 |
-
gen_kwargs={
|
72 |
-
"filepath": data_file,
|
73 |
-
},
|
74 |
-
),
|
75 |
-
]
|
76 |
-
|
77 |
-
def _generate_examples(self, filepath):
|
78 |
-
"""Yields examples as (key, example) tuples."""
|
79 |
-
with open(filepath, encoding="utf-8") as f:
|
80 |
-
reader = csv.DictReader(f)
|
81 |
-
yield from enumerate(reader)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|