davebulaval commited on
Commit
89518a3
1 Parent(s): 5bb6080

Upload RISCBAC.py

Browse files
Files changed (1) hide show
  1. RISCBAC.py +4 -11
RISCBAC.py CHANGED
@@ -13,14 +13,11 @@
13
  # limitations under the License.
14
  """RISCBAC: a synthetic bilingual automotive insurance contract dataset"""
15
 
16
-
17
- import csv
18
  import json
19
  import os
20
 
21
  import datasets
22
 
23
-
24
  _CITATION = """\
25
  @misc{beaucheminrisc,
26
  title={{RISC: Generating Realistic Synthetic Bilingual Insurance
@@ -91,25 +88,21 @@ class RISCBAC(datasets.GeneratorBasedBuilder):
91
  return [
92
  datasets.SplitGenerator(
93
  name="full_en",
94
- gen_kwargs={
95
- "filepath": os.path.join(data_dir, "en.jsonl"),
96
- },
97
  )
98
  ]
99
  elif self.config.name == "fr":
100
  return [
101
  datasets.SplitGenerator(
102
  name="full_fr",
103
- gen_kwargs={
104
- "filepath": os.path.join(data_dir, "fr.jsonl"),
105
- },
106
  ),
107
  ]
108
  else:
109
  raise ValueError(f"The config name {self.config.name} is not supported. Please use " "'en' or 'fr'.")
110
 
111
- def _generate_examples(self, filepath):
112
- with open(filepath, "r", encoding="utf-8") as f:
113
  for key, line in enumerate(f):
114
  d = json.loads(line)
115
  yield key, {"text": d}
 
13
  # limitations under the License.
14
  """RISCBAC: a synthetic bilingual automotive insurance contract dataset"""
15
 
 
 
16
  import json
17
  import os
18
 
19
  import datasets
20
 
 
21
  _CITATION = """\
22
  @misc{beaucheminrisc,
23
  title={{RISC: Generating Realistic Synthetic Bilingual Insurance
 
88
  return [
89
  datasets.SplitGenerator(
90
  name="full_en",
91
+ gen_kwargs={"filepath": os.path.join(data_dir, "en.jsonl"), "name_key": "en"},
 
 
92
  )
93
  ]
94
  elif self.config.name == "fr":
95
  return [
96
  datasets.SplitGenerator(
97
  name="full_fr",
98
+ gen_kwargs={"filepath": os.path.join(data_dir, "fr.jsonl"), "name_key": "fr"},
 
 
99
  ),
100
  ]
101
  else:
102
  raise ValueError(f"The config name {self.config.name} is not supported. Please use " "'en' or 'fr'.")
103
 
104
+ def _generate_examples(self, filepath, name_key):
105
+ with open(filepath[name_key], "r", encoding="utf-8") as f:
106
  for key, line in enumerate(f):
107
  d = json.loads(line)
108
  yield key, {"text": d}