Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-classification
Languages:
Slovenian
Size:
100K - 1M
License:
Matej Klemen commited on
Commit ·
9db7fcc
1
Parent(s): aa8054c
First version of SentiNews dataset
Browse filesFiles changed (2)
- dataset_infos.jsonAdded+1
- sentinews.pyAdded+93
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}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293"""SentiNews: Manually sentiment annotated Slovenian news corpus."""
import csv
import datasets
_CITATION = """\@article{buvcar2018annotated, title={Annotated news corpora and a lexicon for sentiment analysis in Slovene}, author={Bu{\v{c}}ar, Jo{\v{z}}e and {\v{Z}}nidar{\v{s}}i{\v{c}}, Martin and Povh, Janez}, journal={Language Resources and Evaluation}, volume={52}, number={3}, pages={895--919}, year={2018}, publisher={Springer}}"""
_DESCRIPTION = """\SentiNews is a Slovenian sentiment classification dataset, consisting of news articles manually annotated with their sentiment by between 2 and 6 annotators. The news articles contain political, business, economic and financial content from the Slovenian news portals 24ur, Dnevnik, Finance, Rtvslo, and Žurnal24. The texts were annotated using the five-level Lickert scale (1 – very negative, 2 – negative, 3 – neutral, 4 – positive, and 5 – very positive) on three levels of granularity, i.e. on the document, paragraph, and sentence level. The final sentiment is determined using the following criterion: negative (if average of scores ≤ 2.4); neutral (if average of scores is between 2.4 and 3.6); positive (average of annotated scores ≥ 3.6)."""
_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)"
_URLS = { "document_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_document-level.txt", "paragraph_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_paragraph-level.txt", "sentence_level": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1110/SentiNews_sentence-level.txt"}
class Sentinews(datasets.GeneratorBasedBuilder): """SentiNews: Manually sentiment annotated Slovenian news corpus. Version 1.0."""
VERSION = datasets.Version("1.0.0")
BUILDER_CONFIGS = [ datasets.BuilderConfig(name="document_level", version=VERSION, description="Dataset annotated at document level."), datasets.BuilderConfig(name="paragraph_level", version=VERSION, description="Dataset annotated at paragraph level."), datasets.BuilderConfig(name="sentence_level", version=VERSION, description="Dataset annotated at sentence level."), ]
def _info(self): _config_features = { "nid": datasets.Value("uint16"), "content": datasets.Value("string"), "sentiment": datasets.Value("string") }
if self.config.name == "paragraph_level": _config_features["pid"] = datasets.Value("uint8") elif self.config.name == "sentence_level": _config_features["pid"] = datasets.Value("uint8") _config_features["sid"] = datasets.Value("uint8")
features = datasets.Features(_config_features) return datasets.DatasetInfo( description=_DESCRIPTION, features=features, supervised_keys=("content", "sentiment"), homepage=_HOMEPAGE, license=_LICENSE, citation=_CITATION, )
def _split_generators(self, dl_manager): urls = _URLS[self.config.name] data_file = dl_manager.download_and_extract(urls) return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"data_file": data_file})]
def _generate_examples(self, data_file): _keys_to_return = ["nid", "content", "sentiment"]
if self.config.name == "paragraph_level": _keys_to_return.append("pid") elif self.config.name == "sentence_level": _keys_to_return.append("pid") _keys_to_return.append("sid")
with open(data_file, encoding="utf-8") as f: data = csv.DictReader(f, delimiter="\t") for idx, row in enumerate(data): yield idx, {_k: row[_k] for _k in _keys_to_return}dataset_infos.jsonAdded+1
sentinews.pyAdded+93