Datasets:
Tasks:
Text Classification
Sub-tasks:
sentiment-classification
Languages:
English
Size:
1K<n<10K
License:
Commit
•
1cf0fb8
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
- movie_rationales.py +110 -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": "\nThe movie rationale dataset contains human annotated rationales for movie\nreviews.\n", "citation": "\n@unpublished{eraser2019,\n title = {ERASER: A Benchmark to Evaluate Rationalized NLP Models},\n author = {Jay DeYoung and Sarthak Jain and Nazneen Fatema Rajani and Eric Lehman and Caiming Xiong and Richard Socher and Byron C. Wallace}\n}\n@InProceedings{zaidan-eisner-piatko-2008:nips,\n author = {Omar F. Zaidan and Jason Eisner and Christine Piatko},\n title = {Machine Learning with Annotator Rationales to Reduce Annotation Cost},\n booktitle = {Proceedings of the NIPS*2008 Workshop on Cost Sensitive Learning},\n month = {December},\n year = {2008}\n}\n", "homepage": "http://www.cs.jhu.edu/~ozaidan/rationales/", "license": "", "features": {"review": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 2, "names": ["NEG", "POS"], "names_file": null, "id": null, "_type": "ClassLabel"}, "evidences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "movie_rationales", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1046377, "num_examples": 199, "dataset_name": "movie_rationales"}, "train": {"name": "train", "num_bytes": 6853624, "num_examples": 1600, "dataset_name": "movie_rationales"}, "validation": {"name": "validation", "num_bytes": 830417, "num_examples": 200, "dataset_name": "movie_rationales"}}, "download_checksums": {"http://www.eraserbenchmark.com/zipped/movies.tar.gz": {"num_bytes": 3899487, "checksum": "66e18d4e6c9df9e9f5544572b0bfe92a39673f74ecbfc3859b46cedb2f5b2dee"}}, "download_size": 3899487, "dataset_size": 8730418, "size_in_bytes": 12629905}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fd146b11e415369fbca2c0d51fdb5e0b459516b7c2712bf717d39859a2547c3
|
3 |
+
size 2390
|
movie_rationales.py
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
|
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 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""Movie reviews with human annotated rationales."""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import json
|
22 |
+
import os
|
23 |
+
|
24 |
+
import datasets
|
25 |
+
|
26 |
+
|
27 |
+
_CITATION = """
|
28 |
+
@unpublished{eraser2019,
|
29 |
+
title = {ERASER: A Benchmark to Evaluate Rationalized NLP Models},
|
30 |
+
author = {Jay DeYoung and Sarthak Jain and Nazneen Fatema Rajani and Eric Lehman and Caiming Xiong and Richard Socher and Byron C. Wallace}
|
31 |
+
}
|
32 |
+
@InProceedings{zaidan-eisner-piatko-2008:nips,
|
33 |
+
author = {Omar F. Zaidan and Jason Eisner and Christine Piatko},
|
34 |
+
title = {Machine Learning with Annotator Rationales to Reduce Annotation Cost},
|
35 |
+
booktitle = {Proceedings of the NIPS*2008 Workshop on Cost Sensitive Learning},
|
36 |
+
month = {December},
|
37 |
+
year = {2008}
|
38 |
+
}
|
39 |
+
"""
|
40 |
+
|
41 |
+
_DESCRIPTION = """
|
42 |
+
The movie rationale dataset contains human annotated rationales for movie
|
43 |
+
reviews.
|
44 |
+
"""
|
45 |
+
|
46 |
+
_DOWNLOAD_URL = "http://www.eraserbenchmark.com/zipped/movies.tar.gz"
|
47 |
+
|
48 |
+
|
49 |
+
class MovieRationales(datasets.GeneratorBasedBuilder):
|
50 |
+
"""Movie reviews with human annotated rationales."""
|
51 |
+
|
52 |
+
VERSION = datasets.Version("0.1.0")
|
53 |
+
|
54 |
+
def _info(self):
|
55 |
+
return datasets.DatasetInfo(
|
56 |
+
description=_DESCRIPTION,
|
57 |
+
features=datasets.Features(
|
58 |
+
{
|
59 |
+
"review": datasets.Value("string"),
|
60 |
+
"label": datasets.features.ClassLabel(names=["NEG", "POS"]),
|
61 |
+
"evidences": datasets.features.Sequence(datasets.Value("string")),
|
62 |
+
}
|
63 |
+
),
|
64 |
+
supervised_keys=None,
|
65 |
+
homepage="http://www.cs.jhu.edu/~ozaidan/rationales/",
|
66 |
+
citation=_CITATION,
|
67 |
+
)
|
68 |
+
|
69 |
+
def _split_generators(self, dl_manager):
|
70 |
+
"""Returns SplitGenerators."""
|
71 |
+
dl_dir = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
72 |
+
data_dir = os.path.join(dl_dir, "movies")
|
73 |
+
|
74 |
+
return [
|
75 |
+
datasets.SplitGenerator(
|
76 |
+
name=datasets.Split.TRAIN,
|
77 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "train.jsonl")},
|
78 |
+
),
|
79 |
+
datasets.SplitGenerator(
|
80 |
+
name=datasets.Split.VALIDATION,
|
81 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "val.jsonl")},
|
82 |
+
),
|
83 |
+
datasets.SplitGenerator(
|
84 |
+
name=datasets.Split.TEST,
|
85 |
+
gen_kwargs={"data_dir": data_dir, "filepath": os.path.join(data_dir, "test.jsonl")},
|
86 |
+
),
|
87 |
+
]
|
88 |
+
|
89 |
+
def _generate_examples(self, data_dir, filepath):
|
90 |
+
"""Yields examples."""
|
91 |
+
reviews_dir = os.path.join(data_dir, "docs")
|
92 |
+
|
93 |
+
with open(filepath, encoding="utf-8") as f:
|
94 |
+
for line in f:
|
95 |
+
row = json.loads(line)
|
96 |
+
doc_id = row["annotation_id"]
|
97 |
+
review_file = os.path.join(reviews_dir, doc_id)
|
98 |
+
with open(review_file, encoding="utf-8") as f1:
|
99 |
+
review_text = f1.read()
|
100 |
+
|
101 |
+
evidences = []
|
102 |
+
for evidence in row["evidences"]:
|
103 |
+
for e in evidence:
|
104 |
+
evidences.append(e["text"])
|
105 |
+
|
106 |
+
yield doc_id, {
|
107 |
+
"review": review_text,
|
108 |
+
"label": row["classification"],
|
109 |
+
"evidences": evidences,
|
110 |
+
}
|