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

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +195 -0
  3. dataset_infos.json +1 -0
  4. dummy/1.1.0/dummy_data.zip +3 -0
  5. per_sent.py +150 -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,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - extended|other-MPQA-KBP Challenge-MediaRank
16
+ task_categories:
17
+ - text-classification
18
+ task_ids:
19
+ - sentiment-classification
20
+ ---
21
+
22
+ # Dataset Card for PerSenT
23
+
24
+ ## Table of Contents
25
+ - [Dataset Card for [PerSenT]](#dataset-card-for-dataset-name)
26
+ - [Table of Contents](#table-of-contents)
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-fields)
34
+ - [Data Splits](#data-splits)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
39
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
40
+ - [Annotations](#annotations)
41
+ - [Annotation process](#annotation-process)
42
+ - [Who are the annotators?](#who-are-the-annotators)
43
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
44
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
45
+ - [Social Impact of Dataset](#social-impact-of-dataset)
46
+ - [Discussion of Biases](#discussion-of-biases)
47
+ - [Other Known Limitations](#other-known-limitations)
48
+ - [Additional Information](#additional-information)
49
+ - [Dataset Curators](#dataset-curators)
50
+ - [Licensing Information](#licensing-information)
51
+ - [Citation Information](#citation-information)
52
+
53
+ ## Dataset Description
54
+
55
+ - **Homepage:** [PerSenT](https://stonybrooknlp.github.io/PerSenT/)
56
+ - **Repository:** [https://github.com/MHDBST/PerSenT](https://github.com/MHDBST/PerSenT)
57
+ - **Paper:** [arXiv](https://arxiv.org/abs/2011.06128)
58
+ - **Leaderboard:** NA
59
+ - **Point of Contact:** [Mohaddeseh Bastan](mbastan@cs.stonybrook.edu)
60
+
61
+ ### Dataset Summary
62
+
63
+ PerSenT is a crowd-sourced dataset that captures the sentiment of an author towards the main entity in a news article. This dataset contains annotations for 5.3k documents and 38k paragraphs covering 3.2k unique entities. For each article, annotators judge what the author’s sentiment is towards the main
64
+ (target) entity of the article. The annotations also include similar judgments on paragraphs within the article.
65
+
66
+ ### Supported Tasks and Leaderboards
67
+
68
+ Sentiment Classification: Each document consists of multiple paragraphs. Each paragraph is labeled separately (Positive, Neutral, Negative) and the author’s sentiment towards the whole document is included as a document-level label.
69
+
70
+ ### Languages
71
+
72
+ English
73
+
74
+ ## Dataset Structure
75
+
76
+ ### Data Instances
77
+
78
+ ```json
79
+ {'DOCUMENT': "Germany's Landesbank Baden Wuertemberg won EU approval Tuesday for a state bailout after it promised to shrink its balance sheet by 40 percent and refocus on lending to companies.\n The bank was several state-owned German institutions to run into trouble last year after it ran up more huge losses from investing in high-risk proprietary trading and capital market activities -- a business the EU has now told it to shun.\n Seven current and former managers of the bank are also being investigated by German authorities for risking or damaging the bank's capital by carrying out or failing to block investments in high-risk deals worth hundreds of millions from 2006.\n The European Commission said its Tuesday approval for the state rescue of the bank and its new restructuring plan would allow it become a viable business again -- and that the cutbacks would help limit the unfair advantage over rivals that the bank would get from the state aid.\n Stuttgart-based LBBW earlier this year received a capital injection of (EURO)5 billion from the bank's shareholders all of them public authorities or state-owned including the state of Baden-Wuerttemberg the region's savings bank association and the city of Stuttgart.",
80
+ 'DOCUMENT_INDEX': 1,
81
+ 'MASKED_DOCUMENT': "[TGT] won EU approval Tuesday for a state bailout after it promised to shrink its balance sheet by 40 percent and refocus on lending to companies.\n [TGT] was several state-owned German institutions to run into trouble last year after [TGT] ran up more huge losses from investing in high-risk proprietary trading and capital market activities -- a business the EU has now told it to shun.\n Seven current and former managers of [TGT] are also being investigated by German authorities for risking or damaging [TGT]'s capital by carrying out or failing to block investments in high-risk deals worth hundreds of millions from 2006.\n The European Commission said its Tuesday approval for the state rescue of [TGT] and its new restructuring plan would allow it become a viable business again -- and that the cutbacks would help limit the unfair advantage over rivals that [TGT] would get from the state aid.\n Stuttgart-based LBBW earlier this year received a capital injection of (EURO)5 billion from [TGT]'s shareholders all of them public authorities or state-owned including the state of Baden-Wuerttemberg the region's savings bank association and the city of Stuttgart.",
82
+ 'Paragraph0': 2,
83
+ 'Paragraph1': 0,
84
+ 'Paragraph10': -1,
85
+ 'Paragraph11': -1,
86
+ 'Paragraph12': -1,
87
+ 'Paragraph13': -1,
88
+ 'Paragraph14': -1,
89
+ 'Paragraph15': -1,
90
+ 'Paragraph2': 0,
91
+ 'Paragraph3': 1,
92
+ 'Paragraph4': 1,
93
+ 'Paragraph5': -1,
94
+ 'Paragraph6': -1,
95
+ 'Paragraph7': -1,
96
+ 'Paragraph8': -1,
97
+ 'Paragraph9': -1,
98
+ 'TARGET_ENTITY': 'Landesbank Baden Wuertemberg',
99
+ 'TITLE': 'German bank LBBW wins EU bailout approval',
100
+ 'TRUE_SENTIMENT': 0}
101
+ ```
102
+
103
+ ### Data Fields
104
+
105
+ - DOCUMENT_INDEX: ID of the document per original dataset
106
+ - TITLE: Title of the article
107
+ - DOCUMENT: Text of the article
108
+ - MASKED_DOCUMENT: Text of the article with the target entity masked with `[TGT]` token
109
+ - TARGET_ENTITY: The entity that the author is expressing opinion about
110
+ - TRUE_SENTIMENT: Label for entire article
111
+ - Paragraph{0..15}: Label for each paragraph in the article
112
+
113
+ **Note**: Labels are one of `[Negative, Neutral, Positive]`. Missing labels were replaced with `-1`.
114
+
115
+ ### Data Splits
116
+
117
+ To split the dataset, entities were split into 4 mutually exclusive sets. Due to the nature of news collections, some entities tend to dominate the collection. In the collection, there were four entities which were the main entity in nearly 800 articles. To avoid these entities from dominating the train or test splits, these were moved them to a separate test collection. The remaining was split into a training, dev, and test sets at random. Thus the collection includes one standard test set consisting of articles drawn at random (Test Standard), while the other is a test set which contains multiple articles about a small number of popular entities (Test Frequent).
118
+
119
+ ## Dataset Creation
120
+
121
+ ### Curation Rationale
122
+
123
+ [More Information Needed]
124
+
125
+ ### Source Data
126
+
127
+ #### Initial Data Collection and Normalization
128
+
129
+ Articles were selected from 3 sources:
130
+ 1. MPQA (Deng and Wiebe, 2015; Wiebe et al., 2005): This dataset contains news articles manually annotated for opinions, beliefs, emotions, sentiments, speculations, etc. It also has target annotations which are entities and event anchored to the heads of noun or verb phrases. All decisions on this dataset are made on sentence-level and over short spans.
131
+ 2. KBP Challenge (Ellis et al., 2014): This resource contains TAC 2014 KBP English sentiment slot filling challenge dataset. This is a document-level sentiment filling dataset. In this task, given an entity and a sentiment (positive/negative) from the document, the goal is to find entities toward which
132
+ the original entity holds the given sentimental view. We selected documents from this resource which have been used in the following similar work in sentiment analysis task (Choi et al., 2016).
133
+ 3. Media Rank (Ye and Skiena, 2019): This dataset ranks about 50k news sources along different aspects. It is also used for classifying political ideology of news articles (Kulkarni et al., 2018).
134
+
135
+ Pre-processing steps:
136
+ - First we find all the person entities in each article, using Stanford NER (Name Entity Resolution) tagger (Finkel et al., 2005) and all mentions of them using co-reference resolution (Clark and Manning, 2016; Co, 2017).
137
+ - We removed articles which are not likely to have a main entity of focus. We used a simple heuristic of removing articles in which the most frequent person entity is mentioned only three times or less (even when counting co-referent mentions).
138
+ - For the articles that remain we deemed the most frequent entity to be the main entity of the article. We also filtered out extremely long and extremely short articles to keep the articles which have at least 3 paragraphs and at most 16 paragraphs.
139
+
140
+ Documents are randomly separated into train, dev, and two test sets. We ensure that each entity appears in only one of the sets. Our goal here is to avoid easy to learn biases over entities. To avoid the most frequent entities from dominating the training or the test sets, we remove articles that covered the most frequent entities and use them as a separate test set (referred to as frequent test set) in addition to the randomly drawn standard test set.
141
+
142
+ ### Annotations
143
+
144
+ #### Annotation process
145
+
146
+ We obtained document and paragraph level annotations with the help of Amazon Mechanical Turk workers. The workers first verified if the target entity we provide is indeed the main entity in the document. Then, they rated each paragraph in a document that contained a direct mention or a reference to the target
147
+ entity. Last, they rated the sentiment towards the entity based on the entire document. In both cases, the workers made assessments about the authors view based on what they said about the target entity. For both paragraph and document level sentiment, the workers chose from five rating categories: Negative,
148
+ Slightly Negative, Neutral, Slightly Positive, or Positive. We then combine the fine-grained annotations to obtain three coarse-grained classes Negative, Neutral, or Positive.
149
+
150
+ #### Who are the annotators?
151
+
152
+ [More Information Needed]
153
+
154
+ ### Personal and Sensitive Information
155
+
156
+ [More Information Needed]
157
+
158
+ ## Considerations for Using the Data
159
+
160
+ [More Information Needed]
161
+
162
+ ### Social Impact of Dataset
163
+
164
+ [More Information Needed]
165
+
166
+ ### Discussion of Biases
167
+
168
+ [More Information Needed]
169
+
170
+ ### Other Known Limitations
171
+
172
+ [More Information Needed]
173
+
174
+ ## Additional Information
175
+
176
+ ### Dataset Curators
177
+
178
+ [More Information Needed]
179
+
180
+ ### Licensing Information
181
+
182
+ [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/)
183
+
184
+ ### Citation Information
185
+
186
+ ```
187
+ @inproceedings{bastan2020authors,
188
+ title={Author's Sentiment Prediction},
189
+ author={Mohaddeseh Bastan and Mahnaz Koupaee and Youngseo Son and Richard Sicoli and Niranjan Balasubramanian},
190
+ year={2020},
191
+ eprint={2011.06128},
192
+ archivePrefix={arXiv},
193
+ primaryClass={cs.CL}
194
+ }
195
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"default": {"description": "Person SenTiment (PerSenT) is a crowd-sourced dataset that captures the sentiment of an author towards the main entity in a news article. This dataset contains annotation for 5.3k documents and 38k paragraphs covering 3.2k unique entities.\n\nThe dataset consists of sentiment annotations on news articles about people. For each article, annotators judge what the author\u2019s sentiment is towards the main (target) entity of the article. The annotations also include similar judgments on paragraphs within the article.\n\nTo split the dataset, entities into 4 mutually exclusive sets. Due to the nature of news collections, some entities tend to dominate the collection. In the collection, there were four entities which were the main entity in nearly 800 articles. To avoid these entities from dominating the train or test splits, we moved them to a separate test collection. We split the remaining into a training, dev, and test sets at random. Thus our collection includes one standard test set consisting of articles drawn at random (Test Standard -- `test_random`), while the other is a test set which contains multiple articles about a small number of popular entities (Test Frequent -- `test_fixed`).\n", "citation": "@inproceedings{bastan2020authors,\n title={Author's Sentiment Prediction},\n author={Mohaddeseh Bastan and Mahnaz Koupaee and Youngseo Son and Richard Sicoli and Niranjan Balasubramanian},\n year={2020},\n eprint={2011.06128},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://stonybrooknlp.github.io/PerSenT", "license": "Creative Commons Attribution 4.0 International License", "features": {"DOCUMENT_INDEX": {"dtype": "int64", "id": null, "_type": "Value"}, "TITLE": {"dtype": "string", "id": null, "_type": "Value"}, "TARGET_ENTITY": {"dtype": "string", "id": null, "_type": "Value"}, "DOCUMENT": {"dtype": "string", "id": null, "_type": "Value"}, "MASKED_DOCUMENT": {"dtype": "string", "id": null, "_type": "Value"}, "TRUE_SENTIMENT": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph0": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph1": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph2": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph3": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph4": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph5": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph6": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph7": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph8": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph9": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph10": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph11": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph12": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph13": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph14": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}, "Paragraph15": {"num_classes": 3, "names": ["Negative", "Neutral", "Positive"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "per_sent", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 14595163, "num_examples": 3355, "dataset_name": "per_sent"}, "test_random": {"name": "test_random", "num_bytes": 2629500, "num_examples": 579, "dataset_name": "per_sent"}, "test_fixed": {"name": "test_fixed", "num_bytes": 3881800, "num_examples": 827, "dataset_name": "per_sent"}, "validation": {"name": "validation", "num_bytes": 2322922, "num_examples": 578, "dataset_name": "per_sent"}}, "download_checksums": {"https://raw.githubusercontent.com/MHDBST/PerSenT/main/train.csv": {"num_bytes": 14397450, "checksum": "7fbca893d6c29e937dbf7d445cfec2a86de10977baf20de5ac0468994245cede"}, "https://raw.githubusercontent.com/MHDBST/PerSenT/main/dev.csv": {"num_bytes": 2289404, "checksum": "9db2929ff199b6beff0d4484b1e566808a6abc6648f46467dabdac65cb7f4887"}, "https://raw.githubusercontent.com/MHDBST/PerSenT/main/fixed_test.csv": {"num_bytes": 3833535, "checksum": "344c086ec880f9b2bca107d9592535dcab7065f25c5ba7a1f6520328fe9c7962"}, "https://raw.githubusercontent.com/MHDBST/PerSenT/main/random_test.csv": {"num_bytes": 2596807, "checksum": "b1681bd9c4e1ae5b87e0ecc90cfa08086669ba400bde64adaa43814465528ac7"}}, "download_size": 23117196, "post_processing_size": null, "dataset_size": 23429385, "size_in_bytes": 46546581}}
dummy/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ecee5b043a15f0f9c4f98fe048f0496c51b271084eb9130b3dc22a63dd8ed4ba
3
+ size 13066
per_sent.py ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """ **Person SenTiment, a challenge dataset for author sentiment prediction in the news domain **
16
+
17
+ PerSenT is a crowd-sourced dataset that captures the sentiment of an author towards the main entity in a news article. This dataset contains annotation for 5.3k documents and 38k paragraphs covering 3.2k unique entities.
18
+
19
+ """
20
+
21
+ from __future__ import absolute_import, division, print_function
22
+
23
+ import csv
24
+
25
+ import datasets
26
+ from datasets.splits import NamedSplit
27
+
28
+
29
+ # TODO: Add BibTeX citation
30
+ # Find for instance the citation on arxiv or on the dataset repo/website
31
+ _CITATION = """\
32
+ @inproceedings{bastan2020authors,
33
+ title={Author's Sentiment Prediction},
34
+ author={Mohaddeseh Bastan and Mahnaz Koupaee and Youngseo Son and Richard Sicoli and Niranjan Balasubramanian},
35
+ year={2020},
36
+ eprint={2011.06128},
37
+ archivePrefix={arXiv},
38
+ primaryClass={cs.CL}
39
+ }
40
+ """
41
+
42
+ _DESCRIPTION = """\
43
+ Person SenTiment (PerSenT) is a crowd-sourced dataset that captures the sentiment of an author towards the main entity in a news article. This dataset contains annotation for 5.3k documents and 38k paragraphs covering 3.2k unique entities.
44
+
45
+ The dataset consists of sentiment annotations on news articles about people. For each article, annotators judge what the author’s sentiment is towards the main (target) entity of the article. The annotations also include similar judgments on paragraphs within the article.
46
+
47
+ To split the dataset, entities into 4 mutually exclusive sets. Due to the nature of news collections, some entities tend to dominate the collection. In the collection, there were four entities which were the main entity in nearly 800 articles. To avoid these entities from dominating the train or test splits, we moved them to a separate test collection. We split the remaining into a training, dev, and test sets at random. Thus our collection includes one standard test set consisting of articles drawn at random (Test Standard -- `test_random`), while the other is a test set which contains multiple articles about a small number of popular entities (Test Frequent -- `test_fixed`).
48
+ """
49
+
50
+ _LICENSE = "Creative Commons Attribution 4.0 International License"
51
+
52
+ _URLs = {
53
+ "train": "https://raw.githubusercontent.com/MHDBST/PerSenT/main/train.csv",
54
+ "dev": "https://raw.githubusercontent.com/MHDBST/PerSenT/main/dev.csv",
55
+ "test_random": "https://raw.githubusercontent.com/MHDBST/PerSenT/main/random_test.csv",
56
+ "test_fixed": "https://raw.githubusercontent.com/MHDBST/PerSenT/main/fixed_test.csv",
57
+ }
58
+
59
+
60
+ class PerSent(datasets.GeneratorBasedBuilder):
61
+ """Person SenTiment (PerSenT) is a crowd-sourced dataset that captures the sentiment of an author towards the main entity in a news article. This dataset contains annotations for 5.3k documents and 38k paragraphs covering 3.2k unique entities."""
62
+
63
+ VERSION = datasets.Version("1.1.0")
64
+ LABELS = ["Negative", "Neutral", "Positive"]
65
+ LABEL_COLS = ["TRUE_SENTIMENT"] + ["Paragraph" + str(i) for i in range(16)]
66
+
67
+ def _info(self):
68
+ label = datasets.features.ClassLabel(names=self.LABELS)
69
+ feature_dict = {
70
+ "DOCUMENT_INDEX": datasets.Value("int64"),
71
+ "TITLE": datasets.Value("string"),
72
+ "TARGET_ENTITY": datasets.Value("string"),
73
+ "DOCUMENT": datasets.Value("string"),
74
+ "MASKED_DOCUMENT": datasets.Value("string"),
75
+ }
76
+ feature_dict.update({k: label for k in self.LABEL_COLS})
77
+
78
+ return datasets.DatasetInfo(
79
+ description=_DESCRIPTION,
80
+ features=datasets.Features(feature_dict),
81
+ supervised_keys=None,
82
+ homepage="https://stonybrooknlp.github.io/PerSenT",
83
+ license=_LICENSE,
84
+ citation=_CITATION,
85
+ )
86
+
87
+ def _split_generators(self, dl_manager):
88
+ """Returns SplitGenerators."""
89
+ train_path = dl_manager.download(_URLs["train"])
90
+ dev_path = dl_manager.download(_URLs["dev"])
91
+ test_fixed_path = dl_manager.download(_URLs["test_fixed"])
92
+ test_random_path = dl_manager.download(_URLs["test_random"])
93
+
94
+ return [
95
+ datasets.SplitGenerator(
96
+ name=datasets.Split.TRAIN,
97
+ # These kwargs will be passed to _generate_examples
98
+ gen_kwargs={
99
+ "filepath": train_path,
100
+ "split": "train",
101
+ },
102
+ ),
103
+ datasets.SplitGenerator(
104
+ name=NamedSplit("test_random"),
105
+ # These kwargs will be passed to _generate_examples
106
+ gen_kwargs={"filepath": test_random_path, "split": "test_random"},
107
+ ),
108
+ datasets.SplitGenerator(
109
+ name=NamedSplit("test_fixed"),
110
+ # These kwargs will be passed to _generate_examples
111
+ gen_kwargs={"filepath": test_fixed_path, "split": "test_fixed"},
112
+ ),
113
+ datasets.SplitGenerator(
114
+ name=datasets.Split.VALIDATION,
115
+ # These kwargs will be passed to _generate_examples
116
+ gen_kwargs={
117
+ "filepath": dev_path,
118
+ "split": "dev",
119
+ },
120
+ ),
121
+ ]
122
+
123
+ def _generate_examples(self, filepath, split):
124
+ """Yields examples.
125
+
126
+ For examples with missing labels (empty strings in the original files), we replace with -1.
127
+ """
128
+
129
+ with open(filepath, encoding="utf-8") as f:
130
+ reader = csv.reader(f)
131
+
132
+ # Header
133
+ _ = next(reader)
134
+
135
+ for id_, row in enumerate(reader):
136
+ doc_idx, title, target, doc, masked_doc, *labels = row
137
+
138
+ # Replace missing labels with -1
139
+ labels = [label if label in self.LABELS else -1 for label in labels]
140
+
141
+ example = {
142
+ "DOCUMENT_INDEX": doc_idx,
143
+ "TITLE": title,
144
+ "TARGET_ENTITY": target,
145
+ "DOCUMENT": doc,
146
+ "MASKED_DOCUMENT": masked_doc,
147
+ }
148
+ example.update(dict(zip(self.LABEL_COLS, labels)))
149
+
150
+ yield id_, example