Sebastian Gehrmann
commited on
Commit
·
0ea2525
1
Parent(s):
dbccc03
xlsum
Browse files
xlsum.py
CHANGED
|
@@ -30,11 +30,11 @@ _CITATION = """\
|
|
| 30 |
|
| 31 |
|
| 32 |
_DESCRIPTION = """\
|
| 33 |
-
We present XLSum, a comprehensive and diverse dataset comprising 1.35 million professionally
|
| 34 |
annotated article-summary pairs from BBC, extracted using a set of carefully designed heuristics.
|
| 35 |
The dataset covers 45 languages ranging from low to high-resource, for many of which no
|
| 36 |
-
public dataset is currently available. XL-Sum is highly abstractive, concise,
|
| 37 |
-
and of high quality, as indicated by human and intrinsic evaluation.
|
| 38 |
"""
|
| 39 |
|
| 40 |
_HOMEPAGE = "https://github.com/csebuetnlp/xl-sum"
|
|
@@ -94,7 +94,7 @@ _LANGUAGES = [
|
|
| 94 |
|
| 95 |
class Xlsum(datasets.GeneratorBasedBuilder):
|
| 96 |
VERSION = datasets.Version("2.0.0")
|
| 97 |
-
|
| 98 |
BUILDER_CONFIGS = [
|
| 99 |
datasets.BuilderConfig(
|
| 100 |
name="{}".format(lang),
|
|
@@ -111,7 +111,8 @@ class Xlsum(datasets.GeneratorBasedBuilder):
|
|
| 111 |
"gem_id": datasets.Value("string"),
|
| 112 |
"url": datasets.Value("string"),
|
| 113 |
"title": datasets.Value("string"),
|
| 114 |
-
"
|
|
|
|
| 115 |
"text": datasets.Value("string"),
|
| 116 |
}
|
| 117 |
),
|
|
@@ -154,14 +155,15 @@ class Xlsum(datasets.GeneratorBasedBuilder):
|
|
| 154 |
|
| 155 |
def _generate_examples(self, filepath, split):
|
| 156 |
"""Yields examples as (key, example) tuples."""
|
| 157 |
-
|
| 158 |
with open(filepath, encoding="utf-8") as f:
|
| 159 |
for idx_, row in enumerate(f, 1):
|
| 160 |
data = json.loads(row)
|
| 161 |
yield idx_, {
|
| 162 |
-
"gem_id": f"
|
| 163 |
"url": data["url"],
|
| 164 |
"title": data["title"],
|
| 165 |
-
"
|
|
|
|
| 166 |
"text": data["text"],
|
| 167 |
}
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
_DESCRIPTION = """\
|
| 33 |
+
We present XLSum, a comprehensive and diverse dataset comprising 1.35 million professionally
|
| 34 |
annotated article-summary pairs from BBC, extracted using a set of carefully designed heuristics.
|
| 35 |
The dataset covers 45 languages ranging from low to high-resource, for many of which no
|
| 36 |
+
public dataset is currently available. XL-Sum is highly abstractive, concise,
|
| 37 |
+
and of high quality, as indicated by human and intrinsic evaluation.
|
| 38 |
"""
|
| 39 |
|
| 40 |
_HOMEPAGE = "https://github.com/csebuetnlp/xl-sum"
|
|
|
|
| 94 |
|
| 95 |
class Xlsum(datasets.GeneratorBasedBuilder):
|
| 96 |
VERSION = datasets.Version("2.0.0")
|
| 97 |
+
|
| 98 |
BUILDER_CONFIGS = [
|
| 99 |
datasets.BuilderConfig(
|
| 100 |
name="{}".format(lang),
|
|
|
|
| 111 |
"gem_id": datasets.Value("string"),
|
| 112 |
"url": datasets.Value("string"),
|
| 113 |
"title": datasets.Value("string"),
|
| 114 |
+
"target": datasets.Value("string"),
|
| 115 |
+
"references": [datasets.Value("string")],
|
| 116 |
"text": datasets.Value("string"),
|
| 117 |
}
|
| 118 |
),
|
|
|
|
| 155 |
|
| 156 |
def _generate_examples(self, filepath, split):
|
| 157 |
"""Yields examples as (key, example) tuples."""
|
| 158 |
+
|
| 159 |
with open(filepath, encoding="utf-8") as f:
|
| 160 |
for idx_, row in enumerate(f, 1):
|
| 161 |
data = json.loads(row)
|
| 162 |
yield idx_, {
|
| 163 |
+
"gem_id": f"xlsum_{self.config.name}-{split}-{idx_}",
|
| 164 |
"url": data["url"],
|
| 165 |
"title": data["title"],
|
| 166 |
+
"target": data["summary"],
|
| 167 |
+
"references": [data["summary"]],
|
| 168 |
"text": data["text"],
|
| 169 |
}
|