tomasg25 commited on
Commit
36369bf
1 Parent(s): 1b3decc

updated load dataset file

Browse files
Files changed (1) hide show
  1. scientific_lay_summarization.py +19 -8
scientific_lay_summarization.py CHANGED
@@ -39,6 +39,14 @@ _DESCRIPTION = """
39
  This repository contains the PLOS and eLife datasets, introduced in the EMNLP 2022 paper "[Making Science Simple: Corpora for the Lay Summarisation of Scientific Literature
40
  ](https://arxiv.org/abs/2210.09932)".
41
  Each dataset contains full biomedical research articles paired with expert-written lay summaries (i.e., non-technical summaries). PLOS articles are derived from various journals published by [the Public Library of Science (PLOS)](https://plos.org/), whereas eLife articles are derived from the [eLife](https://elifesciences.org/) journal. More details/anlaysis on the content of each dataset are provided in the paper.
 
 
 
 
 
 
 
 
42
  """
43
 
44
  _DOCUMENT = "article"
@@ -59,7 +67,7 @@ class ScientificLaySummarisationConfig(datasets.BuilderConfig):
59
  filename: filename of different configs for the dataset.
60
  **kwargs: keyword arguments forwarded to super.
61
  """
62
- super(ScientificLaySummarisationConfig, self).__init__(version=datasets.Version("1.0"), **kwargs)
63
  self.filename = filename
64
 
65
 
@@ -78,7 +86,7 @@ class ScientificLaySummarisation(datasets.GeneratorBasedBuilder):
78
  {
79
  _DOCUMENT: datasets.Value("string"),
80
  _SUMMARY: datasets.Value("string"),
81
- "section_names": datasets.Value("string"),
82
  "keywords": datasets.Value("string"),
83
  "year": datasets.Value("string"),
84
  "title": datasets.Value("string"),
@@ -117,19 +125,22 @@ class ScientificLaySummarisation(datasets.GeneratorBasedBuilder):
117
  # "id": str, # unique identifier
118
  # "year": int, # year of publication
119
  # "title": str, # title
120
- # "sections": List[List[str]], # main text, divided in to sections
121
  # "headings" List[str], # headings of each section
122
- # "abstract": List[str], # abstract
123
- # "summary": List[str], # lay summary
124
  # "keywords": List[str] # keywords/topic of article
125
 
126
  d = json.loads(line)
127
- summary = "\n".join(d["abstract_text"])
 
 
 
128
 
129
  yield d["id"], {
130
- _DOCUMENT: "\n".join([d["abstract"]] + d["sections"]),
131
  _SUMMARY: summary,
132
- "section_headings": "\n".join(d["headings"]),
133
  "keywords": "\n".join(d["keywords"]),
134
  "year": d["year"],
135
  "title": d["title"]
 
39
  This repository contains the PLOS and eLife datasets, introduced in the EMNLP 2022 paper "[Making Science Simple: Corpora for the Lay Summarisation of Scientific Literature
40
  ](https://arxiv.org/abs/2210.09932)".
41
  Each dataset contains full biomedical research articles paired with expert-written lay summaries (i.e., non-technical summaries). PLOS articles are derived from various journals published by [the Public Library of Science (PLOS)](https://plos.org/), whereas eLife articles are derived from the [eLife](https://elifesciences.org/) journal. More details/anlaysis on the content of each dataset are provided in the paper.
42
+
43
+ Both "elife" and "plos" have 6 features:
44
+ - "article": the body of the document (including the abstract), sections seperated by "/n".
45
+ - "section_headings": the title of each section, seperated by "/n".
46
+ - "keywords": keywords describing the topic of the article, seperated by "/n".
47
+ - "title" : the title of the article.
48
+ - "year" : the year the article was published.
49
+ - "summary": the lay summary of the document.
50
  """
51
 
52
  _DOCUMENT = "article"
 
67
  filename: filename of different configs for the dataset.
68
  **kwargs: keyword arguments forwarded to super.
69
  """
70
+ super(ScientificLaySummarisationConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
71
  self.filename = filename
72
 
73
 
 
86
  {
87
  _DOCUMENT: datasets.Value("string"),
88
  _SUMMARY: datasets.Value("string"),
89
+ "section_headings": datasets.Value("string"),
90
  "keywords": datasets.Value("string"),
91
  "year": datasets.Value("string"),
92
  "title": datasets.Value("string"),
 
125
  # "id": str, # unique identifier
126
  # "year": int, # year of publication
127
  # "title": str, # title
128
+ # "sections": List[List[str]], # main text, divided in to sections/sentences
129
  # "headings" List[str], # headings of each section
130
+ # "abstract": List[str], # abstract, in sentences
131
+ # "summary": List[str], # lay summary, in sentences
132
  # "keywords": List[str] # keywords/topic of article
133
 
134
  d = json.loads(line)
135
+
136
+ sections = [" ".join(s).strip() for s in d["sections"]]
137
+ abstract = " ".join(d['abstract']).strip()
138
+ summary = " ".join(d["summary"]).strip()
139
 
140
  yield d["id"], {
141
+ _DOCUMENT: "\n".join([[abstract] + sections]),
142
  _SUMMARY: summary,
143
+ "section_headings": "\n".join(["Abstract"] + d["headings"]),
144
  "keywords": "\n".join(d["keywords"]),
145
  "year": d["year"],
146
  "title": d["title"]