Commit
·
0896b16
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- crime_and_punish.py +93 -0
- dataset_infos.json +1 -0
- dummy/crime-and-punish/1.0.0/dummy_data +11 -0
- dummy/crime-and-punish/1.0.0/dummy_data.zip +3 -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
|
crime_and_punish.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import absolute_import, division, print_function
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
|
6 |
+
_DESCRIPTION = """\
|
7 |
+
|
8 |
+
"""
|
9 |
+
_URL = "https://www.gutenberg.org/files/2554/2554-h/2554-h.htm"
|
10 |
+
_DATA_URL = "https://raw.githubusercontent.com/patrickvonplaten/datasets/master/crime_and_punishment.txt"
|
11 |
+
|
12 |
+
|
13 |
+
class CrimeAndPunishConfig(datasets.BuilderConfig):
|
14 |
+
"""BuilderConfig for Crime and Punish."""
|
15 |
+
|
16 |
+
def __init__(self, data_url, **kwargs):
|
17 |
+
"""BuilderConfig for BlogAuthorship
|
18 |
+
|
19 |
+
Args:
|
20 |
+
data_url: `string`, url to the dataset (word or raw level)
|
21 |
+
**kwargs: keyword arguments forwarded to super.
|
22 |
+
"""
|
23 |
+
super(CrimeAndPunishConfig, self).__init__(
|
24 |
+
version=datasets.Version(
|
25 |
+
"1.0.0",
|
26 |
+
),
|
27 |
+
**kwargs,
|
28 |
+
)
|
29 |
+
self.data_url = data_url
|
30 |
+
|
31 |
+
|
32 |
+
class CrimeAndPunish(datasets.GeneratorBasedBuilder):
|
33 |
+
|
34 |
+
VERSION = datasets.Version("0.1.0")
|
35 |
+
BUILDER_CONFIGS = [
|
36 |
+
CrimeAndPunishConfig(
|
37 |
+
name="crime-and-punish",
|
38 |
+
data_url=_DATA_URL,
|
39 |
+
description="word level dataset. No processing is needed other than replacing newlines with <eos> tokens.",
|
40 |
+
),
|
41 |
+
]
|
42 |
+
|
43 |
+
def _info(self):
|
44 |
+
return datasets.DatasetInfo(
|
45 |
+
# This is the description that will appear on the datasets page.
|
46 |
+
description=_DESCRIPTION,
|
47 |
+
# datasets.features.FeatureConnectors
|
48 |
+
features=datasets.Features(
|
49 |
+
{
|
50 |
+
"line": datasets.Value("string"),
|
51 |
+
}
|
52 |
+
),
|
53 |
+
# If there's a common (input, target) tuple from the features,
|
54 |
+
# specify them here. They'll be used if as_supervised=True in
|
55 |
+
# builder.as_dataset.
|
56 |
+
supervised_keys=None,
|
57 |
+
homepage=_URL,
|
58 |
+
)
|
59 |
+
|
60 |
+
def _split_generators(self, dl_manager):
|
61 |
+
"""Returns SplitGenerators."""
|
62 |
+
|
63 |
+
if self.config.name == "crime-and-punish":
|
64 |
+
data = dl_manager.download_and_extract(self.config.data_url)
|
65 |
+
|
66 |
+
return [
|
67 |
+
datasets.SplitGenerator(
|
68 |
+
name=datasets.Split.TRAIN,
|
69 |
+
gen_kwargs={"data_file": data, "split": "train"},
|
70 |
+
),
|
71 |
+
]
|
72 |
+
else:
|
73 |
+
raise ValueError("{} does not exist".format(self.config.name))
|
74 |
+
|
75 |
+
def _generate_examples(self, data_file, split):
|
76 |
+
|
77 |
+
with open(data_file, "rb") as f:
|
78 |
+
id_counter = 0
|
79 |
+
add_text = False
|
80 |
+
crime_and_punishment_occ_counter = 0
|
81 |
+
|
82 |
+
for line in f:
|
83 |
+
line = line.decode("UTF-8")
|
84 |
+
if "CRIME AND PUNISHMENT" in line:
|
85 |
+
crime_and_punishment_occ_counter += 1
|
86 |
+
add_text = crime_and_punishment_occ_counter == 3
|
87 |
+
if "End of Project" in line:
|
88 |
+
add_text = False
|
89 |
+
|
90 |
+
if add_text is True:
|
91 |
+
result = {"line": line}
|
92 |
+
id_counter += 1
|
93 |
+
yield id_counter, result
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"crime-and-punish": {"description": "\n", "citation": "", "homepage": "https://www.gutenberg.org/files/2554/2554-h/2554-h.htm", "license": "", "features": {"line": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "crime_and_punish", "config_name": "crime-and-punish", "version": {"version_str": "1.0.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1270540, "num_examples": 21969, "dataset_name": "crime_and_punish"}}, "download_checksums": {"https://raw.githubusercontent.com/patrickvonplaten/datasets/master/crime_and_punishment.txt": {"num_bytes": 1201735, "checksum": "3582bcff83e5e24ae5acb2935a191ea5ead66b11fc12fa19b0397834e8296c83"}}, "download_size": 1201735, "dataset_size": 1270540, "size_in_bytes": 2472275}}
|
dummy/crime-and-punish/1.0.0/dummy_data
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CRIME AND PUNISHMENT
|
2 |
+
CRIME AND PUNISHMENT
|
3 |
+
CRIME AND PUNISHMENT
|
4 |
+
|
5 |
+
This
|
6 |
+
is
|
7 |
+
a
|
8 |
+
test
|
9 |
+
file
|
10 |
+
|
11 |
+
CRIME AND PUNISHMENT
|
dummy/crime-and-punish/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:25e47c9adabdc9d96f58751ff2e769fbfa1190a3e0e4c354d447f20b559a79aa
|
3 |
+
size 220
|