Datasets:
Commit
·
bf5ee00
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- x_stance.py +111 -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
|
dataset_infos.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"default": {"description": "The x-stance dataset contains more than 150 political questions, and 67k comments written by candidates on those questions.\n\nIt can be used to train and evaluate stance detection systems.\n\n", "citation": "@inproceedings{vamvas2020xstance,\n author = \"Vamvas, Jannis and Sennrich, Rico\",\n title = \"{X-Stance}: A Multilingual Multi-Target Dataset for Stance Detection\",\n booktitle = \"Proceedings of the 5th Swiss Text Analytics Conference (SwissText) \\& 16th Conference on Natural Language Processing (KONVENS)\",\n address = \"Zurich, Switzerland\",\n year = \"2020\",\n month = \"jun\",\n url = \"http://ceur-ws.org/Vol-2624/paper9.pdf\"\n}\n", "homepage": "https://github.com/ZurichNLP/xstance", "license": "", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "id": {"dtype": "int32", "id": null, "_type": "Value"}, "question_id": {"dtype": "int32", "id": null, "_type": "Value"}, "language": {"dtype": "string", "id": null, "_type": "Value"}, "comment": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"dtype": "string", "id": null, "_type": "Value"}, "numerical_label": {"dtype": "int32", "id": null, "_type": "Value"}, "author": {"dtype": "string", "id": null, "_type": "Value"}, "topic": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "x_stance", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 17619123, "num_examples": 45640, "dataset_name": "x_stance"}, "test": {"name": "test", "num_bytes": 6607134, "num_examples": 17705, "dataset_name": "x_stance"}, "validation": {"name": "validation", "num_bytes": 1505979, "num_examples": 3926, "dataset_name": "x_stance"}}, "download_checksums": {"https://github.com/ZurichNLP/xstance/raw/v1.0.0/data/xstance-data-v1.0.zip": {"num_bytes": 6410801, "checksum": "b8d0168f1897880ccbcb27946e0b2e45de9ac17bc048daad84949fcfe4351768"}}, "download_size": 6410801, "dataset_size": 25732236, "size_in_bytes": 32143037}}
|
dummy/0.1.0/dummy_data.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8637809d7a081908d7e394f4acdee2382cb20744370502a3be3b9aaa026243f8
|
| 3 |
+
size 2317
|
x_stance.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TODO(x_stance): Add a description here."""
|
| 2 |
+
|
| 3 |
+
from __future__ import absolute_import, division, print_function
|
| 4 |
+
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
import datasets
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# TODO(x_stance): BibTeX citation
|
| 12 |
+
_CITATION = """\
|
| 13 |
+
@inproceedings{vamvas2020xstance,
|
| 14 |
+
author = "Vamvas, Jannis and Sennrich, Rico",
|
| 15 |
+
title = "{X-Stance}: A Multilingual Multi-Target Dataset for Stance Detection",
|
| 16 |
+
booktitle = "Proceedings of the 5th Swiss Text Analytics Conference (SwissText) \\& 16th Conference on Natural Language Processing (KONVENS)",
|
| 17 |
+
address = "Zurich, Switzerland",
|
| 18 |
+
year = "2020",
|
| 19 |
+
month = "jun",
|
| 20 |
+
url = "http://ceur-ws.org/Vol-2624/paper9.pdf"
|
| 21 |
+
}
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
# TODO(x_stance):
|
| 25 |
+
_DESCRIPTION = """\
|
| 26 |
+
The x-stance dataset contains more than 150 political questions, and 67k comments written by candidates on those questions.
|
| 27 |
+
|
| 28 |
+
It can be used to train and evaluate stance detection systems.
|
| 29 |
+
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
_URL = "https://github.com/ZurichNLP/xstance/raw/v1.0.0/data/xstance-data-v1.0.zip"
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class XStance(datasets.GeneratorBasedBuilder):
|
| 36 |
+
"""TODO(x_stance): Short description of my dataset."""
|
| 37 |
+
|
| 38 |
+
# TODO(x_stance): Set up version.
|
| 39 |
+
VERSION = datasets.Version("0.1.0")
|
| 40 |
+
|
| 41 |
+
def _info(self):
|
| 42 |
+
# TODO(x_stance): Specifies the datasets.DatasetInfo object
|
| 43 |
+
return datasets.DatasetInfo(
|
| 44 |
+
# This is the description that will appear on the datasets page.
|
| 45 |
+
description=_DESCRIPTION,
|
| 46 |
+
# datasets.features.FeatureConnectors
|
| 47 |
+
features=datasets.Features(
|
| 48 |
+
{
|
| 49 |
+
"question": datasets.Value("string"),
|
| 50 |
+
"id": datasets.Value("int32"),
|
| 51 |
+
"question_id": datasets.Value("int32"),
|
| 52 |
+
"language": datasets.Value("string"),
|
| 53 |
+
"comment": datasets.Value("string"),
|
| 54 |
+
"label": datasets.Value("string"),
|
| 55 |
+
"numerical_label": datasets.Value("int32"),
|
| 56 |
+
"author": datasets.Value("string"),
|
| 57 |
+
"topic": datasets.Value("string")
|
| 58 |
+
# These are the features of your dataset like images, labels ...
|
| 59 |
+
}
|
| 60 |
+
),
|
| 61 |
+
# If there's a common (input, target) tuple from the features,
|
| 62 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 63 |
+
# builder.as_dataset.
|
| 64 |
+
supervised_keys=None,
|
| 65 |
+
# Homepage of the dataset for documentation
|
| 66 |
+
homepage="https://github.com/ZurichNLP/xstance",
|
| 67 |
+
citation=_CITATION,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
def _split_generators(self, dl_manager):
|
| 71 |
+
"""Returns SplitGenerators."""
|
| 72 |
+
# TODO(x_stance): Downloads the data and defines the splits
|
| 73 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
| 74 |
+
# download and extract URLs
|
| 75 |
+
dl_dir = dl_manager.download_and_extract(_URL)
|
| 76 |
+
return [
|
| 77 |
+
datasets.SplitGenerator(
|
| 78 |
+
name=datasets.Split.TRAIN,
|
| 79 |
+
# These kwargs will be passed to _generate_examples
|
| 80 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, "train.jsonl")},
|
| 81 |
+
),
|
| 82 |
+
datasets.SplitGenerator(
|
| 83 |
+
name=datasets.Split.TEST,
|
| 84 |
+
# These kwargs will be passed to _generate_examples
|
| 85 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, "test.jsonl")},
|
| 86 |
+
),
|
| 87 |
+
datasets.SplitGenerator(
|
| 88 |
+
name=datasets.Split.VALIDATION,
|
| 89 |
+
# These kwargs will be passed to _generate_examples
|
| 90 |
+
gen_kwargs={"filepath": os.path.join(dl_dir, "valid.jsonl")},
|
| 91 |
+
),
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
def _generate_examples(self, filepath):
|
| 95 |
+
"""Yields examples."""
|
| 96 |
+
# TODO(x_stance): Yields (key, example) tuples from the dataset
|
| 97 |
+
with open(filepath, encoding="utf-8") as f:
|
| 98 |
+
for id_, row in enumerate(f):
|
| 99 |
+
data = json.loads(row)
|
| 100 |
+
|
| 101 |
+
yield id_, {
|
| 102 |
+
"id": data["id"],
|
| 103 |
+
"question_id": data["question_id"],
|
| 104 |
+
"question": data["question"],
|
| 105 |
+
"comment": data["comment"],
|
| 106 |
+
"label": data["label"],
|
| 107 |
+
"author": data["author"],
|
| 108 |
+
"numerical_label": data["numerical_label"],
|
| 109 |
+
"topic": data["topic"],
|
| 110 |
+
"language": data["language"],
|
| 111 |
+
}
|