ccdv commited on
Commit
5c0de0b
1 Parent(s): dd5cad8

remove <S> </S>

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. arxiv-summarization.py +9 -4
README.md CHANGED
@@ -15,7 +15,7 @@ task_ids:
15
 
16
  Dataset for summarization of long documents.\
17
  Adapted from this [repo](https://github.com/armancohan/long-summarization).\
18
- Note that original data are pre-tokenized so this dataset returns " ".join(text).\
19
  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:
20
  ```python
21
  "ccdv/arxiv-summarization": ("article", "abstract")
 
15
 
16
  Dataset for summarization of long documents.\
17
  Adapted from this [repo](https://github.com/armancohan/long-summarization).\
18
+ Note that original data are pre-tokenized so this dataset returns " ".join(text) and add "\n" for paragraphs. \
19
  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:
20
  ```python
21
  "ccdv/arxiv-summarization": ("article", "abstract")
arxiv-summarization.py CHANGED
@@ -68,7 +68,7 @@ class ArxivSummarizationDataset(datasets.GeneratorBasedBuilder):
68
  ),
69
  ]
70
 
71
- DEFAULT_CONFIG_NAME = "document"
72
 
73
  def _info(self):
74
  # Should return a datasets.DatasetInfo object
@@ -117,9 +117,14 @@ class ArxivSummarizationDataset(datasets.GeneratorBasedBuilder):
117
  'section_names': List[str],
118
  'sections': List[List[str]]
119
  """
 
120
  if self.config.name == "document":
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)}
 
 
 
 
68
  ),
69
  ]
70
 
71
+ DEFAULT_CONFIG_NAME = "section"
72
 
73
  def _info(self):
74
  # Should return a datasets.DatasetInfo object
 
117
  'section_names': List[str],
118
  'sections': List[List[str]]
119
  """
120
+
121
  if self.config.name == "document":
122
+ article = [d.strip() for d in data["article_text"]]
123
+ article = " ".join(article)
124
  else:
125
  article = [item.strip() for sublist in data["sections"] for item in sublist]
126
+ article = " \n ".join(article)
127
+
128
+ abstract = [ab.replace("<S>", "").replace("</S>", "").strip() for ab in data["abstract_text"]]
129
+ abstract = " \n ".join(abstract)
130
+ yield id_, {"article": article, "abstract": abstract}