Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newspop dataset #1871

Merged
merged 2 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions datasets/newspop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@

frankier marked this conversation as resolved.
Show resolved Hide resolved
---
annotations_creators:
- crowdsourced
language_creators:
- found
languages:
- en
licenses:
- cc-by-4
multilinguality:
- monolingual
size_categories:
- 10K<n<100K
source_datasets:
- original
task_categories:
- text-scoring
task_ids:
- sentiment-scoring
- other
frankier marked this conversation as resolved.
Show resolved Hide resolved
---

# Dataset Card for newspop

## Table of Contents
- [Dataset Description](#dataset-description)
- [Dataset Summary](#dataset-summary)
- [Supported Tasks](#supported-tasks-and-leaderboards)
- [Languages](#languages)
- [Dataset Structure](#dataset-structure)
- [Data Instances](#data-instances)
- [Data Fields](#data-instances)
- [Data Splits](#data-instances)
- [Dataset Creation](#dataset-creation)
- [Curation Rationale](#curation-rationale)
- [Source Data](#source-data)
- [Annotations](#annotations)
- [Personal and Sensitive Information](#personal-and-sensitive-information)
- [Considerations for Using the Data](#considerations-for-using-the-data)
- [Social Impact of Dataset](#social-impact-of-dataset)
- [Discussion of Biases](#discussion-of-biases)
- [Other Known Limitations](#other-known-limitations)
- [Additional Information](#additional-information)
- [Dataset Curators](#dataset-curators)
- [Licensing Information](#licensing-information)
- [Citation Information](#citation-information)
- [Contributions](#contributions)

## Dataset Description

- **Homepage:** [UCI](https://archive.ics.uci.edu/ml/datasets/News+Popularity+in+Multiple+Social+Media+Platforms)
- **Repository:**
- **Paper:** [Arxiv](https://arxiv.org/abs/1801.07055)
- **Leaderboard:** [Kaggle](https://www.kaggle.com/nikhiljohnk/news-popularity-in-multiple-social-media-platforms/code)
- **Point of Contact:**

### Dataset Summary

Social sharing data across Facebook, Google+ and LinkedIn for 100k news items on the topics of: economy, microsoft, obama and palestine.

### Supported Tasks and Leaderboards

Popularity prediction/shares prediction

### Languages

English

## Dataset Structure

### Data Instances

```
{ "id": 35873,
"title": "Microsoft's 'teen girl' AI turns into a Hitler-loving sex robot within 24 ...",
"headline": "Developers at Microsoft created 'Tay', an AI modelled to speak 'like a teen girl', in order to improve the customer service on their voice",
"source": "Telegraph.co.uk",
"topic": "microsoft",
"publish_date": "2016-03-24 09:53:54",
"facebook": 22346,
"google_plus": 973,
"linked_in": 1009
}
```

### Data Fields

- id: the sentence id in the source dataset
- title: the title of the link as shared on social media
- headline: the headline, or sometimes the lede of the story
- source: the source news site
- topic: the topic: one of "economy", "microsoft", "obama" and "palestine"
- publish_date: the date the original article was published
- facebook: the number of Facebook shares, or -1 if this data wasn't collected
- google_plus: the number of Google+ likes, or -1 if this data wasn't collected
- linked_in: the number of LinkedIn shares, or -1 if if this data wasn't collected

### Data Splits

None

## Dataset Creation

### Curation Rationale

### Source Data

#### Initial Data Collection and Normalization

#### Who are the source language producers?

The source headlines were by journalists, while the titles were written by the
people sharing it on social media.

### Annotations

#### Annotation process

The 'annotations' are simply the number of shares, or likes in the case of
Google+ as collected from various API endpoints.

#### Who are the annotators?

Social media users.

### Personal and Sensitive Information

[More Information Needed]

## Considerations for Using the Data

### Social Impact of Dataset

[More Information Needed]

### Discussion of Biases

[More Information Needed]

### Other Known Limitations

[More Information Needed]

## Additional Information

### Dataset Curators

[More Information Needed]

### Licensing Information

License: Creative Commons Attribution 4.0 International License (CC-BY)

### Citation Information

@article{Moniz2018MultiSourceSF,
title={Multi-Source Social Feedback of Online News Feeds},
author={N. Moniz and L. Torgo},
journal={ArXiv},
year={2018},
volume={abs/1801.07055}
}
frankier marked this conversation as resolved.
Show resolved Hide resolved

### Contributions

Thanks to [@frankier](https://github.com/frankier) for adding this dataset.
1 change: 1 addition & 0 deletions datasets/newspop/dataset_infos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"default": {"description": "\nThis is a large data set of news items and their respective social feedback on multiple platforms: Facebook, Google+ and LinkedIn.\nThe collected data relates to a period of 8 months, between November 2015 and July 2016, accounting for about 100,000 news items on four different topics: economy, microsoft, obama and palestine.\nThis data set is tailored for evaluative comparisons in predictive analytics tasks, although allowing for tasks in other research areas such as topic detection and tracking, sentiment analysis in short text, first story detection or news recommendation.\n", "citation": "@article{Moniz2018MultiSourceSF,\n title={Multi-Source Social Feedback of Online News Feeds},\n author={N. Moniz and L. Torgo},\n journal={ArXiv},\n year={2018},\n volume={abs/1801.07055}\n}\n", "homepage": "https://archive.ics.uci.edu/ml/datasets/News+Popularity+in+Multiple+Social+Media+Platforms", "license": "Creative Commons Attribution 4.0 International License (CC-BY)", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "headline": {"dtype": "string", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}, "publish_date": {"dtype": "string", "id": null, "_type": "Value"}, "facebook": {"dtype": "int32", "id": null, "_type": "Value"}, "google_plus": {"dtype": "int32", "id": null, "_type": "Value"}, "linked_in": {"dtype": "int32", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "financial_phrase_bank", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 27927641, "num_examples": 93239, "dataset_name": "financial_phrase_bank"}}, "download_checksums": {"https://archive.ics.uci.edu/ml/machine-learning-databases/00432/Data/News_Final.csv": {"num_bytes": 30338277, "checksum": "8e74ffa71852a87fdf38ad8a05599ff2ad75f4e30e9244b07c58f1e0e70686c9"}}, "download_size": 30338277, "post_processing_size": null, "dataset_size": 27927641, "size_in_bytes": 58265918}}
frankier marked this conversation as resolved.
Show resolved Hide resolved
Binary file added datasets/newspop/dummy/0.0.0/dummy_data.zip
Binary file not shown.
133 changes: 133 additions & 0 deletions datasets/newspop/newspop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""News Popularity in Multiple Social Media Platforms Data Set: social sharing data across Facebook, Google+ and LinkedIn for 100k news items on the topics of: economy, microsoft, obama and palestine."""

from __future__ import absolute_import, division, print_function

import csv

import datasets


_CITATION = """\
@article{Moniz2018MultiSourceSF,
title={Multi-Source Social Feedback of Online News Feeds},
author={N. Moniz and L. Torgo},
journal={ArXiv},
year={2018},
volume={abs/1801.07055}
}
"""

_DESCRIPTION = """
This is a large data set of news items and their respective social feedback on multiple platforms: Facebook, Google+ and LinkedIn.
The collected data relates to a period of 8 months, between November 2015 and July 2016, accounting for about 100,000 news items on four different topics: economy, microsoft, obama and palestine.
This data set is tailored for evaluative comparisons in predictive analytics tasks, although allowing for tasks in other research areas such as topic detection and tracking, sentiment analysis in short text, first story detection or news recommendation.
"""

_HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/News+Popularity+in+Multiple+Social+Media+Platforms"

_LICENSE = "Creative Commons Attribution 4.0 International License (CC-BY)"

_URL = "https://archive.ics.uci.edu/ml/machine-learning-databases/00432/Data/News_Final.csv"


_VERSION = datasets.Version("1.0.0")


class FinancialPhraseBank(datasets.GeneratorBasedBuilder):
frankier marked this conversation as resolved.
Show resolved Hide resolved
__doc__

def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"id": datasets.Value("int32"),
"title": datasets.Value("string"),
"headline": datasets.Value("string"),
"source": datasets.Value("string"),
"topic": datasets.Value("string"),
"publish_date": datasets.Value("string"),
"facebook": datasets.Value("int32"),
"google_plus": datasets.Value("int32"),
"linked_in": datasets.Value("int32"),
}
),
supervised_keys=None,
version=_VERSION,
homepage=_HOMEPAGE,
license=_LICENSE,
citation=_CITATION,
)

def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
data_path = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
# These kwargs will be passed to _generate_examples
gen_kwargs={"filepath": data_path},
),
]

def _generate_examples(self, filepath):
""" Yields examples. """
with open(filepath, encoding="utf-8") as f:
csv_reader = csv.reader(
f,
quotechar='"',
delimiter=",",
quoting=csv.QUOTE_MINIMAL,
)
next(csv_reader)
for line_id, row in enumerate(csv_reader):
(
id,
title,
headline,
source,
topic,
publish_date,
_,
_,
facebook,
google_plus,
linked_in,
) = row
if "e" in id:
# 1 number is written as 1e+05
id = int(float(id))
else:
id = int(id)
facebook = int(facebook)
google_plus = int(google_plus)
linked_in = int(linked_in)
yield (
line_id,
{
"id": id,
"title": title,
"headline": headline,
"source": source,
"topic": topic,
"publish_date": publish_date,
"facebook": facebook,
"google_plus": google_plus,
"linked_in": linked_in,
},
)