Datasets:
Commit
·
92282e8
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 +185 -0
- dataset_infos.json +1 -0
- dummy/offenseval2020-turkish/1.0.0/dummy_data.zip +3 -0
- offenseval2020_tr.py +120 -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,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
annotations_creators:
|
| 3 |
+
- found
|
| 4 |
+
language_creators:
|
| 5 |
+
- found
|
| 6 |
+
languages:
|
| 7 |
+
- tr
|
| 8 |
+
licenses:
|
| 9 |
+
- found
|
| 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 |
+
- text-classification-other-offensive-language-classification
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Dataset Card for OffensEval-TR 2020
|
| 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 |
+
- [Discussion of Social Impact and Biases](#discussion-of-social-impact-and-biases)
|
| 40 |
+
- [Other Known Limitations](#other-known-limitations)
|
| 41 |
+
- [Additional Information](#additional-information)
|
| 42 |
+
- [Dataset Curators](#dataset-curators)
|
| 43 |
+
- [Licensing Information](#licensing-information)
|
| 44 |
+
- [Citation Information](#citation-information)
|
| 45 |
+
|
| 46 |
+
## Dataset Description
|
| 47 |
+
|
| 48 |
+
- **Homepage:** [offensive-turkish](https://coltekin.github.io/offensive-turkish/)
|
| 49 |
+
- **Paper:** [A Corpus of Turkish Offensive Language on Social Media](https://coltekin.github.io/offensive-turkish/troff.pdf)
|
| 50 |
+
- **Point of Contact:** [Çağrı Çöltekin]([email protected])
|
| 51 |
+
|
| 52 |
+
### Dataset Summary
|
| 53 |
+
|
| 54 |
+
The file offenseval-tr-training-v1.tsv contains 31,756 annotated tweets.
|
| 55 |
+
|
| 56 |
+
The file offenseval-annotation.txt contains a short summary of the annotation guidelines.
|
| 57 |
+
|
| 58 |
+
Twitter user mentions were substituted by @USER and URLs have been substitute by URL.
|
| 59 |
+
|
| 60 |
+
Each instance contains up to 1 labels corresponding to one of the following sub-task:
|
| 61 |
+
|
| 62 |
+
- Sub-task A: Offensive language identification;
|
| 63 |
+
|
| 64 |
+
### Supported Tasks and Leaderboards
|
| 65 |
+
|
| 66 |
+
The dataset was published on this [paper](https://coltekin.github.io/offensive-turkish/troff.pdf).
|
| 67 |
+
|
| 68 |
+
### Languages
|
| 69 |
+
|
| 70 |
+
The dataset is based on Turkish.
|
| 71 |
+
|
| 72 |
+
## Dataset Structure
|
| 73 |
+
|
| 74 |
+
### Data Instances
|
| 75 |
+
|
| 76 |
+
A binary dataset with with (NOT) Not Offensive and (OFF) Offensive tweets.
|
| 77 |
+
|
| 78 |
+
### Data Fields
|
| 79 |
+
|
| 80 |
+
Instances are included in TSV format as follows:
|
| 81 |
+
|
| 82 |
+
ID INSTANCE SUBA
|
| 83 |
+
|
| 84 |
+
The column names in the file are the following:
|
| 85 |
+
|
| 86 |
+
id tweet subtask_a
|
| 87 |
+
|
| 88 |
+
The labels used in the annotation are listed below.
|
| 89 |
+
|
| 90 |
+
#### Task and Labels
|
| 91 |
+
|
| 92 |
+
(A) Sub-task A: Offensive language identification
|
| 93 |
+
|
| 94 |
+
- (NOT) Not Offensive - This post does not contain offense or profanity.
|
| 95 |
+
- (OFF) Offensive - This post contains offensive language or a targeted (veiled or direct) offense
|
| 96 |
+
|
| 97 |
+
In our annotation, we label a post as offensive (OFF) if it contains any form of non-acceptable language (profanity) or a targeted offense, which can be veiled or direct.
|
| 98 |
+
|
| 99 |
+
### Data Splits
|
| 100 |
+
|
| 101 |
+
| Tain | Test |
|
| 102 |
+
|-------| ----- |
|
| 103 |
+
| 31756 | 3528 |
|
| 104 |
+
|
| 105 |
+
## Dataset Creation
|
| 106 |
+
|
| 107 |
+
### Curation Rationale
|
| 108 |
+
|
| 109 |
+
[More Information Needed]
|
| 110 |
+
|
| 111 |
+
### Source Data
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Initial Data Collection and Normalization
|
| 116 |
+
|
| 117 |
+
[More Information Needed]
|
| 118 |
+
|
| 119 |
+
#### Who are the source language producers?
|
| 120 |
+
|
| 121 |
+
From tweeter.
|
| 122 |
+
|
| 123 |
+
### Annotations
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
#### Annotation process
|
| 128 |
+
|
| 129 |
+
We describe the labels above in a “flat” manner. However, the annotation process we follow is hierarchical. The following QA pairs give a more flowchart-like procedure to follow
|
| 130 |
+
|
| 131 |
+
1. Is the tweet in Turkish and understandable?
|
| 132 |
+
* No: mark tweet X for exclusion, and go to next tweet
|
| 133 |
+
* Yes: continue to step 2
|
| 134 |
+
2. Is the tweet include offensive/inappropriate language?
|
| 135 |
+
* No: mark the tweet non go to step 4
|
| 136 |
+
* Yes: continue to step 3
|
| 137 |
+
3. Is the offense in the tweet targeted?
|
| 138 |
+
* No: mark the tweet prof go to step 4
|
| 139 |
+
* Yes: chose one (or more) of grp, ind, *oth based on the definitions above. Please try to limit the number of labels unless it is clear that the tweet includes offense against multiple categories.
|
| 140 |
+
4. Was the labeling decision difficult (precise answer needs more context, tweets includes irony, or for another reason)?
|
| 141 |
+
* No: go to next tweet
|
| 142 |
+
* Yes: add the label X, go to next tweet
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
#### Who are the annotators?
|
| 146 |
+
|
| 147 |
+
[More Information Needed]
|
| 148 |
+
|
| 149 |
+
### Personal and Sensitive Information
|
| 150 |
+
|
| 151 |
+
[More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Considerations for Using the Data
|
| 154 |
+
|
| 155 |
+
### Discussion of Social Impact and Biases
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Other Known Limitations
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
## Additional Information
|
| 164 |
+
|
| 165 |
+
### Dataset Curators
|
| 166 |
+
|
| 167 |
+
[More Information Needed]
|
| 168 |
+
|
| 169 |
+
### Licensing Information
|
| 170 |
+
|
| 171 |
+
The annotations are distributed under the terms of [Creative Commons Attribution License (CC-BY)](https://creativecommons.org/licenses/by/2.0/). Please cite the following paper, if you use this resource.
|
| 172 |
+
|
| 173 |
+
### Citation Information
|
| 174 |
+
|
| 175 |
+
```
|
| 176 |
+
@inproceedings{coltekin2020lrec,
|
| 177 |
+
author = {\c{C}\"{o}ltekin, \c{C}a\u{g}r{\i}},
|
| 178 |
+
year = {2020},
|
| 179 |
+
title = {A Corpus of Turkish Offensive Language on Social Media},
|
| 180 |
+
booktitle = {Proceedings of The 12th Language Resources and Evaluation Conference},
|
| 181 |
+
pages = {6174--6184},
|
| 182 |
+
address = {Marseille, France},
|
| 183 |
+
url = {https://www.aclweb.org/anthology/2020.lrec-1.758},
|
| 184 |
+
}
|
| 185 |
+
```
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"offenseval2020-turkish": {"description": "OffensEval-TR 2020 is a Turkish offensive language corpus. The corpus consist of randomly sampled tweets, and annotated in a similar way to OffensEval and GermEval.\n", "citation": "@InProceedings{coltekin2020lrec,\n author = {Cagri Coltekin},\n year = {2020},\n title = {A Corpus of Turkish Offensive Language on Social Media},\n booktitle = {Proceedings of The 12th Language Resources and Evaluation Conference},\n pages = {6174--6184},\n address = {Marseille, France},\n url = {https://www.aclweb.org/anthology/2020.lrec-1.758},\n}\n", "homepage": "https://coltekin.github.io/offensive-turkish/", "license": "", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "tweet": {"dtype": "string", "id": null, "_type": "Value"}, "subtask_a": {"num_classes": 2, "names": ["NOT", "OFF"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "offenseval2020_tr", "config_name": "offenseval2020-turkish", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4260505, "num_examples": 31756, "dataset_name": "offenseval2020_tr"}, "test": {"name": "test", "num_bytes": 481300, "num_examples": 3528, "dataset_name": "offenseval2020_tr"}}, "download_checksums": {"https://coltekin.github.io/offensive-turkish/offenseval2020-turkish.zip": {"num_bytes": 2048258, "checksum": "7977e96255dbc9b8d14893f1b14cbe3dec53c70358503c062c5a59720ec9c2f2"}}, "download_size": 2048258, "post_processing_size": null, "dataset_size": 4741805, "size_in_bytes": 6790063}}
|
dummy/offenseval2020-turkish/1.0.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f47aafe795c5fbc6229c5a26875452278fc094123e6047c0bf88e26a3a692519
|
| 3 |
+
size 3715
|
offenseval2020_tr.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Lint as: python3
|
| 3 |
+
"""OffensEval-TR 2020: A Corpus of Turkish Offensive Language on Social Media"""
|
| 4 |
+
|
| 5 |
+
from __future__ import absolute_import, division, print_function
|
| 6 |
+
|
| 7 |
+
import csv
|
| 8 |
+
import logging
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
import datasets
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
_CITATION = """\
|
| 15 |
+
@InProceedings{coltekin2020lrec,
|
| 16 |
+
author = {Cagri Coltekin},
|
| 17 |
+
year = {2020},
|
| 18 |
+
title = {A Corpus of Turkish Offensive Language on Social Media},
|
| 19 |
+
booktitle = {Proceedings of The 12th Language Resources and Evaluation Conference},
|
| 20 |
+
pages = {6174--6184},
|
| 21 |
+
address = {Marseille, France},
|
| 22 |
+
url = {https://www.aclweb.org/anthology/2020.lrec-1.758},
|
| 23 |
+
}
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
_DESCRIPTION = """\
|
| 28 |
+
OffensEval-TR 2020 is a Turkish offensive language corpus. The corpus consist of randomly sampled tweets and annotated in a similar way to OffensEval and GermEval.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
_HOMEPAGE = "https://coltekin.github.io/offensive-turkish/"
|
| 32 |
+
_DOWNLOAD_URL = "https://coltekin.github.io/offensive-turkish/offenseval2020-turkish.zip"
|
| 33 |
+
_FOLDER_NAME = "offenseval-tr-{split}-v1"
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class OffensEval2020TRConfig(datasets.BuilderConfig):
|
| 37 |
+
"""BuilderConfig for OffensEval2020TR."""
|
| 38 |
+
|
| 39 |
+
def __init__(self, **kwargs):
|
| 40 |
+
"""BuilderConfig for OffensEval2020TR.
|
| 41 |
+
|
| 42 |
+
Args:
|
| 43 |
+
**kwargs: keyword arguments forwarded to super.
|
| 44 |
+
"""
|
| 45 |
+
super(OffensEval2020TRConfig, self).__init__(**kwargs)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class Offenseval2020TR(datasets.GeneratorBasedBuilder):
|
| 49 |
+
"""OffensEval-TR 2020: A Corpus of Turkish Offensive Language on Social Media"""
|
| 50 |
+
|
| 51 |
+
BUILDER_CONFIGS = [
|
| 52 |
+
OffensEval2020TRConfig(
|
| 53 |
+
name="offenseval2020-turkish",
|
| 54 |
+
version=datasets.Version("1.0.0"),
|
| 55 |
+
description="OffensEval-TR 2020: A Corpus of Turkish Offensive Language on Social Media",
|
| 56 |
+
),
|
| 57 |
+
]
|
| 58 |
+
|
| 59 |
+
def _info(self):
|
| 60 |
+
return datasets.DatasetInfo(
|
| 61 |
+
description=_DESCRIPTION,
|
| 62 |
+
features=datasets.Features(
|
| 63 |
+
{
|
| 64 |
+
"id": datasets.Value("int32"),
|
| 65 |
+
"tweet": datasets.Value("string"),
|
| 66 |
+
"subtask_a": datasets.features.ClassLabel(names=["NOT", "OFF"]),
|
| 67 |
+
}
|
| 68 |
+
),
|
| 69 |
+
supervised_keys=None,
|
| 70 |
+
homepage=_HOMEPAGE,
|
| 71 |
+
citation=_CITATION,
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
def _split_generators(self, dl_manager):
|
| 75 |
+
dl_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
| 76 |
+
data_dir = os.path.join(dl_dir, self.config.name)
|
| 77 |
+
|
| 78 |
+
return [
|
| 79 |
+
datasets.SplitGenerator(
|
| 80 |
+
name=datasets.Split.TRAIN,
|
| 81 |
+
gen_kwargs={
|
| 82 |
+
"filepath": os.path.join(
|
| 83 |
+
data_dir, _FOLDER_NAME.format(split="training"), "offenseval-tr-training-v1.tsv"
|
| 84 |
+
),
|
| 85 |
+
"labelpath": None,
|
| 86 |
+
},
|
| 87 |
+
),
|
| 88 |
+
datasets.SplitGenerator(
|
| 89 |
+
name=datasets.Split.TEST,
|
| 90 |
+
gen_kwargs={
|
| 91 |
+
"filepath": os.path.join(
|
| 92 |
+
data_dir, _FOLDER_NAME.format(split="testset"), "offenseval-tr-testset-v1.tsv"
|
| 93 |
+
),
|
| 94 |
+
"labelpath": os.path.join(
|
| 95 |
+
data_dir, _FOLDER_NAME.format(split="testset"), "offenseval-tr-labela-v1.tsv"
|
| 96 |
+
),
|
| 97 |
+
},
|
| 98 |
+
),
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
def _generate_examples(self, filepath, labelpath):
|
| 102 |
+
"""Generate OffensEval2020TR examples."""
|
| 103 |
+
logging.info("⏳ Generating examples from = %s", filepath)
|
| 104 |
+
|
| 105 |
+
if labelpath:
|
| 106 |
+
with open(filepath, encoding="utf-8") as f:
|
| 107 |
+
with open(labelpath, encoding="utf-8") as f2:
|
| 108 |
+
reader_testset = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
| 109 |
+
reader_label = csv.DictReader(
|
| 110 |
+
f2, delimiter=",", quoting=csv.QUOTE_NONE, fieldnames=["id", "subtask_a"]
|
| 111 |
+
)
|
| 112 |
+
list_label = list(reader_label)
|
| 113 |
+
for idx, row in enumerate(reader_testset):
|
| 114 |
+
row_label = list_label[idx]
|
| 115 |
+
yield idx, {"id": row["id"], "tweet": row["tweet"], "subtask_a": row_label["subtask_a"]}
|
| 116 |
+
else:
|
| 117 |
+
with open(filepath, encoding="utf-8") as f:
|
| 118 |
+
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
| 119 |
+
for idx, row in enumerate(reader):
|
| 120 |
+
yield idx, {"id": row["id"], "tweet": row["tweet"], "subtask_a": row["subtask_a"]}
|