Datasets:
cjvt
/

Modalities:
Tabular
Text
Languages:
Slovenian
Libraries:
Datasets
License:
Matej Klemen commited on
Commit
9db7fcc
·
1 Parent(s): aa8054c

First version of SentiNews dataset

Browse files
Files changed (2) hide show
  1. dataset_infos.json +1 -0
  2. sentinews.py +93 -0
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"document_level": {"description": "SentiNews is a Slovenian sentiment classification dataset, consisting of news articles manually annotated with their \nsentiment by between 2 and 6 annotators. The news articles contain political, business, economic and financial content \nfrom the Slovenian news portals 24ur, Dnevnik, Finance, Rtvslo, and \u017durnal24. The texts were annotated using the \nfive-level Lickert scale (1 \u2013 very negative, 2 \u2013 negative, 3 \u2013 neutral, 4 \u2013 positive, and 5 \u2013 very positive) on three \nlevels of granularity, i.e. on the document, paragraph, and sentence level. The final sentiment is determined using \nthe following criterion: negative (if average of scores \u2264 2.4); neutral (if average of scores is between 2.4 and 3.6); \npositive (average of annotated scores \u2265 3.6).\n", "citation": "@article{buvcar2018annotated, \n title={Annotated news corpora and a lexicon for sentiment analysis in Slovene}, \n author={Bu{\u000b{c}}ar, Jo{\u000b{z}}e and {\u000b{Z}}nidar{\u000b{s}}i{\u000b{c}}, Martin and Povh, Janez}, \n journal={Language Resources and Evaluation}, \n volume={52}, \n number={3}, \n pages={895--919}, \n year={2018}, \n publisher={Springer}\n}\n", "homepage": "https://github.com/19Joey85/Sentiment-annotated-news-corpus-and-sentiment-lexicon-in-Slovene/", "license": "Creative Commons - Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"nid": {"dtype": "uint16", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}, "sentiment": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "content", "output": "sentiment"}, "task_templates": null, "builder_name": "sentinews", "config_name": "document_level", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 21726849, "num_examples": 10427, "dataset_name": "sentinews"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_document-level.txt": {"num_bytes": 23755522, "checksum": "060fe71d719d79e3bcba335abfc146485fa2f3568b5cc1245bd694834d77190c"}}, "download_size": 23755522, "post_processing_size": null, "dataset_size": 21726849, "size_in_bytes": 45482371}, "paragraph_level": {"description": "SentiNews is a Slovenian sentiment classification dataset, consisting of news articles manually annotated with their \nsentiment by between 2 and 6 annotators. The news articles contain political, business, economic and financial content \nfrom the Slovenian news portals 24ur, Dnevnik, Finance, Rtvslo, and \u017durnal24. The texts were annotated using the \nfive-level Lickert scale (1 \u2013 very negative, 2 \u2013 negative, 3 \u2013 neutral, 4 \u2013 positive, and 5 \u2013 very positive) on three \nlevels of granularity, i.e. on the document, paragraph, and sentence level. The final sentiment is determined using \nthe following criterion: negative (if average of scores \u2264 2.4); neutral (if average of scores is between 2.4 and 3.6); \npositive (average of annotated scores \u2265 3.6).\n", "citation": "@article{buvcar2018annotated, \n title={Annotated news corpora and a lexicon for sentiment analysis in Slovene}, \n author={Bu{\u000b{c}}ar, Jo{\u000b{z}}e and {\u000b{Z}}nidar{\u000b{s}}i{\u000b{c}}, Martin and Povh, Janez}, \n journal={Language Resources and Evaluation}, \n volume={52}, \n number={3}, \n pages={895--919}, \n year={2018}, \n publisher={Springer}\n}\n", "homepage": "https://github.com/19Joey85/Sentiment-annotated-news-corpus-and-sentiment-lexicon-in-Slovene/", "license": "Creative Commons - Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"nid": {"dtype": "uint16", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}, "sentiment": {"dtype": "string", "id": null, "_type": "Value"}, "pid": {"dtype": "uint8", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "content", "output": "sentiment"}, "task_templates": null, "builder_name": "sentinews", "config_name": "paragraph_level", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 23107429, "num_examples": 89999, "dataset_name": "sentinews"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_paragraph-level.txt": {"num_bytes": 24342387, "checksum": "c45535325db5a6ef5073d7a594c68e5a5c60983d2e1b277f0dbf76f9975a9f18"}}, "download_size": 24342387, "post_processing_size": null, "dataset_size": 23107429, "size_in_bytes": 47449816}, "sentence_level": {"description": "SentiNews is a Slovenian sentiment classification dataset, consisting of news articles manually annotated with their \nsentiment by between 2 and 6 annotators. The news articles contain political, business, economic and financial content \nfrom the Slovenian news portals 24ur, Dnevnik, Finance, Rtvslo, and \u017durnal24. The texts were annotated using the \nfive-level Lickert scale (1 \u2013 very negative, 2 \u2013 negative, 3 \u2013 neutral, 4 \u2013 positive, and 5 \u2013 very positive) on three \nlevels of granularity, i.e. on the document, paragraph, and sentence level. The final sentiment is determined using \nthe following criterion: negative (if average of scores \u2264 2.4); neutral (if average of scores is between 2.4 and 3.6); \npositive (average of annotated scores \u2265 3.6).\n", "citation": "@article{buvcar2018annotated, \n title={Annotated news corpora and a lexicon for sentiment analysis in Slovene}, \n author={Bu{\u000b{c}}ar, Jo{\u000b{z}}e and {\u000b{Z}}nidar{\u000b{s}}i{\u000b{c}}, Martin and Povh, Janez}, \n journal={Language Resources and Evaluation}, \n volume={52}, \n number={3}, \n pages={895--919}, \n year={2018}, \n publisher={Springer}\n}\n", "homepage": "https://github.com/19Joey85/Sentiment-annotated-news-corpus-and-sentiment-lexicon-in-Slovene/", "license": "Creative Commons - Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"nid": {"dtype": "uint16", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}, "sentiment": {"dtype": "string", "id": null, "_type": "Value"}, "pid": {"dtype": "uint8", "id": null, "_type": "Value"}, "sid": {"dtype": "uint8", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "content", "output": "sentiment"}, "task_templates": null, "builder_name": "sentinews", "config_name": "sentence_level", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 24641935, "num_examples": 168899, "dataset_name": "sentinews"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_sentence-level.txt": {"num_bytes": 27220223, "checksum": "4382e064543b7fc6d61cc76bc2f16f8f37c80065dbc4f87b888919d1f45bb9c1"}}, "download_size": 27220223, "post_processing_size": null, "dataset_size": 24641935, "size_in_bytes": 51862158}}
sentinews.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """SentiNews: Manually sentiment annotated Slovenian news corpus."""
2
+
3
+
4
+ import csv
5
+
6
+ import datasets
7
+
8
+ _CITATION = """\
9
+ @article{buvcar2018annotated,
10
+ title={Annotated news corpora and a lexicon for sentiment analysis in Slovene},
11
+ author={Bu{\v{c}}ar, Jo{\v{z}}e and {\v{Z}}nidar{\v{s}}i{\v{c}}, Martin and Povh, Janez},
12
+ journal={Language Resources and Evaluation},
13
+ volume={52},
14
+ number={3},
15
+ pages={895--919},
16
+ year={2018},
17
+ publisher={Springer}
18
+ }
19
+ """
20
+
21
+ _DESCRIPTION = """\
22
+ SentiNews is a Slovenian sentiment classification dataset, consisting of news articles manually annotated with their
23
+ sentiment by between 2 and 6 annotators. The news articles contain political, business, economic and financial content
24
+ from the Slovenian news portals 24ur, Dnevnik, Finance, Rtvslo, and Žurnal24. The texts were annotated using the
25
+ five-level Lickert scale (1 – very negative, 2 – negative, 3 – neutral, 4 – positive, and 5 – very positive) on three
26
+ levels of granularity, i.e. on the document, paragraph, and sentence level. The final sentiment is determined using
27
+ the following criterion: negative (if average of scores ≤ 2.4); neutral (if average of scores is between 2.4 and 3.6);
28
+ positive (average of annotated scores ≥ 3.6).
29
+ """
30
+
31
+ _HOMEPAGE = "https://github.com/19Joey85/Sentiment-annotated-news-corpus-and-sentiment-lexicon-in-Slovene/"
32
+
33
+ _LICENSE = "Creative Commons - Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)"
34
+
35
+ _URLS = {
36
+ "document_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_document-level.txt",
37
+ "paragraph_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_paragraph-level.txt",
38
+ "sentence_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_sentence-level.txt"
39
+ }
40
+
41
+
42
+ class Sentinews(datasets.GeneratorBasedBuilder):
43
+ """SentiNews: Manually sentiment annotated Slovenian news corpus. Version 1.0."""
44
+
45
+ VERSION = datasets.Version("1.0.0")
46
+
47
+ BUILDER_CONFIGS = [
48
+ datasets.BuilderConfig(name="document_level", version=VERSION, description="Dataset annotated at document level."),
49
+ datasets.BuilderConfig(name="paragraph_level", version=VERSION, description="Dataset annotated at paragraph level."),
50
+ datasets.BuilderConfig(name="sentence_level", version=VERSION, description="Dataset annotated at sentence level."),
51
+ ]
52
+
53
+ def _info(self):
54
+ _config_features = {
55
+ "nid": datasets.Value("uint16"),
56
+ "content": datasets.Value("string"),
57
+ "sentiment": datasets.Value("string")
58
+ }
59
+
60
+ if self.config.name == "paragraph_level":
61
+ _config_features["pid"] = datasets.Value("uint8")
62
+ elif self.config.name == "sentence_level":
63
+ _config_features["pid"] = datasets.Value("uint8")
64
+ _config_features["sid"] = datasets.Value("uint8")
65
+
66
+ features = datasets.Features(_config_features)
67
+ return datasets.DatasetInfo(
68
+ description=_DESCRIPTION,
69
+ features=features,
70
+ supervised_keys=("content", "sentiment"),
71
+ homepage=_HOMEPAGE,
72
+ license=_LICENSE,
73
+ citation=_CITATION,
74
+ )
75
+
76
+ def _split_generators(self, dl_manager):
77
+ urls = _URLS[self.config.name]
78
+ data_file = dl_manager.download_and_extract(urls)
79
+ return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"data_file": data_file})]
80
+
81
+ def _generate_examples(self, data_file):
82
+ _keys_to_return = ["nid", "content", "sentiment"]
83
+
84
+ if self.config.name == "paragraph_level":
85
+ _keys_to_return.append("pid")
86
+ elif self.config.name == "sentence_level":
87
+ _keys_to_return.append("pid")
88
+ _keys_to_return.append("sid")
89
+
90
+ with open(data_file, encoding="utf-8") as f:
91
+ data = csv.DictReader(f, delimiter="\t")
92
+ for idx, row in enumerate(data):
93
+ yield idx, {_k: row[_k] for _k in _keys_to_return}