Commit
•
399fe95
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/1.0.0/dummy_data.zip +3 -0
- opinosis.py +94 -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 Opinosis Opinion Dataset consists of sentences extracted from reviews for 51 topics.\nTopics and opinions are obtained from Tripadvisor, Edmunds.com and Amazon.com.\n", "citation": "\n@inproceedings{ganesan2010opinosis,\n title={Opinosis: a graph-based approach to abstractive summarization of highly redundant opinions},\n author={Ganesan, Kavita and Zhai, ChengXiang and Han, Jiawei},\n booktitle={Proceedings of the 23rd International Conference on Computational Linguistics},\n pages={340--348},\n year={2010},\n organization={Association for Computational Linguistics}\n}\n", "homepage": "http://kavita-ganesan.com/opinosis/", "license": "", "features": {"review_sents": {"dtype": "string", "id": null, "_type": "Value"}, "summaries": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": {"input": "review_sents", "output": "summaries"}, "builder_name": "opinosis", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 741270, "num_examples": 51, "dataset_name": "opinosis"}}, "download_checksums": {"https://github.com/kavgan/opinosis-summarization/raw/master/OpinosisDataset1.0_0.zip": {"num_bytes": 757398, "checksum": "ed0be6c80fe32e9071ddd7fbb7a272fea7efa39b6b3fa77aa1460c7b81026547"}}, "download_size": 757398, "dataset_size": 741270, "size_in_bytes": 1498668}}
|
dummy/1.0.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c6ad4c902043b00ae5e94b7601c6179cff358c8c1cb94677bceae466ba19db4
|
3 |
+
size 2942
|
opinosis.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""Opinosis Opinion Dataset."""
|
18 |
+
|
19 |
+
from __future__ import absolute_import, division, print_function
|
20 |
+
|
21 |
+
import os
|
22 |
+
|
23 |
+
import datasets
|
24 |
+
|
25 |
+
|
26 |
+
_CITATION = """
|
27 |
+
@inproceedings{ganesan2010opinosis,
|
28 |
+
title={Opinosis: a graph-based approach to abstractive summarization of highly redundant opinions},
|
29 |
+
author={Ganesan, Kavita and Zhai, ChengXiang and Han, Jiawei},
|
30 |
+
booktitle={Proceedings of the 23rd International Conference on Computational Linguistics},
|
31 |
+
pages={340--348},
|
32 |
+
year={2010},
|
33 |
+
organization={Association for Computational Linguistics}
|
34 |
+
}
|
35 |
+
"""
|
36 |
+
|
37 |
+
_DESCRIPTION = """
|
38 |
+
The Opinosis Opinion Dataset consists of sentences extracted from reviews for 51 topics.
|
39 |
+
Topics and opinions are obtained from Tripadvisor, Edmunds.com and Amazon.com.
|
40 |
+
"""
|
41 |
+
|
42 |
+
_URL = "https://github.com/kavgan/opinosis-summarization/raw/master/OpinosisDataset1.0_0.zip"
|
43 |
+
|
44 |
+
_REVIEW_SENTS = "review_sents"
|
45 |
+
_SUMMARIES = "summaries"
|
46 |
+
|
47 |
+
|
48 |
+
class Opinosis(datasets.GeneratorBasedBuilder):
|
49 |
+
"""Opinosis Opinion Dataset."""
|
50 |
+
|
51 |
+
VERSION = datasets.Version("1.0.0")
|
52 |
+
|
53 |
+
def _info(self):
|
54 |
+
return datasets.DatasetInfo(
|
55 |
+
description=_DESCRIPTION,
|
56 |
+
features=datasets.Features(
|
57 |
+
{
|
58 |
+
_REVIEW_SENTS: datasets.Value("string"),
|
59 |
+
_SUMMARIES: datasets.features.Sequence(datasets.Value("string")),
|
60 |
+
}
|
61 |
+
),
|
62 |
+
supervised_keys=(_REVIEW_SENTS, _SUMMARIES),
|
63 |
+
homepage="http://kavita-ganesan.com/opinosis/",
|
64 |
+
citation=_CITATION,
|
65 |
+
)
|
66 |
+
|
67 |
+
def _split_generators(self, dl_manager):
|
68 |
+
"""Returns SplitGenerators."""
|
69 |
+
extract_path = dl_manager.download_and_extract(_URL)
|
70 |
+
return [
|
71 |
+
datasets.SplitGenerator(
|
72 |
+
name=datasets.Split.TRAIN,
|
73 |
+
gen_kwargs={"path": extract_path},
|
74 |
+
),
|
75 |
+
]
|
76 |
+
|
77 |
+
def _generate_examples(self, path=None):
|
78 |
+
"""Yields examples."""
|
79 |
+
topics_path = os.path.join(path, "topics")
|
80 |
+
filenames = sorted(os.listdir(topics_path))
|
81 |
+
for filename in filenames:
|
82 |
+
file_path = os.path.join(topics_path, filename)
|
83 |
+
topic_name = filename.split(".txt")[0]
|
84 |
+
with open(file_path, "rb") as src_f:
|
85 |
+
input_data = src_f.read().decode("latin-1")
|
86 |
+
summaries_path = os.path.join(path, "summaries-gold", topic_name)
|
87 |
+
summary_lst = []
|
88 |
+
for summ_filename in sorted(os.listdir(summaries_path)):
|
89 |
+
file_path = os.path.join(summaries_path, summ_filename)
|
90 |
+
with open(file_path, "rb") as tgt_f:
|
91 |
+
data = tgt_f.read().strip().decode("latin-1")
|
92 |
+
summary_lst.append(data)
|
93 |
+
summary_data = summary_lst
|
94 |
+
yield filename, {_REVIEW_SENTS: input_data, _SUMMARIES: summary_data}
|