Maxime commited on
Commit
9e640f6
1 Parent(s): 4b3c826

flat config

Browse files
Files changed (1) hide show
  1. mfaq.py +29 -16
mfaq.py CHANGED
@@ -55,21 +55,33 @@ class MFAQ(datasets.GeneratorBasedBuilder):
55
  DEFAULT_CONFIG_NAME = "all"
56
 
57
  def _info(self):
58
- features = datasets.Features(
59
- {
60
- "id": datasets.Value("int64"),
61
- "language": datasets.Value("string"),
62
- "num_pairs": datasets.Value("int64"),
63
- "domain": datasets.Value("string"),
64
- "qa_pairs": datasets.features.Sequence(
65
- {
66
- "question": datasets.Value("string"),
67
- "answer": datasets.Value("string"),
68
- "language": datasets.Value("string")
69
- }
70
- )
71
- }
72
- )
 
 
 
 
 
 
 
 
 
 
 
 
73
  return datasets.DatasetInfo(
74
  description=_DESCRIPTION,
75
  features=features, # Here we define them above because they are different between the two configurations
@@ -109,7 +121,8 @@ class MFAQ(datasets.GeneratorBasedBuilder):
109
  "domain": data["domain"],
110
  "language": data["language"],
111
  "num_pairs": 1,
112
- "qa_pairs": [pair]
 
113
  }
114
  else:
115
  yield f"{filepath}_{_id}", {
 
55
  DEFAULT_CONFIG_NAME = "all"
56
 
57
  def _info(self):
58
+ if "_flat" in self.config.name:
59
+ features = datasets.Features(
60
+ {
61
+ "id": datasets.Value("int64"),
62
+ "language": datasets.Value("string"),
63
+ "num_pairs": datasets.Value("int64"),
64
+ "domain": datasets.Value("string"),
65
+ "question": datasets.Value("string"),
66
+ "answer": datasets.Value("string")
67
+ }
68
+ )
69
+ else:
70
+ features = datasets.Features(
71
+ {
72
+ "id": datasets.Value("int64"),
73
+ "language": datasets.Value("string"),
74
+ "num_pairs": datasets.Value("int64"),
75
+ "domain": datasets.Value("string"),
76
+ "qa_pairs": datasets.features.Sequence(
77
+ {
78
+ "question": datasets.Value("string"),
79
+ "answer": datasets.Value("string"),
80
+ "language": datasets.Value("string")
81
+ }
82
+ )
83
+ }
84
+ )
85
  return datasets.DatasetInfo(
86
  description=_DESCRIPTION,
87
  features=features, # Here we define them above because they are different between the two configurations
 
121
  "domain": data["domain"],
122
  "language": data["language"],
123
  "num_pairs": 1,
124
+ "question": pair["question"],
125
+ "answer": pair["answer"]
126
  }
127
  else:
128
  yield f"{filepath}_{_id}", {