Datasets:
Tasks:
Text Classification
Sub-tasks:
intent-classification
Languages:
Polish
Size:
10K<n<100K
License:
Commit
•
92c5f80
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +161 -0
- dataset_infos.json +1 -0
- dummy/task01/1.0.0/dummy_data.zip +3 -0
- dummy/task02/1.0.0/dummy_data.zip +3 -0
- poleval2019_cyberbullying.py +153 -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,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- found
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- pl
|
8 |
+
licenses:
|
9 |
+
- unknown
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 10K<n<100K
|
14 |
+
source_datasets:
|
15 |
+
- original
|
16 |
+
task_categories:
|
17 |
+
- text-classification
|
18 |
+
task_ids:
|
19 |
+
- intent-classification
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for Poleval 2019 cyberbullying
|
23 |
+
|
24 |
+
## Table of Contents
|
25 |
+
- [Dataset Description](#dataset-description)
|
26 |
+
- [Dataset Summary](#dataset-summary)
|
27 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
28 |
+
- [Languages](#languages)
|
29 |
+
- [Dataset Structure](#dataset-structure)
|
30 |
+
- [Data Instances](#data-instances)
|
31 |
+
- [Data Fields](#data-instances)
|
32 |
+
- [Data Splits](#data-instances)
|
33 |
+
- [Dataset Creation](#dataset-creation)
|
34 |
+
- [Curation Rationale](#curation-rationale)
|
35 |
+
- [Source Data](#source-data)
|
36 |
+
- [Annotations](#annotations)
|
37 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
38 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
39 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
40 |
+
- [Discussion of Biases](#discussion-of-biases)
|
41 |
+
- [Other Known Limitations](#other-known-limitations)
|
42 |
+
- [Additional Information](#additional-information)
|
43 |
+
- [Dataset Curators](#dataset-curators)
|
44 |
+
- [Licensing Information](#licensing-information)
|
45 |
+
- [Citation Information](#citation-information)
|
46 |
+
|
47 |
+
## Dataset Description
|
48 |
+
|
49 |
+
- **Homepage:** http://2019.poleval.pl/index.php/tasks/task6
|
50 |
+
- **Repository:**
|
51 |
+
- **Paper:**
|
52 |
+
- **Leaderboard:**
|
53 |
+
- **Point of Contact:**
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
Task 6-1: Harmful vs non-harmful
|
58 |
+
|
59 |
+
In this task, the participants are to distinguish between normal/non-harmful tweets (class: 0) and tweets that contain any kind of harmful
|
60 |
+
information (class: 1). This includes cyberbullying, hate speech and related phenomena. The data for the task is available now and can be
|
61 |
+
downloaded from the link provided below.
|
62 |
+
|
63 |
+
Task 6-2: Type of harmfulness
|
64 |
+
|
65 |
+
In this task, the participants shall distinguish between three classes of tweets: 0 (non-harmful), 1 (cyberbullying), 2 (hate-speech). There
|
66 |
+
are various definitions of both cyberbullying and hate-speech, some of them even putting those two phenomena in the same group. The specific
|
67 |
+
conditions on which we based our annotations for both cyberbullying and hate-speech, which have been worked out during ten years of research
|
68 |
+
will be summarized in an introductory paper for the task, however, the main and definitive condition to distinguish the two is whether the
|
69 |
+
harmful action is addressed towards a private person(s) (cyberbullying), or a public person/entity/large group (hate-speech).
|
70 |
+
|
71 |
+
### Supported Tasks and Leaderboards
|
72 |
+
|
73 |
+
[More Information Needed]
|
74 |
+
|
75 |
+
### Languages
|
76 |
+
|
77 |
+
Polish
|
78 |
+
|
79 |
+
## Dataset Structure
|
80 |
+
|
81 |
+
### Data Instances
|
82 |
+
|
83 |
+
[More Information Needed]
|
84 |
+
|
85 |
+
### Data Fields
|
86 |
+
|
87 |
+
- text: the provided tweet
|
88 |
+
- label: for task 6-1 the label can be 0 (non-harmful) or 1 (harmful)
|
89 |
+
for task 6-2 the label can be 0 (non-harmful), 1 (cyberbullying) or 2 (hate-speech)
|
90 |
+
|
91 |
+
### Data Splits
|
92 |
+
|
93 |
+
Train and Test
|
94 |
+
|
95 |
+
## Dataset Creation
|
96 |
+
|
97 |
+
### Curation Rationale
|
98 |
+
|
99 |
+
[More Information Needed]
|
100 |
+
|
101 |
+
### Source Data
|
102 |
+
|
103 |
+
#### Initial Data Collection and Normalization
|
104 |
+
|
105 |
+
[More Information Needed]
|
106 |
+
|
107 |
+
#### Who are the source language producers?
|
108 |
+
|
109 |
+
[More Information Needed]
|
110 |
+
|
111 |
+
### Annotations
|
112 |
+
|
113 |
+
#### Annotation process
|
114 |
+
|
115 |
+
[More Information Needed]
|
116 |
+
|
117 |
+
#### Who are the annotators?
|
118 |
+
|
119 |
+
[More Information Needed]
|
120 |
+
|
121 |
+
### Personal and Sensitive Information
|
122 |
+
|
123 |
+
[More Information Needed]
|
124 |
+
|
125 |
+
## Considerations for Using the Data
|
126 |
+
|
127 |
+
### Social Impact of Dataset
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
### Discussion of Biases
|
132 |
+
|
133 |
+
[More Information Needed]
|
134 |
+
|
135 |
+
### Other Known Limitations
|
136 |
+
|
137 |
+
[More Information Needed]
|
138 |
+
|
139 |
+
## Additional Information
|
140 |
+
|
141 |
+
### Dataset Curators
|
142 |
+
|
143 |
+
[More Information Needed]
|
144 |
+
|
145 |
+
### Licensing Information
|
146 |
+
|
147 |
+
[More Information Needed]
|
148 |
+
|
149 |
+
### Citation Information
|
150 |
+
|
151 |
+
```
|
152 |
+
@proceedings{ogr:kob:19:poleval,
|
153 |
+
editor = {Maciej Ogrodniczuk and Łukasz Kobyliński},
|
154 |
+
title = {{Proceedings of the PolEval 2019 Workshop}},
|
155 |
+
year = {2019},
|
156 |
+
address = {Warsaw, Poland},
|
157 |
+
publisher = {Institute of Computer Science, Polish Academy of Sciences},
|
158 |
+
url = {http://2019.poleval.pl/files/poleval2019.pdf},
|
159 |
+
isbn = "978-83-63159-28-3"}
|
160 |
+
}
|
161 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"task01": {"description": " In Task 6-1, the participants are to distinguish between normal/non-harmful tweets (class: 0) and tweets\n that contain any kind of harmful information (class: 1). This includes cyberbullying, hate speech and\n related phenomena.\n\n In Task 6-2, the participants shall distinguish between three classes of tweets: 0 (non-harmful),\n 1 (cyberbullying), 2 (hate-speech). There are various definitions of both cyberbullying and hate-speech,\n some of them even putting those two phenomena in the same group. The specific conditions on which we based\n our annotations for both cyberbullying and hate-speech, which have been worked out during ten years of research\n will be summarized in an introductory paper for the task, however, the main and definitive condition to 1\n distinguish the two is whether the harmful action is addressed towards a private person(s) (cyberbullying),\n or a public person/entity/large group (hate-speech).\n", "citation": "@proceedings{ogr:kob:19:poleval,\n editor = {Maciej Ogrodniczuk and \u0141ukasz Kobyli\u0144ski},\n title = {{Proceedings of the PolEval 2019 Workshop}},\n year = {2019},\n address = {Warsaw, Poland},\n publisher = {Institute of Computer Science, Polish Academy of Sciences},\n url = {http://2019.poleval.pl/files/poleval2019.pdf},\n isbn = \"978-83-63159-28-3\"}\n}\n", "homepage": "http://2019.poleval.pl/index.php/tasks/task6", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["0", "1"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "text", "output": "label"}, "builder_name": "poleval2019_cyber_bullying", "config_name": "task01", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1104322, "num_examples": 10041, "dataset_name": "poleval2019_cyber_bullying"}, "test": {"name": "test", "num_bytes": 109681, "num_examples": 1000, "dataset_name": "poleval2019_cyber_bullying"}}, "download_checksums": {"http://2019.poleval.pl/task6/task_6-1.zip": {"num_bytes": 339950, "checksum": "8b71cb27bfcb3b503e80f8959be8485a53b777f288042d3dc1e8fb54c863c2a8"}, "http://2019.poleval.pl/task6/task6_test.zip": {"num_bytes": 70051, "checksum": "6acac459608b2d6da75f138740447b047c7bd3e0bbf562964845830a27a0b2f7"}}, "download_size": 410001, "post_processing_size": null, "dataset_size": 1214003, "size_in_bytes": 1624004}, "task02": {"description": " In Task 6-1, the participants are to distinguish between normal/non-harmful tweets (class: 0) and tweets\n that contain any kind of harmful information (class: 1). This includes cyberbullying, hate speech and\n related phenomena.\n\n In Task 6-2, the participants shall distinguish between three classes of tweets: 0 (non-harmful),\n 1 (cyberbullying), 2 (hate-speech). There are various definitions of both cyberbullying and hate-speech,\n some of them even putting those two phenomena in the same group. The specific conditions on which we based\n our annotations for both cyberbullying and hate-speech, which have been worked out during ten years of research\n will be summarized in an introductory paper for the task, however, the main and definitive condition to 1\n distinguish the two is whether the harmful action is addressed towards a private person(s) (cyberbullying),\n or a public person/entity/large group (hate-speech).\n", "citation": "@proceedings{ogr:kob:19:poleval,\n editor = {Maciej Ogrodniczuk and \u0141ukasz Kobyli\u0144ski},\n title = {{Proceedings of the PolEval 2019 Workshop}},\n year = {2019},\n address = {Warsaw, Poland},\n publisher = {Institute of Computer Science, Polish Academy of Sciences},\n url = {http://2019.poleval.pl/files/poleval2019.pdf},\n isbn = \"978-83-63159-28-3\"}\n}\n", "homepage": "http://2019.poleval.pl/index.php/tasks/task6", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 3, "names": ["0", "1", "2"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": {"input": "text", "output": "label"}, "builder_name": "poleval2019_cyber_bullying", "config_name": "task02", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1104322, "num_examples": 10041, "dataset_name": "poleval2019_cyber_bullying"}, "test": {"name": "test", "num_bytes": 109681, "num_examples": 1000, "dataset_name": "poleval2019_cyber_bullying"}}, "download_checksums": {"http://2019.poleval.pl/task6/task_6-2.zip": {"num_bytes": 340096, "checksum": "659975fc8b6a505b11a4b8a9e29ae1beffede0c8bf83f409b904d982eb1daa8f"}, "http://2019.poleval.pl/task6/task6_test.zip": {"num_bytes": 70051, "checksum": "6acac459608b2d6da75f138740447b047c7bd3e0bbf562964845830a27a0b2f7"}}, "download_size": 410147, "post_processing_size": null, "dataset_size": 1214003, "size_in_bytes": 1624150}}
|
dummy/task01/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:52f8c48d8f3a4fd300d62a910875f001f206852546fa8299c9f788aa362129f4
|
3 |
+
size 2898
|
dummy/task02/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:18b4a568ec0b4da4f9d8a23f9bd58346a6e4977dbb42dfbda32c6ef0ca11269f
|
3 |
+
size 2898
|
poleval2019_cyberbullying.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 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 |
+
"""Cyberbullying Classification Dataset in Polish"""
|
16 |
+
|
17 |
+
|
18 |
+
import os
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
|
23 |
+
_DESCRIPTION = """\
|
24 |
+
In Task 6-1, the participants are to distinguish between normal/non-harmful tweets (class: 0) and tweets
|
25 |
+
that contain any kind of harmful information (class: 1). This includes cyberbullying, hate speech and
|
26 |
+
related phenomena.
|
27 |
+
|
28 |
+
In Task 6-2, the participants shall distinguish between three classes of tweets: 0 (non-harmful),
|
29 |
+
1 (cyberbullying), 2 (hate-speech). There are various definitions of both cyberbullying and hate-speech,
|
30 |
+
some of them even putting those two phenomena in the same group. The specific conditions on which we based
|
31 |
+
our annotations for both cyberbullying and hate-speech, which have been worked out during ten years of research
|
32 |
+
will be summarized in an introductory paper for the task, however, the main and definitive condition to 1
|
33 |
+
distinguish the two is whether the harmful action is addressed towards a private person(s) (cyberbullying),
|
34 |
+
or a public person/entity/large group (hate-speech).
|
35 |
+
"""
|
36 |
+
|
37 |
+
_HOMEPAGE = "http://2019.poleval.pl/index.php/tasks/task6"
|
38 |
+
|
39 |
+
_URL_TRAIN_TASK1 = "http://2019.poleval.pl/task6/task_6-1.zip"
|
40 |
+
_URL_TRAIN_TASK2 = "http://2019.poleval.pl/task6/task_6-2.zip"
|
41 |
+
_URL_TEST = "http://2019.poleval.pl/task6/task6_test.zip"
|
42 |
+
|
43 |
+
_CITATION = """\
|
44 |
+
@proceedings{ogr:kob:19:poleval,
|
45 |
+
editor = {Maciej Ogrodniczuk and Łukasz Kobyliński},
|
46 |
+
title = {{Proceedings of the PolEval 2019 Workshop}},
|
47 |
+
year = {2019},
|
48 |
+
address = {Warsaw, Poland},
|
49 |
+
publisher = {Institute of Computer Science, Polish Academy of Sciences},
|
50 |
+
url = {http://2019.poleval.pl/files/poleval2019.pdf},
|
51 |
+
isbn = "978-83-63159-28-3"}
|
52 |
+
}
|
53 |
+
"""
|
54 |
+
|
55 |
+
|
56 |
+
class Poleval2019CyberBullyingConfig(datasets.BuilderConfig):
|
57 |
+
"""BuilderConfig for Poleval2019CyberBullying."""
|
58 |
+
|
59 |
+
def __init__(
|
60 |
+
self,
|
61 |
+
text_features,
|
62 |
+
label_classes,
|
63 |
+
**kwargs,
|
64 |
+
):
|
65 |
+
super(Poleval2019CyberBullyingConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
66 |
+
self.text_features = text_features
|
67 |
+
self.label_classes = label_classes
|
68 |
+
|
69 |
+
|
70 |
+
class Poleval2019CyberBullying(datasets.GeneratorBasedBuilder):
|
71 |
+
"""Cyberbullying Classification Dataset in Polish"""
|
72 |
+
|
73 |
+
VERSION = datasets.Version("1.0.0")
|
74 |
+
|
75 |
+
BUILDER_CONFIGS = [
|
76 |
+
Poleval2019CyberBullyingConfig(
|
77 |
+
name="task01",
|
78 |
+
text_features=["text"],
|
79 |
+
label_classes=["0", "1"],
|
80 |
+
),
|
81 |
+
Poleval2019CyberBullyingConfig(
|
82 |
+
name="task02",
|
83 |
+
text_features=["text"],
|
84 |
+
label_classes=["0", "1", "2"],
|
85 |
+
),
|
86 |
+
]
|
87 |
+
|
88 |
+
def _info(self):
|
89 |
+
|
90 |
+
features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features}
|
91 |
+
features["label"] = datasets.features.ClassLabel(names=self.config.label_classes)
|
92 |
+
|
93 |
+
return datasets.DatasetInfo(
|
94 |
+
description=_DESCRIPTION,
|
95 |
+
features=datasets.Features(features),
|
96 |
+
supervised_keys=("text", "label"),
|
97 |
+
homepage=_HOMEPAGE,
|
98 |
+
citation=_CITATION,
|
99 |
+
)
|
100 |
+
|
101 |
+
def _split_generators(self, dl_manager):
|
102 |
+
"""Returns SplitGenerators."""
|
103 |
+
|
104 |
+
if self.config.name == "task01":
|
105 |
+
train_path = dl_manager.download_and_extract(_URL_TRAIN_TASK1)
|
106 |
+
|
107 |
+
if self.config.name == "task02":
|
108 |
+
train_path = dl_manager.download_and_extract(_URL_TRAIN_TASK2)
|
109 |
+
|
110 |
+
data_dir_test = dl_manager.download_and_extract(_URL_TEST)
|
111 |
+
|
112 |
+
if self.config.name == "task01":
|
113 |
+
test_path = os.path.join(data_dir_test, "Task6", "task 01")
|
114 |
+
|
115 |
+
if self.config.name == "task02":
|
116 |
+
test_path = os.path.join(data_dir_test, "Task6", "task 02")
|
117 |
+
|
118 |
+
return [
|
119 |
+
datasets.SplitGenerator(
|
120 |
+
name=datasets.Split.TRAIN,
|
121 |
+
gen_kwargs={
|
122 |
+
"filepath": train_path,
|
123 |
+
"split": "train",
|
124 |
+
},
|
125 |
+
),
|
126 |
+
datasets.SplitGenerator(
|
127 |
+
name=datasets.Split.TEST,
|
128 |
+
gen_kwargs={
|
129 |
+
"filepath": test_path,
|
130 |
+
"split": "test",
|
131 |
+
},
|
132 |
+
),
|
133 |
+
]
|
134 |
+
|
135 |
+
def _generate_examples(self, filepath, split):
|
136 |
+
""" Yields examples. """
|
137 |
+
|
138 |
+
if split == "train":
|
139 |
+
text_path = os.path.join(filepath, "training_set_clean_only_text.txt")
|
140 |
+
label_path = os.path.join(filepath, "training_set_clean_only_tags.txt")
|
141 |
+
|
142 |
+
if split == "test":
|
143 |
+
if self.config.name == "task01":
|
144 |
+
text_path = os.path.join(filepath, "test_set_clean_only_text.txt")
|
145 |
+
label_path = os.path.join(filepath, "test_set_clean_only_tags.txt")
|
146 |
+
if self.config.name == "task02":
|
147 |
+
text_path = os.path.join(filepath, "test_set_only_text.txt")
|
148 |
+
label_path = os.path.join(filepath, "test_set_only_tags.txt")
|
149 |
+
|
150 |
+
with open(text_path, encoding="utf-8") as text_file:
|
151 |
+
with open(label_path, encoding="utf-8") as label_file:
|
152 |
+
for id_, (text, label) in enumerate(zip(text_file, label_file)):
|
153 |
+
yield id_, {"text": text.strip(), "label": int(label.strip())}
|