ccdv commited on
Commit
d155896
1 Parent(s): 6c16183

add sections

Browse files
Files changed (1) hide show
  1. pubmed-summarization.py +11 -3
pubmed-summarization.py CHANGED
@@ -57,9 +57,14 @@ class PubMedSummarizationDataset(datasets.GeneratorBasedBuilder):
57
 
58
  BUILDER_CONFIGS = [
59
  PubMedSummarizationConfig(
60
- name="pubmed",
61
  version=datasets.Version("1.0.0"),
62
- description="PubMed dataset for summarization",
 
 
 
 
 
63
  ),
64
  ]
65
 
@@ -112,6 +117,9 @@ class PubMedSummarizationDataset(datasets.GeneratorBasedBuilder):
112
  'section_names': List[str],
113
  'sections': List[List[str]]
114
  """
115
- article = data["article_text"]
 
 
 
116
  abstract = data["abstract_text"]
117
  yield id_, {"article": ' '.join(article), "abstract": ' '.join(abstract)}
 
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
 
 
117
  'section_names': List[str],
118
  'sections': List[List[str]]
119
  """
120
+ if self.config.name == "section":
121
+ article = data["article_text"]
122
+ else:
123
+ article = [item.strip() for sublist in data["sections"] for item in sublist]
124
  abstract = data["abstract_text"]
125
  yield id_, {"article": ' '.join(article), "abstract": ' '.join(abstract)}