Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Sub-tasks:
sentiment-classification
Size:
10K - 100K
License:
Commit
·
4e84de4
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 +167 -0
- dataset_infos.json +1 -0
- dummy/0.0.0/dummy_data.zip +3 -0
- tamilmixsentiment.py +122 -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,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- expert-generated
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
- ta
|
9 |
+
licenses:
|
10 |
+
- unknown
|
11 |
+
multilinguality:
|
12 |
+
- multilingual
|
13 |
+
size_categories:
|
14 |
+
- 10K<n<100K
|
15 |
+
source_datasets:
|
16 |
+
- original
|
17 |
+
task_categories:
|
18 |
+
- text-classification
|
19 |
+
task_ids:
|
20 |
+
- sentiment-classification
|
21 |
+
---
|
22 |
+
|
23 |
+
# Dataset Card for Tamilmixsentiment
|
24 |
+
|
25 |
+
## Table of Contents
|
26 |
+
- [Dataset Description](#dataset-description)
|
27 |
+
- [Dataset Summary](#dataset-summary)
|
28 |
+
- [Supported Tasks](#supported-tasks-and-leaderboards)
|
29 |
+
- [Languages](#languages)
|
30 |
+
- [Dataset Structure](#dataset-structure)
|
31 |
+
- [Data Instances](#data-instances)
|
32 |
+
- [Data Fields](#data-instances)
|
33 |
+
- [Data Splits](#data-instances)
|
34 |
+
- [Dataset Creation](#dataset-creation)
|
35 |
+
- [Curation Rationale](#curation-rationale)
|
36 |
+
- [Source Data](#source-data)
|
37 |
+
- [Annotations](#annotations)
|
38 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
39 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
40 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
41 |
+
- [Discussion of Biases](#discussion-of-biases)
|
42 |
+
- [Other Known Limitations](#other-known-limitations)
|
43 |
+
- [Additional Information](#additional-information)
|
44 |
+
- [Dataset Curators](#dataset-curators)
|
45 |
+
- [Licensing Information](#licensing-information)
|
46 |
+
- [Citation Information](#citation-information)
|
47 |
+
|
48 |
+
## Dataset Description
|
49 |
+
|
50 |
+
- **Homepage:** [Tamilmixsentiment Homepage](https://dravidian-codemix.github.io/2020/index.html)
|
51 |
+
- **Repository:** [Tamilmixsentiment repository](https://dravidian-codemix.github.io/2020/datasets.html)
|
52 |
+
- **Paper:** [Corpus Creation for Sentiment Analysis in Code-Mixed Tamil-English Text](https://www.aclweb.org/anthology/2020.sltu-1.28/)
|
53 |
+
- **Leaderboard:** [Rank list](https://drive.google.com/file/d/1Mf8-No-63koGRwdF13RrO01NAFBlNmI0/view?usp=sharing)
|
54 |
+
- **Point of Contact:** [Bharathi Raja Chakravarthi](mailto:[email protected])
|
55 |
+
|
56 |
+
### Dataset Summary
|
57 |
+
The first gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. This makes the largest general domain sentiment dataset for this relatively low-resource language with code-mixing phenomenon. The comment/post may contain more than one sentence but the average sentence length of the corpora is 1. Each comment/post is annotated with sentiment polarity at the comment/post level. This dataset also has class imbalance problems depicting real-world scenarios.
|
58 |
+
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
To identify sentiment polarity of the code-mixed dataset of comments/posts in Tamil-English collected from social media.
|
61 |
+
|
62 |
+
### Languages
|
63 |
+
Tamil-English code-switched. The dataset contains all the three types of code-mixed sentences - Inter-Sentential switch, Intra-Sentential switch and Tag switching. Most comments were written in Roman script with either Tamil grammar with English lexicon or English grammar with Tamil lexicon. Some comments were written in Tamil script with English expressions in between.
|
64 |
+
|
65 |
+
|
66 |
+
## Dataset Structure
|
67 |
+
|
68 |
+
### Data Instances
|
69 |
+
|
70 |
+
An example from the Tamilmixsentiment train set looks as follows:
|
71 |
+
```
|
72 |
+
text label
|
73 |
+
Trailer late ah parthavanga like podunga Positive
|
74 |
+
```
|
75 |
+
|
76 |
+
### Data Fields
|
77 |
+
|
78 |
+
- `text`: Tamil-English code-mixed comment.
|
79 |
+
- `label`: list of the possible sentiments "Positive", "Negative", "Mixed_feelings", "unknown_state", "not-Tamil"
|
80 |
+
|
81 |
+
### Data Splits
|
82 |
+
|
83 |
+
The entire dataset of 15,744 sentences was randomly shuffled and split into three parts as follows:
|
84 |
+
|
85 |
+
| | Tain | Valid | Test |
|
86 |
+
| ----- | ------ | ----- | ---- |
|
87 |
+
| Tamilmixsentiment | 11335 | 1260 | 3149 |
|
88 |
+
|
89 |
+
|
90 |
+
## Dataset Creation
|
91 |
+
|
92 |
+
### Curation Rationale
|
93 |
+
|
94 |
+
Sentiment analysis has become important in social media research (Yang and Eisenstein, 2017). Until recently these applications were created for high-resourced languages which analysed monolingual utterances. But social media in multilingual communities contains more code-mixed text. Code-mixing is common among speakers in a bilingual speech community. As English is seen as the language of prestige and education, the influence of lexicon, connectives and phrases from English language is common in spoken Tamil. Tamil has little annotated data for code-mixed scenarios. An annotated corpus developed for monolingual data cannot deal with code-mixed usage and therefore it fails to yield good results due to mixture of languages at different levels of linguistic analysis. Therefore this dataset of code-mixed Tamil-English sentiment annotated corpus is created.
|
95 |
+
|
96 |
+
### Source Data
|
97 |
+
|
98 |
+
#### Initial Data Collection and Normalization
|
99 |
+
|
100 |
+
The data was scraped from Youtube. In total 184,573 sentences for Tamil from YouTube comments from the trailers of a movies released in 2019. Many of the them contained sentences
|
101 |
+
that were either entirely written in English or code-mixed Tamil-English or fully written in Tamil. So we filtered out a non-code-mixed corpus based on language identification
|
102 |
+
at comment level using the langdetect library. The comment is written fully in Tamil or English, we discarded that comment since monolingual resources are available for these languages. We also identified if the sentences were written in other languages such as Hindi, Malayalam, Urdu, Telugu, and Kannada. We preprocessed the comments by removing the emoticons and applying a sentence
|
103 |
+
length filter. We want to create a code-mixed corpus of reasonable size with sentences that have fairly defined sentiments which will be useful for future research. Thus our filter removed sentences with less than five words and more than 15 words after cleaning the data. In the end we got 15,744 Tanglish sentences.
|
104 |
+
|
105 |
+
#### Who are the source language producers?
|
106 |
+
|
107 |
+
Youtube users
|
108 |
+
|
109 |
+
### Annotations
|
110 |
+
|
111 |
+
#### Annotation process
|
112 |
+
|
113 |
+
Three steps complete the annotation setup. First, each sentence was annotated by two people. In the second step, the data were collected if both of them agreed. In the case of conflict, a third person annotated the sentence. In the third step, if all the three of them did not agree, then two more annotators annotated the sentences.
|
114 |
+
|
115 |
+
#### Who are the annotators?
|
116 |
+
|
117 |
+
Eleven volunteers were involved in the process. All of them were native speakers of Tamil with diversity in gender, educational level and medium of instruction in their school education.
|
118 |
+
|
119 |
+
### Personal and Sensitive Information
|
120 |
+
|
121 |
+
[More Information Needed]
|
122 |
+
|
123 |
+
## Considerations for Using the Data
|
124 |
+
|
125 |
+
### Social Impact of Dataset
|
126 |
+
|
127 |
+
[More Information Needed]
|
128 |
+
|
129 |
+
### Discussion of Biases
|
130 |
+
|
131 |
+
[More Information Needed]
|
132 |
+
|
133 |
+
### Other Known Limitations
|
134 |
+
|
135 |
+
[More Information Needed]
|
136 |
+
|
137 |
+
## Additional Information
|
138 |
+
|
139 |
+
### Dataset Curators
|
140 |
+
|
141 |
+
[More Information Needed]
|
142 |
+
|
143 |
+
### Licensing Information
|
144 |
+
|
145 |
+
[More Information Needed]
|
146 |
+
|
147 |
+
### Citation Information
|
148 |
+
|
149 |
+
```
|
150 |
+
@inproceedings{chakravarthi-etal-2020-corpus,
|
151 |
+
title = "Corpus Creation for Sentiment Analysis in Code-Mixed {T}amil-{E}nglish Text",
|
152 |
+
author = "Chakravarthi, Bharathi Raja and
|
153 |
+
Muralidaran, Vigneshwaran and
|
154 |
+
Priyadharshini, Ruba and
|
155 |
+
McCrae, John Philip",
|
156 |
+
booktitle = "Proceedings of the 1st Joint Workshop on Spoken Language Technologies for Under-resourced languages (SLTU) and Collaboration and Computing for Under-Resourced Languages (CCURL)",
|
157 |
+
month = may,
|
158 |
+
year = "2020",
|
159 |
+
address = "Marseille, France",
|
160 |
+
publisher = "European Language Resources association",
|
161 |
+
url = "https://www.aclweb.org/anthology/2020.sltu-1.28",
|
162 |
+
pages = "202--210",
|
163 |
+
abstract = "Understanding the sentiment of a comment from a video or an image is an essential task in many applications. Sentiment analysis of a text can be useful for various decision-making processes. One such application is to analyse the popular sentiments of videos on social media based on viewer comments. However, comments from social media do not follow strict rules of grammar, and they contain mixing of more than one language, often written in non-native scripts. Non-availability of annotated code-mixed data for a low-resourced language like Tamil also adds difficulty to this problem. To overcome this, we created a gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. In this paper, we describe the process of creating the corpus and assigning polarities. We present inter-annotator agreement and show the results of sentiment analysis trained on this corpus as a benchmark.",
|
164 |
+
language = "English",
|
165 |
+
ISBN = "979-10-95546-35-1",
|
166 |
+
}
|
167 |
+
```
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "The first gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. Train: 11,335 Validation: 1,260 and Test: 3,149. This makes the largest general domain sentiment dataset for this relatively low-resource language with code-mixing phenomenon. The dataset contains all the three types of code-mixed sentences - Inter-Sentential switch, Intra-Sentential switch and Tag switching. Most comments were written in Roman script with either Tamil grammar with English lexicon or English grammar with Tamil lexicon. Some comments were written in Tamil script with English expressions in between.\n", "citation": "@inproceedings{chakravarthi-etal-2020-corpus,\n title = \"Corpus Creation for Sentiment Analysis in Code-Mixed {T}amil-{E}nglish Text\",\n author = \"Chakravarthi, Bharathi Raja and\n Muralidaran, Vigneshwaran and\n Priyadharshini, Ruba and\n McCrae, John Philip\",\n booktitle = \"Proceedings of the 1st Joint Workshop on Spoken Language Technologies for Under-resourced languages (SLTU) and Collaboration and Computing for Under-Resourced Languages (CCURL)\",\n month = may,\n year = \"2020\",\n address = \"Marseille, France\",\n publisher = \"European Language Resources association\",\n url = \"https://www.aclweb.org/anthology/2020.sltu-1.28\",\n pages = \"202--210\",\n abstract = \"Understanding the sentiment of a comment from a video or an image is an essential task in many applications. Sentiment analysis of a text can be useful for various decision-making processes. One such application is to analyse the popular sentiments of videos on social media based on viewer comments. However, comments from social media do not follow strict rules of grammar, and they contain mixing of more than one language, often written in non-native scripts. Non-availability of annotated code-mixed data for a low-resourced language like Tamil also adds difficulty to this problem. To overcome this, we created a gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. In this paper, we describe the process of creating the corpus and assigning polarities. We present inter-annotator agreement and show the results of sentiment analysis trained on this corpus as a benchmark.\",\n language = \"English\",\n ISBN = \"979-10-95546-35-1\",\n}\n", "homepage": "https://dravidian-codemix.github.io/2020/datasets.html", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 5, "names": ["Positive", "Negative", "Mixed_feelings", "unknown_state", "not-Tamil"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "tamilmixsentiment", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 790132, "num_examples": 11335, "dataset_name": "tamilmixsentiment"}, "validation": {"name": "validation", "num_bytes": 89618, "num_examples": 1260, "dataset_name": "tamilmixsentiment"}, "test": {"name": "test", "num_bytes": 218764, "num_examples": 3149, "dataset_name": "tamilmixsentiment"}}, "download_checksums": {"https://drive.google.com/u/0/uc?id=1hDHeoFIfQzJec1NgZNXh3CTNbchiIvuG&export=download": {"num_bytes": 801261, "checksum": "4be61bf29cb68e83d682d33898bf41b2240d960f85e2ccec50e6c4fb8e24e243"}, "https://drive.google.com/u/0/uc?id=1lyCxkDwZyvKLaF5NZhS3JE2ftMmHAKBT&export=download": {"num_bytes": 90843, "checksum": "d4bc37c4d0ccbca7079ea5f5c0c6d3ef0fcca3a084be7af28ec052bc5cdfe5f2"}, "https://docs.google.com/spreadsheets/d/1_6HJWkOuD76pQ6M_RVoP4FOsUK22zPl1IMpq1atLhl4/export?format=tsv": {"num_bytes": 258688, "checksum": "8047bb44125bbc926d38aafea01e2b342bdbd317b53baee8c4dccaeae58021e1"}}, "download_size": 1150792, "post_processing_size": null, "dataset_size": 1098514, "size_in_bytes": 2249306}}
|
dummy/0.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:385485e169da63a1a5ebeb505b16d4d4926d119bddcfc326dda2699da4b63aa2
|
3 |
+
size 1292
|
tamilmixsentiment.py
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""Code-Mixed Tamil-English Text for Sentiment Analysis"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
|
21 |
+
import datasets
|
22 |
+
|
23 |
+
|
24 |
+
_CITATION = """\
|
25 |
+
@inproceedings{chakravarthi-etal-2020-corpus,
|
26 |
+
title = "Corpus Creation for Sentiment Analysis in Code-Mixed {T}amil-{E}nglish Text",
|
27 |
+
author = "Chakravarthi, Bharathi Raja and
|
28 |
+
Muralidaran, Vigneshwaran and
|
29 |
+
Priyadharshini, Ruba and
|
30 |
+
McCrae, John Philip",
|
31 |
+
booktitle = "Proceedings of the 1st Joint Workshop on Spoken Language Technologies for Under-resourced languages (SLTU) and Collaboration and Computing for Under-Resourced Languages (CCURL)",
|
32 |
+
month = may,
|
33 |
+
year = "2020",
|
34 |
+
address = "Marseille, France",
|
35 |
+
publisher = "European Language Resources association",
|
36 |
+
url = "https://www.aclweb.org/anthology/2020.sltu-1.28",
|
37 |
+
pages = "202--210",
|
38 |
+
abstract = "Understanding the sentiment of a comment from a video or an image is an essential task in many applications. Sentiment analysis of a text can be useful for various decision-making processes. One such application is to analyse the popular sentiments of videos on social media based on viewer comments. However, comments from social media do not follow strict rules of grammar, and they contain mixing of more than one language, often written in non-native scripts. Non-availability of annotated code-mixed data for a low-resourced language like Tamil also adds difficulty to this problem. To overcome this, we created a gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. In this paper, we describe the process of creating the corpus and assigning polarities. We present inter-annotator agreement and show the results of sentiment analysis trained on this corpus as a benchmark.",
|
39 |
+
language = "English",
|
40 |
+
ISBN = "979-10-95546-35-1",
|
41 |
+
}
|
42 |
+
"""
|
43 |
+
|
44 |
+
_DESCRIPTION = """\
|
45 |
+
The first gold standard Tamil-English code-switched, sentiment-annotated corpus containing 15,744 comment posts from YouTube. Train: 11,335 Validation: 1,260 and Test: 3,149. This makes the largest general domain sentiment dataset for this relatively low-resource language with code-mixing phenomenon. The dataset contains all the three types of code-mixed sentences - Inter-Sentential switch, Intra-Sentential switch and Tag switching. Most comments were written in Roman script with either Tamil grammar with English lexicon or English grammar with Tamil lexicon. Some comments were written in Tamil script with English expressions in between.
|
46 |
+
"""
|
47 |
+
|
48 |
+
_LICENSE = ""
|
49 |
+
|
50 |
+
_TRAIN_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1hDHeoFIfQzJec1NgZNXh3CTNbchiIvuG&export=download"
|
51 |
+
_VALIDATION_DOWNLOAD_URL = "https://drive.google.com/u/0/uc?id=1lyCxkDwZyvKLaF5NZhS3JE2ftMmHAKBT&export=download"
|
52 |
+
_TEST_DOWNLOAD_URL = (
|
53 |
+
"https://docs.google.com/spreadsheets/d/1_6HJWkOuD76pQ6M_RVoP4FOsUK22zPl1IMpq1atLhl4/export?format=tsv"
|
54 |
+
)
|
55 |
+
|
56 |
+
|
57 |
+
class Tamilmixsentiment(datasets.GeneratorBasedBuilder):
|
58 |
+
"""Tamilmixsentiment sentiment analysis dataset."""
|
59 |
+
|
60 |
+
def _info(self):
|
61 |
+
return datasets.DatasetInfo(
|
62 |
+
description=_DESCRIPTION,
|
63 |
+
features=datasets.Features(
|
64 |
+
{
|
65 |
+
"text": datasets.Value("string"),
|
66 |
+
"label": datasets.features.ClassLabel(
|
67 |
+
names=["Positive", "Negative", "Mixed_feelings", "unknown_state", "not-Tamil"]
|
68 |
+
),
|
69 |
+
}
|
70 |
+
),
|
71 |
+
homepage="https://dravidian-codemix.github.io/2020/datasets.html",
|
72 |
+
citation=_CITATION,
|
73 |
+
)
|
74 |
+
|
75 |
+
def _split_generators(self, dl_manager):
|
76 |
+
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
77 |
+
validation_path = dl_manager.download_and_extract(_VALIDATION_DOWNLOAD_URL)
|
78 |
+
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
gen_kwargs={
|
83 |
+
"filepath": train_path,
|
84 |
+
"split": "train",
|
85 |
+
},
|
86 |
+
),
|
87 |
+
datasets.SplitGenerator(
|
88 |
+
name=datasets.Split.VALIDATION,
|
89 |
+
gen_kwargs={
|
90 |
+
"filepath": validation_path,
|
91 |
+
"split": "validation",
|
92 |
+
},
|
93 |
+
),
|
94 |
+
datasets.SplitGenerator(
|
95 |
+
name=datasets.Split.TEST,
|
96 |
+
gen_kwargs={
|
97 |
+
"filepath": test_path,
|
98 |
+
"split": "test",
|
99 |
+
},
|
100 |
+
),
|
101 |
+
]
|
102 |
+
|
103 |
+
def _generate_examples(self, filepath, split):
|
104 |
+
"""Generate Tamilmixsentiment examples."""
|
105 |
+
with open(filepath, encoding="utf-8") as csv_file:
|
106 |
+
csv_reader = csv.reader(
|
107 |
+
csv_file, quotechar='"', delimiter="\t", quoting=csv.QUOTE_ALL, skipinitialspace=True
|
108 |
+
)
|
109 |
+
# skip header
|
110 |
+
next(csv_reader)
|
111 |
+
|
112 |
+
for id_, row in enumerate(csv_reader):
|
113 |
+
|
114 |
+
# test - has a first column indicating sentence number
|
115 |
+
if split == "test":
|
116 |
+
idcol, text, label = row
|
117 |
+
|
118 |
+
# train, validation
|
119 |
+
else:
|
120 |
+
text, label = row
|
121 |
+
|
122 |
+
yield id_, {"text": text, "label": label}
|