Sebastian Gehrmann commited on
Commit
1833849
1 Parent(s): ed7409d

reformat to follow input/target format

Browse files
Files changed (1) hide show
  1. OrangeSum.py +19 -11
OrangeSum.py CHANGED
@@ -45,9 +45,6 @@ _URL_DATA = {
45
  "title": "https://raw.githubusercontent.com/Tixierae/OrangeSum/main/data/docs/splits/title.tgz",
46
  }
47
 
48
- _DOCUMENT = "text"
49
- _SUMMARY = "summary"
50
-
51
 
52
  class OrangeSum(datasets.GeneratorBasedBuilder):
53
  """OrangeSum: a french abstractive summarization dataset"""
@@ -55,8 +52,12 @@ class OrangeSum(datasets.GeneratorBasedBuilder):
55
  VERSION = datasets.Version("1.1.0")
56
 
57
  BUILDER_CONFIGS = [
58
- datasets.BuilderConfig(name="abstract", description="Abstracts used as summaries", version=VERSION),
59
- datasets.BuilderConfig(name="title", description="Titles used as summaries", version=VERSION),
 
 
 
 
60
  ]
61
 
62
  def _info(self):
@@ -65,11 +66,12 @@ class OrangeSum(datasets.GeneratorBasedBuilder):
65
  features=datasets.Features(
66
  {
67
  "gem_id": datasets.Value("string"),
68
- _DOCUMENT: datasets.Value("string"),
69
- _SUMMARY: datasets.Value("string"),
 
70
  }
71
  ),
72
- supervised_keys=(_DOCUMENT, _SUMMARY),
73
  homepage="https://github.com/Tixierae/OrangeSum/",
74
  citation=_CITATION,
75
  )
@@ -116,8 +118,14 @@ class OrangeSum(datasets.GeneratorBasedBuilder):
116
  if source_path == expected_source_path:
117
  for target_path, f_target in target_files:
118
  if target_path == expected_target_path:
119
- for idx, (document, summary) in enumerate(zip(f_source, f_target)):
120
- yield idx, {_DOCUMENT: document.decode("utf-8"), _SUMMARY: summary.decode("utf-8"), "gem_id":f"GEM-OrangeSum_{self.config.name}-{split}-{idx}"}
121
- #yield idx, {_DOCUMENT: document.decode("utf-8"), _SUMMARY: summary.decode("utf-8")}
 
 
 
 
 
 
122
  break
123
  break
 
45
  "title": "https://raw.githubusercontent.com/Tixierae/OrangeSum/main/data/docs/splits/title.tgz",
46
  }
47
 
 
 
 
48
 
49
  class OrangeSum(datasets.GeneratorBasedBuilder):
50
  """OrangeSum: a french abstractive summarization dataset"""
 
52
  VERSION = datasets.Version("1.1.0")
53
 
54
  BUILDER_CONFIGS = [
55
+ datasets.BuilderConfig(
56
+ name="abstract", description="Abstracts used as summaries", version=VERSION
57
+ ),
58
+ datasets.BuilderConfig(
59
+ name="title", description="Titles used as summaries", version=VERSION
60
+ ),
61
  ]
62
 
63
  def _info(self):
 
66
  features=datasets.Features(
67
  {
68
  "gem_id": datasets.Value("string"),
69
+ "input": datasets.Value("string"),
70
+ "target": datasets.Value("string"),
71
+ "references": [datasets.Value("string")],
72
  }
73
  ),
74
+ supervised_keys=("input", "target"),
75
  homepage="https://github.com/Tixierae/OrangeSum/",
76
  citation=_CITATION,
77
  )
 
118
  if source_path == expected_source_path:
119
  for target_path, f_target in target_files:
120
  if target_path == expected_target_path:
121
+ for idx, (document, summary) in enumerate(
122
+ zip(f_source, f_target)
123
+ ):
124
+ yield idx, {
125
+ "input": document.decode("utf-8"),
126
+ "target": summary.decode("utf-8"),
127
+ "references": [summary.decode("utf-8")],
128
+ "gem_id": f"OrangeSum_{self.config.name}-{split}-{idx}",
129
+ }
130
  break
131
  break