paniniDot commited on
Commit
9c466b7
1 Parent(s): 8b182c6

Update sci_lay.py

Browse files
Files changed (1) hide show
  1. sci_lay.py +17 -24
sci_lay.py CHANGED
@@ -18,7 +18,7 @@ SCILAY comprises 43,790 instances, each representing a scientific article in the
18
  Each instance in the dataset includes the following components:
19
  - plain_text: Containing a plain language summary of the scientific article. This section is written in a simple and accessible language, and is intended to be understandable by a wide audience.
20
  - technical_text: This section contains the abstract of the scientific article. It provides a detailed and technical description of the research conducted in the article.
21
- - full_text: This section contains the complete article of the scientific research
22
  In addition to the textual content, each instance is associated with the following metadata:
23
  - Keywords: Keywords that capture the main topics and themes addressed in the article.
24
  - Journal: The journal in which the article is published, providing context about the source of the research.
@@ -41,21 +41,20 @@ _TOPICS = "topics"
41
  _KEYWORDS = "keywords"
42
 
43
  _JOURNALS = {
44
- "NC": "Nature Communications",
45
- "A": "Animals : an Open Access Journal from MDPI",
46
- "PLGEN": "PLoS Genetics",
47
- "PLPAT": "PLoS Pathogens",
48
- "PLCB": "PLoS Computational Biology",
49
- "PLNTD": "PLoS Neglected Tropical Diseases",
50
- "B": "Biology",
51
- "I": "Insects",
52
- "EL": "eLife",
53
- "PLB": "PLoS Biology",
54
- "CB": "Communications Biology",
55
- "SD": "Scientific Data",
56
- "MBIO": "mBio",
57
- "C": "Cancers",
58
- "OTHER": "Others"
59
  }
60
 
61
  # Available versions:
@@ -70,7 +69,7 @@ class SciLayConfig(datasets.BuilderConfig):
70
  """BuilderConfig for SciLay.
71
  Args:
72
  journals (str or list, default 'all'): List of journal names. Either 'all' or a combination
73
- of {'NC', 'A', 'NIHR', 'PLGEN', 'PLPAT', 'PLCB', 'PLNTD', 'B', 'I', 'EL', 'PLB', 'CB', 'SD', 'MBIO', 'C', 'OTHER'}.
74
  **kwargs: keyword arguments forwarded to super.
75
  """
76
  if isinstance(journals, str):
@@ -149,8 +148,7 @@ class SciLay(datasets.GeneratorBasedBuilder):
149
  with open(path, "rb") as fin:
150
  for row in fin:
151
  json_obj = json.loads(row)
152
- unique_key = f"{json_obj[_DOI]}_{generate_random_string()}"
153
- yield unique_key, {
154
  _DOI: json_obj[_DOI],
155
  _PMCID: json_obj[_PMCID],
156
  _SUMMARY: json_obj[_SUMMARY],
@@ -160,8 +158,3 @@ class SciLay(datasets.GeneratorBasedBuilder):
160
  _TOPICS: json_obj[_TOPICS],
161
  _KEYWORDS: json_obj[_KEYWORDS]
162
  }
163
-
164
-
165
- def generate_random_string(length=10):
166
- letters = string.ascii_lowercase + string.ascii_uppercase
167
- return ''.join(random.choice(letters) for _ in range(length))
 
18
  Each instance in the dataset includes the following components:
19
  - plain_text: Containing a plain language summary of the scientific article. This section is written in a simple and accessible language, and is intended to be understandable by a wide audience.
20
  - technical_text: This section contains the abstract of the scientific article. It provides a detailed and technical description of the research conducted in the article.
21
+ - full_text: This section contains the complete article of the scientific research.
22
  In addition to the textual content, each instance is associated with the following metadata:
23
  - Keywords: Keywords that capture the main topics and themes addressed in the article.
24
  - Journal: The journal in which the article is published, providing context about the source of the research.
 
41
  _KEYWORDS = "keywords"
42
 
43
  _JOURNALS = {
44
+ "NC": "nature communications",
45
+ "A": "animals : an open access journal from mdpi",
46
+ "PLGEN": "plos genetics",
47
+ "PLPAT": "plos pathogens",
48
+ "PLCB": "plos computational biology",
49
+ "PLNTD": "plos neglected tropical diseases",
50
+ "B": "biology",
51
+ "I": "insects",
52
+ "PLB": "plos biology",
53
+ "CB": "communications biology",
54
+ "SD": "scientific data",
55
+ "MBIO": "mbio",
56
+ "C": "cancers",
57
+ "OTHER": "others"
 
58
  }
59
 
60
  # Available versions:
 
69
  """BuilderConfig for SciLay.
70
  Args:
71
  journals (str or list, default 'all'): List of journal names. Either 'all' or a combination
72
+ of {'NC', 'A', 'PLGEN', 'PLPAT', 'PLCB', 'PLNTD', 'B', 'I', 'PLB', 'CB', 'SD', 'MBIO', 'C', 'OTHER'}.
73
  **kwargs: keyword arguments forwarded to super.
74
  """
75
  if isinstance(journals, str):
 
148
  with open(path, "rb") as fin:
149
  for row in fin:
150
  json_obj = json.loads(row)
151
+ yield json_obj[_DOI], {
 
152
  _DOI: json_obj[_DOI],
153
  _PMCID: json_obj[_PMCID],
154
  _SUMMARY: json_obj[_SUMMARY],
 
158
  _TOPICS: json_obj[_TOPICS],
159
  _KEYWORDS: json_obj[_KEYWORDS]
160
  }