arka0821 commited on
Commit
ae06cda
1 Parent(s): c53ea61

Update multi_document_summarization.py

Browse files
Files changed (1) hide show
  1. multi_document_summarization.py +9 -11
multi_document_summarization.py CHANGED
@@ -35,9 +35,9 @@ _DESCRIPTION = """
35
  Multi-Document, a large-scale multi-document summarization dataset created from scientific articles. Multi-Document introduces a challenging multi-document summarization task: writing the related-work section of a paper based on its abstract and the articles it references.
36
  """
37
 
38
- _URL_TRAIN = "https://github.com/arka0821/multi_document_summarization/blob/master/data/train.txt"
39
- _URL_TEST = "https://github.com/arka0821/multi_document_summarization/blob/master/data/test.txt"
40
- _URL_VAL = "https://github.com/arka0821/multi_document_summarization/blob/master/data/val.txt"
41
 
42
 
43
  class MultiDocumentSum(datasets.GeneratorBasedBuilder):
@@ -88,15 +88,13 @@ class MultiDocumentSum(datasets.GeneratorBasedBuilder):
88
  def _generate_examples(self, path=None):
89
  """Yields examples."""
90
  with open(path, encoding="utf-8") as f:
91
- data = f.readlines()#json.load(f)
92
  f.close()
93
- print("************")
94
- print(data)
95
  for idx, el in enumerate(data):
96
- #ids = [id["id"] for id in json.loads(el["docs"])]
97
- #texts = [text["text"] for text in el["docs"]]
98
- #tmp = {"id": ids, "text": texts}
99
- d = el#.copy()
100
- #d["docs"] = tmp
101
  yield idx, d
102
 
 
35
  Multi-Document, a large-scale multi-document summarization dataset created from scientific articles. Multi-Document introduces a challenging multi-document summarization task: writing the related-work section of a paper based on its abstract and the articles it references.
36
  """
37
 
38
+ _URL_TRAIN = "https://github.com/arka0821/multi_document_summarization/blob/master/data/train.json"
39
+ _URL_TEST = "https://github.com/arka0821/multi_document_summarization/blob/master/data/test.json"
40
+ _URL_VAL = "https://github.com/arka0821/multi_document_summarization/blob/master/data/val.json"
41
 
42
 
43
  class MultiDocumentSum(datasets.GeneratorBasedBuilder):
 
88
  def _generate_examples(self, path=None):
89
  """Yields examples."""
90
  with open(path, encoding="utf-8") as f:
91
+ data = json.load(f)
92
  f.close()
 
 
93
  for idx, el in enumerate(data):
94
+ ids = [id["id"] for id in json.loads(el["docs"])]
95
+ texts = [text["text"] for text in el["docs"]]
96
+ tmp = {"id": ids, "text": texts}
97
+ d = el.copy()
98
+ d["docs"] = tmp
99
  yield idx, d
100