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

Update files from the datasets library (from 1.0.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.0.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
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"narrow": {"description": "The goal of the style change detection task is to identify text positions within a given multi-author document at which the author switches. Detecting these positions is a crucial part of the authorship identification process, and for multi-author document analysis in general.\n\nAccess to the dataset needs to be requested from zenodo.\n", "citation": "@inproceedings{bevendorff2020shared,\n title={Shared Tasks on Authorship Analysis at PAN 2020},\n author={Bevendorff, Janek and Ghanem, Bilal and Giachanou, Anastasia and Kestemont, Mike and Manjavacas, Enrique and Potthast, Martin and Rangel, Francisco and Rosso, Paolo and Specht, G{\"u}nther and Stamatatos, Efstathios and others},\n booktitle={European Conference on Information Retrieval},\n pages={508--516},\n year={2020},\n organization={Springer}\n}\n", "homepage": "https://pan.webis.de/clef20/pan20-web/style-change-detection.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"dtype": "int32", "id": null, "_type": "Value"}, "structure": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "site": {"dtype": "string", "id": null, "_type": "Value"}, "multi-author": {"dtype": "bool", "id": null, "_type": "Value"}, "changes": {"feature": {"dtype": "bool", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "style_change_detection", "config_name": "narrow", "version": {"version_str": "1.0.0", "description": "Version 1", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 40499150, "num_examples": 3418, "dataset_name": "style_change_detection"}, "validation": {"name": "validation", "num_bytes": 20447137, "num_examples": 1713, "dataset_name": "style_change_detection"}}, "download_checksums": {}, "download_size": 0, "dataset_size": 60946287, "size_in_bytes": 60946287}, "wide": {"description": "The goal of the style change detection task is to identify text positions within a given multi-author document at which the author switches. Detecting these positions is a crucial part of the authorship identification process, and for multi-author document analysis in general.\n\nAccess to the dataset needs to be requested from zenodo.\n", "citation": "@inproceedings{bevendorff2020shared,\n title={Shared Tasks on Authorship Analysis at PAN 2020},\n author={Bevendorff, Janek and Ghanem, Bilal and Giachanou, Anastasia and Kestemont, Mike and Manjavacas, Enrique and Potthast, Martin and Rangel, Francisco and Rosso, Paolo and Specht, G{\"u}nther and Stamatatos, Efstathios and others},\n booktitle={European Conference on Information Retrieval},\n pages={508--516},\n year={2020},\n organization={Springer}\n}\n", "homepage": "https://pan.webis.de/clef20/pan20-web/style-change-detection.html", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"dtype": "int32", "id": null, "_type": "Value"}, "structure": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "site": {"dtype": "string", "id": null, "_type": "Value"}, "multi-author": {"dtype": "bool", "id": null, "_type": "Value"}, "changes": {"feature": {"dtype": "bool", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "style_change_detection", "config_name": "wide", "version": {"version_str": "1.0.0", "description": "Version 1", "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 97403392, "num_examples": 8030, "dataset_name": "style_change_detection"}, "validation": {"name": "validation", "num_bytes": 48850089, "num_examples": 4019, "dataset_name": "style_change_detection"}}, "download_checksums": {}, "download_size": 0, "dataset_size": 146253481, "size_in_bytes": 146253481}}
dummy/narrow/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab86ed530d17fdeada4d5946785942cde1a6e0d4f04f2e769515da5ef72923e4
3
+ size 3252
dummy/wide/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41ca6186651641acca49fffdea2625b4af8ade59e12965478f3e823b0173dd2e
3
+ size 3212
style_change_detection.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and the 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 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ # Lint as: python3
15
+ """Authorship Analysis: Style Change Detection"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{bevendorff2020shared,
27
+ title={Shared Tasks on Authorship Analysis at PAN 2020},
28
+ author={Bevendorff, Janek and Ghanem, Bilal and Giachanou, Anastasia and Kestemont, Mike and Manjavacas, Enrique and Potthast, Martin and Rangel, Francisco and Rosso, Paolo and Specht, G{\"u}nther and Stamatatos, Efstathios and others},
29
+ booktitle={European Conference on Information Retrieval},
30
+ pages={508--516},
31
+ year={2020},
32
+ organization={Springer}
33
+ }
34
+ """
35
+
36
+ _DESCRIPTION = """\
37
+ The goal of the style change detection task is to identify text positions within a given multi-author document at which the author switches. Detecting these positions is a crucial part of the authorship identification process, and for multi-author document analysis in general.
38
+
39
+ Access to the dataset needs to be requested from zenodo.
40
+ """
41
+
42
+
43
+ class StyleChangeDetection(datasets.GeneratorBasedBuilder):
44
+ """Style Change Detection Dataset from PAN20"""
45
+
46
+ VERSION = datasets.Version("1.0.0")
47
+ BUILDER_CONFIGS = [
48
+ datasets.BuilderConfig(
49
+ name="narrow",
50
+ version=datasets.Version("1.0.0", "Version 1"),
51
+ description="The narrow subset contains texts from a relatively narrow set of subjects matters (all related to technology).",
52
+ ),
53
+ datasets.BuilderConfig(
54
+ name="wide",
55
+ version=datasets.Version("1.0.0", "Version 1"),
56
+ description="The wide subset adds additional subject areas (travel, philosophy, economics, history, etc.).",
57
+ ),
58
+ ]
59
+
60
+ @property
61
+ def manual_download_instructions(self):
62
+ return """\
63
+ You should download the dataset from https://zenodo.org/record/3660984
64
+ The dataset needs requesting.
65
+
66
+ Download each file, extract it and place in a dir of your choice,
67
+ which will be used as a manual_dir, e.g. `~/.manual_dirs/style_change_detection`
68
+ Style Change Detection can then be loaded via:
69
+ `datasets.load_dataset("style_change_detection", data_dir="~/.manual_dirs/style_change_detection")`.
70
+ """
71
+
72
+ def _info(self):
73
+ features = {
74
+ "id": datasets.Value("string"),
75
+ "text": datasets.Value("string"),
76
+ "authors": datasets.Value("int32"),
77
+ "structure": datasets.features.Sequence(datasets.Value("string")),
78
+ "site": datasets.Value("string"),
79
+ "multi-author": datasets.Value("bool"),
80
+ "changes": datasets.features.Sequence(datasets.Value("bool")),
81
+ }
82
+
83
+ return datasets.DatasetInfo(
84
+ description=_DESCRIPTION,
85
+ features=datasets.Features(features),
86
+ homepage="https://pan.webis.de/clef20/pan20-web/style-change-detection.html",
87
+ citation=_CITATION,
88
+ )
89
+
90
+ def _split_generators(self, dl_manager):
91
+ """Returns SplitGenerators."""
92
+ data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
93
+
94
+ train_dir = os.path.join(data_dir, "train", "dataset-" + self.config.name)
95
+ val_dir = os.path.join(data_dir, "validation", "dataset-" + self.config.name)
96
+
97
+ if not os.path.exists(train_dir):
98
+ raise FileNotFoundError(
99
+ "{} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('style_change_detection', data_dir=...)` that includes {}. Manual download instructions: {}".format(
100
+ train_dir, train_dir, self.manual_download_instructions
101
+ )
102
+ )
103
+
104
+ return [
105
+ datasets.SplitGenerator(
106
+ name=datasets.Split.TRAIN,
107
+ gen_kwargs={
108
+ "articles": [f for f in os.listdir(train_dir) if f.endswith(".txt")],
109
+ "base_dir": train_dir,
110
+ },
111
+ ),
112
+ datasets.SplitGenerator(
113
+ name=datasets.Split.VALIDATION,
114
+ gen_kwargs={"articles": [f for f in os.listdir(val_dir) if f.endswith(".txt")], "base_dir": val_dir},
115
+ ),
116
+ ]
117
+
118
+ def _generate_examples(self, articles=None, base_dir=None):
119
+ """Yields examples."""
120
+ for idx, article_filename in enumerate(articles):
121
+ label_path = os.path.join(base_dir, "truth-" + article_filename[:-4] + ".json")
122
+ with open(label_path, encoding="utf-8") as f:
123
+ example = json.load(f)
124
+ example["id"] = article_filename[8:-4]
125
+ example["text"] = open(os.path.join(base_dir, article_filename), encoding="utf-8").read()
126
+
127
+ # Convert integers into boolean
128
+ example["multi-author"] = example["multi-author"] == 1
129
+ for i in range(len(example["changes"])):
130
+ example["changes"][i] = example["changes"][i] == 1
131
+
132
+ yield idx, example