Datasets:
Tasks:
Summarization
Modalities:
Text
Formats:
parquet
Sub-tasks:
news-articles-summarization
Languages:
Polish
Size:
1K - 10K
License:
Commit
•
0180a3d
1
Parent(s):
7ab16fd
Delete loading script
Browse files
psc.py
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
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 |
-
"""Polish Summaries Corpus"""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import os
|
20 |
-
|
21 |
-
import datasets
|
22 |
-
|
23 |
-
|
24 |
-
_CITATION = """\
|
25 |
-
@inproceedings{ogro:kop:14:lrec,
|
26 |
-
title={The {P}olish {S}ummaries {C}orpus},
|
27 |
-
author={Ogrodniczuk, Maciej and Kope{\'c}, Mateusz},
|
28 |
-
booktitle = "Proceedings of the Ninth International {C}onference on {L}anguage {R}esources and {E}valuation, {LREC}~2014",
|
29 |
-
year = "2014",
|
30 |
-
}
|
31 |
-
"""
|
32 |
-
|
33 |
-
_DESCRIPTION = """\
|
34 |
-
The Polish Summaries Corpus contains news articles and their summaries. We used summaries of the same article as positive pairs and sampled the most similar summaries of different articles as negatives.
|
35 |
-
"""
|
36 |
-
|
37 |
-
_HOMEPAGE = "http://zil.ipipan.waw.pl/PolishSummariesCorpus"
|
38 |
-
|
39 |
-
_LICENSE = "CC BY-SA 3.0"
|
40 |
-
|
41 |
-
_URLs = "https://klejbenchmark.com/static/data/klej_psc.zip"
|
42 |
-
|
43 |
-
|
44 |
-
class PSC(datasets.GeneratorBasedBuilder):
|
45 |
-
"""Polish Summaries Corpus"""
|
46 |
-
|
47 |
-
VERSION = datasets.Version("1.1.0")
|
48 |
-
|
49 |
-
def _info(self):
|
50 |
-
return datasets.DatasetInfo(
|
51 |
-
description=_DESCRIPTION,
|
52 |
-
features=datasets.Features(
|
53 |
-
{
|
54 |
-
"extract_text": datasets.Value("string"),
|
55 |
-
"summary_text": datasets.Value("string"),
|
56 |
-
"label": datasets.ClassLabel(names=["0", "1"]),
|
57 |
-
}
|
58 |
-
),
|
59 |
-
supervised_keys=None,
|
60 |
-
homepage=_HOMEPAGE,
|
61 |
-
license=_LICENSE,
|
62 |
-
citation=_CITATION,
|
63 |
-
)
|
64 |
-
|
65 |
-
def _split_generators(self, dl_manager):
|
66 |
-
"""Returns SplitGenerators."""
|
67 |
-
data_dir = dl_manager.download_and_extract(_URLs)
|
68 |
-
return [
|
69 |
-
datasets.SplitGenerator(
|
70 |
-
name=datasets.Split.TRAIN,
|
71 |
-
gen_kwargs={
|
72 |
-
"filepath": os.path.join(data_dir, "train.tsv"),
|
73 |
-
"split": "train",
|
74 |
-
},
|
75 |
-
),
|
76 |
-
datasets.SplitGenerator(
|
77 |
-
name=datasets.Split.TEST,
|
78 |
-
gen_kwargs={"filepath": os.path.join(data_dir, "test_features.tsv"), "split": "test"},
|
79 |
-
),
|
80 |
-
]
|
81 |
-
|
82 |
-
def _generate_examples(self, filepath, split):
|
83 |
-
"""Yields examples."""
|
84 |
-
with open(filepath, encoding="utf-8") as f:
|
85 |
-
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
86 |
-
for id_, row in enumerate(reader):
|
87 |
-
yield id_, {
|
88 |
-
"extract_text": row["extract_text"],
|
89 |
-
"summary_text": row["summary_text"],
|
90 |
-
"label": -1 if split == "test" else row["label"],
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|