Datasets:
Languages:
English
Size:
1M<n<10M
ArXiv:
Tags:
task-oriented-dialog
task-oriented-dialogues
dialog-flow
dialog-modeling
dialogue-flow
dialogue-modeling
License:
sergioburdisso
commited on
Commit
•
df5a112
1
Parent(s):
3f1f61a
Update dialog2flow-dataset.py
Browse files- dialog2flow-dataset.py +18 -15
dialog2flow-dataset.py
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
|
8 |
#!/usr/bin/env python3
|
9 |
import os
|
|
|
10 |
import json
|
11 |
import datasets
|
12 |
from datasets import (GeneratorBasedBuilder,
|
@@ -35,7 +36,7 @@ _CITATION = """
|
|
35 |
}
|
36 |
"""
|
37 |
|
38 |
-
DATASETS_PRETRAIN = ["dialog-acts", "slots", "dialog-
|
39 |
DATASETS_DS = {
|
40 |
'ABCD': ['test', 'train', 'val'],
|
41 |
'BiTOD': ['test', 'train', 'val'],
|
@@ -56,7 +57,7 @@ DATASETS_DS = {
|
|
56 |
'Taskmaster2': ['train'],
|
57 |
'Taskmaster3': ['test', 'train', 'val'],
|
58 |
'WOZ2_0': ['test', 'train', 'val'],
|
59 |
-
|
60 |
}
|
61 |
DATASETS = list(DATASETS_DS.keys()) + DATASETS_PRETRAIN
|
62 |
SPLIT2NAME = {
|
@@ -101,7 +102,7 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
|
|
101 |
url="https://github.com/idiap/dialog2flow",
|
102 |
))
|
103 |
|
104 |
-
DEFAULT_CONFIG_NAME = "dialog-
|
105 |
|
106 |
def _info(self):
|
107 |
if self.config.name in DATASETS_PRETRAIN:
|
@@ -134,11 +135,10 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
|
|
134 |
|
135 |
def _split_generators(self, dl_manager):
|
136 |
if self.config.name in DATASETS_PRETRAIN:
|
137 |
-
# TODO
|
138 |
file_path = dl_manager.download({
|
139 |
-
"train": "
|
140 |
-
"val": "
|
141 |
-
"test": "test.csv", # SpokenWOZ
|
142 |
})
|
143 |
splits = [
|
144 |
SplitGenerator(
|
@@ -155,13 +155,13 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
|
|
155 |
"split": datasets.Split.VALIDATION,
|
156 |
},
|
157 |
),
|
158 |
-
SplitGenerator(
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
)
|
165 |
]
|
166 |
else:
|
167 |
splits = []
|
@@ -195,4 +195,7 @@ class Dialog2FlowBuilder(GeneratorBasedBuilder):
|
|
195 |
for dial_id, dial in data:
|
196 |
yield dial_id, {"dialog": dial}
|
197 |
else:
|
198 |
-
|
|
|
|
|
|
|
|
7 |
|
8 |
#!/usr/bin/env python3
|
9 |
import os
|
10 |
+
import csv
|
11 |
import json
|
12 |
import datasets
|
13 |
from datasets import (GeneratorBasedBuilder,
|
|
|
36 |
}
|
37 |
"""
|
38 |
|
39 |
+
DATASETS_PRETRAIN = ["dialog-acts", "slots", "dialog-acts+slots"]
|
40 |
DATASETS_DS = {
|
41 |
'ABCD': ['test', 'train', 'val'],
|
42 |
'BiTOD': ['test', 'train', 'val'],
|
|
|
57 |
'Taskmaster2': ['train'],
|
58 |
'Taskmaster3': ['test', 'train', 'val'],
|
59 |
'WOZ2_0': ['test', 'train', 'val'],
|
60 |
+
'SimJointGEN': ['test', 'train', 'val'],
|
61 |
}
|
62 |
DATASETS = list(DATASETS_DS.keys()) + DATASETS_PRETRAIN
|
63 |
SPLIT2NAME = {
|
|
|
102 |
url="https://github.com/idiap/dialog2flow",
|
103 |
))
|
104 |
|
105 |
+
DEFAULT_CONFIG_NAME = "dialog-acts+slots"
|
106 |
|
107 |
def _info(self):
|
108 |
if self.config.name in DATASETS_PRETRAIN:
|
|
|
135 |
|
136 |
def _split_generators(self, dl_manager):
|
137 |
if self.config.name in DATASETS_PRETRAIN:
|
|
|
138 |
file_path = dl_manager.download({
|
139 |
+
"train": f"{self.config.name}.csv", # full
|
140 |
+
"val": "val.csv", # few shot subset
|
141 |
+
# "test": "test.csv", # TODO: use SpokenWOZ
|
142 |
})
|
143 |
splits = [
|
144 |
SplitGenerator(
|
|
|
155 |
"split": datasets.Split.VALIDATION,
|
156 |
},
|
157 |
),
|
158 |
+
# SplitGenerator( # TODO: use SpokenWOZ
|
159 |
+
# name=datasets.Split.TEST,
|
160 |
+
# gen_kwargs={
|
161 |
+
# "file_path": file_path["test"],
|
162 |
+
# "split": datasets.Split.TEST,
|
163 |
+
# },
|
164 |
+
# )
|
165 |
]
|
166 |
else:
|
167 |
splits = []
|
|
|
195 |
for dial_id, dial in data:
|
196 |
yield dial_id, {"dialog": dial}
|
197 |
else:
|
198 |
+
with open(file_path, newline='') as csvfile:
|
199 |
+
csvreader = csv.reader(csvfile)
|
200 |
+
for ix, row in enumerate(csvreader):
|
201 |
+
yield ix, {"utterance": row[0], "label": row[1]}
|