zqwerty
commited on
Commit
·
87b9d07
1
Parent(s):
4479f2a
add challenge set CM+T
Browse files- CrossWOZ.py +9 -3
CrossWOZ.py
CHANGED
|
@@ -162,6 +162,12 @@ class CrossWOZ(datasets.GeneratorBasedBuilder):
|
|
| 162 |
# If there's a common (input, target) tuple from the features,
|
| 163 |
# specify them here. They'll be used if as_supervised=True in
|
| 164 |
# builder.as_dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
supervised_keys=None,
|
| 166 |
# Homepage of the dataset for documentation
|
| 167 |
homepage=_HOMEPAGE,
|
|
@@ -203,11 +209,11 @@ class CrossWOZ(datasets.GeneratorBasedBuilder):
|
|
| 203 |
},
|
| 204 |
),
|
| 205 |
datasets.SplitGenerator(
|
| 206 |
-
name="challenge",
|
| 207 |
# These kwargs will be passed to _generate_examples
|
| 208 |
gen_kwargs={
|
| 209 |
"filepath": os.path.join(data_dir, "test.json"),
|
| 210 |
-
"split": "
|
| 211 |
},
|
| 212 |
),
|
| 213 |
]
|
|
@@ -267,7 +273,7 @@ class CrossWOZ(datasets.GeneratorBasedBuilder):
|
|
| 267 |
with open(filepath, encoding="utf-8") as f:
|
| 268 |
data = json.load(f)
|
| 269 |
for dialog_id, dialog in data.items():
|
| 270 |
-
if split == "
|
| 271 |
continue
|
| 272 |
messages = []
|
| 273 |
for turn in dialog["messages"]:
|
|
|
|
| 162 |
# If there's a common (input, target) tuple from the features,
|
| 163 |
# specify them here. They'll be used if as_supervised=True in
|
| 164 |
# builder.as_dataset.
|
| 165 |
+
splits={
|
| 166 |
+
datasets.Split.TRAIN: "train",
|
| 167 |
+
datasets.Split.VALIDATION: "val",
|
| 168 |
+
datasets.Split.TEST: "test",
|
| 169 |
+
"challenge.CM+T": "CM+T dialogs in the test set"
|
| 170 |
+
},
|
| 171 |
supervised_keys=None,
|
| 172 |
# Homepage of the dataset for documentation
|
| 173 |
homepage=_HOMEPAGE,
|
|
|
|
| 209 |
},
|
| 210 |
),
|
| 211 |
datasets.SplitGenerator(
|
| 212 |
+
name="challenge.CM+T",
|
| 213 |
# These kwargs will be passed to _generate_examples
|
| 214 |
gen_kwargs={
|
| 215 |
"filepath": os.path.join(data_dir, "test.json"),
|
| 216 |
+
"split": "challenge.CM+T",
|
| 217 |
},
|
| 218 |
),
|
| 219 |
]
|
|
|
|
| 273 |
with open(filepath, encoding="utf-8") as f:
|
| 274 |
data = json.load(f)
|
| 275 |
for dialog_id, dialog in data.items():
|
| 276 |
+
if split == "challenge.CM+T" and dialog["type"] != "不独立多领域+交通":
|
| 277 |
continue
|
| 278 |
messages = []
|
| 279 |
for turn in dialog["messages"]:
|