Commit
·
8f72d51
1
Parent(s):
26155cc
Update parquet files
Browse files- README.md +0 -66
- val.zip → document/pubmed-summarization-test.parquet +2 -2
- train.zip → document/pubmed-summarization-train-00000-of-00005.parquet +2 -2
- document/pubmed-summarization-train-00001-of-00005.parquet +3 -0
- document/pubmed-summarization-train-00002-of-00005.parquet +3 -0
- document/pubmed-summarization-train-00003-of-00005.parquet +3 -0
- document/pubmed-summarization-train-00004-of-00005.parquet +3 -0
- vocab.zip → document/pubmed-summarization-validation.parquet +2 -2
- pubmed-summarization.py +0 -129
- test.zip → section/pubmed-summarization-test.parquet +2 -2
- section/pubmed-summarization-train-00000-of-00005.parquet +3 -0
- section/pubmed-summarization-train-00001-of-00005.parquet +3 -0
- section/pubmed-summarization-train-00002-of-00005.parquet +3 -0
- section/pubmed-summarization-train-00003-of-00005.parquet +3 -0
- section/pubmed-summarization-train-00004-of-00005.parquet +3 -0
- section/pubmed-summarization-validation.parquet +3 -0
README.md
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
---
|
2 |
-
language:
|
3 |
-
- en
|
4 |
-
multilinguality:
|
5 |
-
- monolingual
|
6 |
-
size_categories:
|
7 |
-
- 100K<n<1M
|
8 |
-
task_categories:
|
9 |
-
- summarization
|
10 |
-
- text-generation
|
11 |
-
task_ids: []
|
12 |
-
tags:
|
13 |
-
- conditional-text-generation
|
14 |
-
---
|
15 |
-
|
16 |
-
# PubMed dataset for summarization
|
17 |
-
|
18 |
-
Dataset for summarization of long documents.\
|
19 |
-
Adapted from this [repo](https://github.com/armancohan/long-summarization).\
|
20 |
-
Note that original data are pre-tokenized so this dataset returns " ".join(text) and add "\n" for paragraphs. \
|
21 |
-
This dataset is compatible with the [`run_summarization.py`](https://github.com/huggingface/transformers/tree/master/examples/pytorch/summarization) script from Transformers if you add this line to the `summarization_name_mapping` variable:
|
22 |
-
```python
|
23 |
-
"ccdv/pubmed-summarization": ("article", "abstract")
|
24 |
-
```
|
25 |
-
|
26 |
-
### Data Fields
|
27 |
-
|
28 |
-
- `id`: paper id
|
29 |
-
- `article`: a string containing the body of the paper
|
30 |
-
- `abstract`: a string containing the abstract of the paper
|
31 |
-
|
32 |
-
### Data Splits
|
33 |
-
|
34 |
-
This dataset has 3 splits: _train_, _validation_, and _test_. \
|
35 |
-
Token counts are white space based.
|
36 |
-
|
37 |
-
| Dataset Split | Number of Instances | Avg. tokens |
|
38 |
-
| ------------- | --------------------|:----------------------|
|
39 |
-
| Train | 119,924 | 3043 / 215 |
|
40 |
-
| Validation | 6,633 | 3111 / 216 |
|
41 |
-
| Test | 6,658 | 3092 / 219 |
|
42 |
-
|
43 |
-
|
44 |
-
# Cite original article
|
45 |
-
```
|
46 |
-
@inproceedings{cohan-etal-2018-discourse,
|
47 |
-
title = "A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents",
|
48 |
-
author = "Cohan, Arman and
|
49 |
-
Dernoncourt, Franck and
|
50 |
-
Kim, Doo Soon and
|
51 |
-
Bui, Trung and
|
52 |
-
Kim, Seokhwan and
|
53 |
-
Chang, Walter and
|
54 |
-
Goharian, Nazli",
|
55 |
-
booktitle = "Proceedings of the 2018 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)",
|
56 |
-
month = jun,
|
57 |
-
year = "2018",
|
58 |
-
address = "New Orleans, Louisiana",
|
59 |
-
publisher = "Association for Computational Linguistics",
|
60 |
-
url = "https://aclanthology.org/N18-2097",
|
61 |
-
doi = "10.18653/v1/N18-2097",
|
62 |
-
pages = "615--621",
|
63 |
-
abstract = "Neural abstractive summarization models have led to promising results in summarizing relatively short documents. We propose the first model for abstractive summarization of single, longer-form documents (e.g., research papers). Our approach consists of a new hierarchical encoder that models the discourse structure of a document, and an attentive discourse-aware decoder to generate the summary. Empirical results on two large-scale datasets of scientific papers show that our model significantly outperforms state-of-the-art models.",
|
64 |
-
}
|
65 |
-
```
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val.zip → document/pubmed-summarization-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:73567d23374b73d5261ae2643ce54688c881346ddf2dd42576975bf0b604a9fe
|
3 |
+
size 58465009
|
train.zip → document/pubmed-summarization-train-00000-of-00005.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:230d71187eb48c9bd8257fcef975b7c84fd8724ba329aa954d800cd5ad46d7a4
|
3 |
+
size 234167930
|
document/pubmed-summarization-train-00001-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:834d94a770e63510b5eeea918ed617abc06cb4bdb1e3f186672b7bc840c7f149
|
3 |
+
size 233145675
|
document/pubmed-summarization-train-00002-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9797cf01a76eccfa1f0cab248593414f71ab3b6e8075cc8fa667d4e23e898c0a
|
3 |
+
size 232427705
|
document/pubmed-summarization-train-00003-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:038d896a6c9caf4628682ae7a36e0e903ef91d657f05467627ea357fd3c42b33
|
3 |
+
size 233419272
|
document/pubmed-summarization-train-00004-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c8cba2ead8b69ffdfca83ebafb77f138d6aeac632c7d79551e603e3682caa131
|
3 |
+
size 104693540
|
vocab.zip → document/pubmed-summarization-validation.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:57f972ada9d5562cb0d39cbc6c71931b85afa8f45e7d5880c2e4dabf49272d67
|
3 |
+
size 58569925
|
pubmed-summarization.py
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import os
|
3 |
-
|
4 |
-
import datasets
|
5 |
-
from datasets.tasks import TextClassification
|
6 |
-
|
7 |
-
_CITATION = None
|
8 |
-
|
9 |
-
|
10 |
-
_DESCRIPTION = """
|
11 |
-
PubMed dataset for summarization.
|
12 |
-
From paper: A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents" by A. Cohan et al.
|
13 |
-
See: https://aclanthology.org/N18-2097.pdf
|
14 |
-
See: https://github.com/armancohan/long-summarization
|
15 |
-
"""
|
16 |
-
_CITATION = """\
|
17 |
-
@inproceedings{cohan-etal-2018-discourse,
|
18 |
-
title = "A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents",
|
19 |
-
author = "Cohan, Arman and
|
20 |
-
Dernoncourt, Franck and
|
21 |
-
Kim, Doo Soon and
|
22 |
-
Bui, Trung and
|
23 |
-
Kim, Seokhwan and
|
24 |
-
Chang, Walter and
|
25 |
-
Goharian, Nazli",
|
26 |
-
booktitle = "Proceedings of the 2018 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)",
|
27 |
-
month = jun,
|
28 |
-
year = "2018",
|
29 |
-
address = "New Orleans, Louisiana",
|
30 |
-
publisher = "Association for Computational Linguistics",
|
31 |
-
url = "https://aclanthology.org/N18-2097",
|
32 |
-
doi = "10.18653/v1/N18-2097",
|
33 |
-
pages = "615--621",
|
34 |
-
abstract = "Neural abstractive summarization models have led to promising results in summarizing relatively short documents. We propose the first model for abstractive summarization of single, longer-form documents (e.g., research papers). Our approach consists of a new hierarchical encoder that models the discourse structure of a document, and an attentive discourse-aware decoder to generate the summary. Empirical results on two large-scale datasets of scientific papers show that our model significantly outperforms state-of-the-art models.",
|
35 |
-
}
|
36 |
-
"""
|
37 |
-
_ABSTRACT = "abstract"
|
38 |
-
_ARTICLE = "article"
|
39 |
-
|
40 |
-
class PubMedSummarizationConfig(datasets.BuilderConfig):
|
41 |
-
"""BuilderConfig for PubMedSummarization."""
|
42 |
-
|
43 |
-
def __init__(self, **kwargs):
|
44 |
-
"""BuilderConfig for PubMedSummarization.
|
45 |
-
Args:
|
46 |
-
**kwargs: keyword arguments forwarded to super.
|
47 |
-
"""
|
48 |
-
super(PubMedSummarizationConfig, self).__init__(**kwargs)
|
49 |
-
|
50 |
-
|
51 |
-
class PubMedSummarizationDataset(datasets.GeneratorBasedBuilder):
|
52 |
-
"""PubMedSummarization Dataset."""
|
53 |
-
|
54 |
-
_TRAIN_FILE = "train.zip"
|
55 |
-
_VAL_FILE = "val.zip"
|
56 |
-
_TEST_FILE = "test.zip"
|
57 |
-
|
58 |
-
BUILDER_CONFIGS = [
|
59 |
-
PubMedSummarizationConfig(
|
60 |
-
name="section",
|
61 |
-
version=datasets.Version("1.0.0"),
|
62 |
-
description="PubMed dataset for summarization, concat sections",
|
63 |
-
),
|
64 |
-
PubMedSummarizationConfig(
|
65 |
-
name="document",
|
66 |
-
version=datasets.Version("1.0.0"),
|
67 |
-
description="PubMed dataset for summarization, document",
|
68 |
-
),
|
69 |
-
]
|
70 |
-
|
71 |
-
DEFAULT_CONFIG_NAME = "section"
|
72 |
-
|
73 |
-
def _info(self):
|
74 |
-
# Should return a datasets.DatasetInfo object
|
75 |
-
return datasets.DatasetInfo(
|
76 |
-
description=_DESCRIPTION,
|
77 |
-
features=datasets.Features(
|
78 |
-
{
|
79 |
-
_ARTICLE: datasets.Value("string"),
|
80 |
-
_ABSTRACT: datasets.Value("string"),
|
81 |
-
#"id": datasets.Value("string"),
|
82 |
-
}
|
83 |
-
),
|
84 |
-
supervised_keys=None,
|
85 |
-
homepage="https://github.com/armancohan/long-summarization",
|
86 |
-
citation=_CITATION,
|
87 |
-
)
|
88 |
-
|
89 |
-
def _split_generators(self, dl_manager):
|
90 |
-
|
91 |
-
train_path = os.path.join(dl_manager.download_and_extract(self._TRAIN_FILE), "train.txt")
|
92 |
-
val_path = os.path.join(dl_manager.download_and_extract(self._VAL_FILE), "val.txt")
|
93 |
-
test_path = os.path.join(dl_manager.download_and_extract(self._TEST_FILE), "test.txt")
|
94 |
-
|
95 |
-
return [
|
96 |
-
datasets.SplitGenerator(
|
97 |
-
name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
|
98 |
-
),
|
99 |
-
datasets.SplitGenerator(
|
100 |
-
name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
|
101 |
-
),
|
102 |
-
datasets.SplitGenerator(
|
103 |
-
name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
|
104 |
-
),
|
105 |
-
]
|
106 |
-
|
107 |
-
def _generate_examples(self, filepath):
|
108 |
-
"""Generate PubMedSummarization examples."""
|
109 |
-
with open(filepath, encoding="utf-8") as f:
|
110 |
-
for id_, row in enumerate(f):
|
111 |
-
data = json.loads(row)
|
112 |
-
|
113 |
-
"""
|
114 |
-
'article_id': str,
|
115 |
-
'abstract_text': List[str],
|
116 |
-
'article_text': List[str],
|
117 |
-
'section_names': List[str],
|
118 |
-
'sections': List[List[str]]
|
119 |
-
"""
|
120 |
-
if self.config.name == "document":
|
121 |
-
article = [d.strip() for d in data["article_text"]]
|
122 |
-
article = " ".join(article)
|
123 |
-
else:
|
124 |
-
article = [item.strip() for sublist in data["sections"] for item in sublist]
|
125 |
-
article = " \n ".join(article)
|
126 |
-
|
127 |
-
abstract = [ab.replace("<S>", "").replace("</S>", "").strip() for ab in data["abstract_text"]]
|
128 |
-
abstract = " \n ".join(abstract)
|
129 |
-
yield id_, {"article": article, "abstract": abstract}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.zip → section/pubmed-summarization-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b874f6c23285e92811a1a15a592976682210852d650bef97b8878cf32f10a812
|
3 |
+
size 58908341
|
section/pubmed-summarization-train-00000-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:288cfe67d81840efc9d57889f97000d0c47717754fd0ebf4461dd261e18441cc
|
3 |
+
size 235768701
|
section/pubmed-summarization-train-00001-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd90e95a931012ff783ae200cd269a9ed06ad07e2fb1c37f59d93c01cbec93f3
|
3 |
+
size 234683886
|
section/pubmed-summarization-train-00002-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:af18cdc4fdbe057f6f39406f9043e128fbc3e31f5f7930dd49c1ebb8dd8ccc31
|
3 |
+
size 234069291
|
section/pubmed-summarization-train-00003-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:adb243d32f563fd0f88d12abd788d60924534d78ecfbf7877259f55ee4ee2c9a
|
3 |
+
size 235284233
|
section/pubmed-summarization-train-00004-of-00005.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8241bfec2fd7d5a8bc755ebf87b2f23ea4a24f341154880ed567c1c7b006997
|
3 |
+
size 105420588
|
section/pubmed-summarization-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:19267b3fe8847f5c83bc67ff0666d5102b2808c1e29b8f6e848e7e63efcaae85
|
3 |
+
size 58998584
|