polinaeterna
commited on
Commit
·
00846d9
1
Parent(s):
a44f1ba
update
Browse files
evi.py
CHANGED
|
@@ -12,6 +12,12 @@
|
|
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
import csv
|
| 17 |
import json
|
|
@@ -23,8 +29,6 @@ import datasets
|
|
| 23 |
logger = datasets.logging.get_logger(__name__)
|
| 24 |
|
| 25 |
|
| 26 |
-
""" EVI Dataset"""
|
| 27 |
-
|
| 28 |
_CITATION = """\
|
| 29 |
@inproceedings{Spithourakis2022evi,
|
| 30 |
author = {Georgios P. Spithourakis and Ivan Vuli\'{c} and Micha\l{} Lis and I\~{n}igo Casanueva and Pawe\l{} Budzianowski},
|
|
@@ -42,9 +46,15 @@ _ALL_CONFIGS = sorted([
|
|
| 42 |
|
| 43 |
_LANGS = sorted(["en", "fr", "pl"])
|
| 44 |
|
| 45 |
-
_DESCRIPTION = "
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
|
| 49 |
_BASE_URL = "https://huggingface.co/datasets/PolyAI/evi/resolve/main/data"
|
| 50 |
|
|
@@ -54,9 +64,7 @@ _TEXT_URL = {
|
|
| 54 |
|
| 55 |
_AUDIO_DATA_URL = "https://poly-public-data.s3.eu-west-2.amazonaws.com/evi-paper/audios.zip" # noqa
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
_VERSION = datasets.Version("0.0.10", "")
|
| 60 |
|
| 61 |
|
| 62 |
class EviConfig(datasets.BuilderConfig):
|
|
@@ -69,19 +77,10 @@ class EviConfig(datasets.BuilderConfig):
|
|
| 69 |
self.languages = _LANGS if name == "all" else [name.split("-")[0]] # all langs if config == "all"
|
| 70 |
|
| 71 |
|
| 72 |
-
def _build_config(name):
|
| 73 |
-
return EviConfig(
|
| 74 |
-
name=name,
|
| 75 |
-
version=_VERSION,
|
| 76 |
-
description=_DESCRIPTION,
|
| 77 |
-
# homepage=_HOMEPAGE_URL,
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
|
| 81 |
class Evi(datasets.GeneratorBasedBuilder):
|
| 82 |
|
| 83 |
-
DEFAULT_WRITER_BATCH_SIZE =
|
| 84 |
-
BUILDER_CONFIGS = [
|
| 85 |
|
| 86 |
def _info(self):
|
| 87 |
features = datasets.Features(
|
|
@@ -99,18 +98,16 @@ class Evi(datasets.GeneratorBasedBuilder):
|
|
| 99 |
)
|
| 100 |
|
| 101 |
return datasets.DatasetInfo(
|
| 102 |
-
version=
|
| 103 |
-
description=
|
| 104 |
-
license=
|
| 105 |
citation=_CITATION,
|
| 106 |
features=features,
|
|
|
|
| 107 |
)
|
| 108 |
|
| 109 |
def _split_generators(self, dl_manager):
|
| 110 |
-
|
| 111 |
langs = self.config.languages
|
| 112 |
-
# "./audios/{lang}/{dialogue_id}/3.wav"
|
| 113 |
-
|
| 114 |
lang2text_urls = {
|
| 115 |
lang: _TEXT_URL[lang] for lang in langs
|
| 116 |
}
|
|
@@ -121,10 +118,8 @@ class Evi(datasets.GeneratorBasedBuilder):
|
|
| 121 |
datasets.SplitGenerator(
|
| 122 |
name=datasets.Split.TEST,
|
| 123 |
gen_kwargs={
|
| 124 |
-
# "audio_data": dl_manager.iter_files(audio_data_path),
|
| 125 |
"audio_data_path": audio_data_path,
|
| 126 |
"text_paths": lang2text_paths,
|
| 127 |
-
# "streaming": dl_manager.is_streaming
|
| 128 |
},
|
| 129 |
)
|
| 130 |
]
|
|
@@ -137,9 +132,7 @@ class Evi(datasets.GeneratorBasedBuilder):
|
|
| 137 |
reader = csv.DictReader(
|
| 138 |
fin, delimiter="\t", skipinitialspace=True
|
| 139 |
)
|
| 140 |
-
for
|
| 141 |
-
if i == 199:
|
| 142 |
-
break
|
| 143 |
dialogue_id = dictrow["dialogue_id"]
|
| 144 |
turn_id = dictrow["turn_num"]
|
| 145 |
file_path = os.path.join(
|
|
@@ -148,7 +141,7 @@ class Evi(datasets.GeneratorBasedBuilder):
|
|
| 148 |
dialogue_id,
|
| 149 |
f'{turn_id}.wav'
|
| 150 |
)
|
| 151 |
-
full_path =
|
| 152 |
|
| 153 |
yield file_path, {
|
| 154 |
"language": lang,
|
|
|
|
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
+
"""
|
| 16 |
+
EVI is a challenging spoken multilingual dataset with 5,506 dialogues in English, Polish, and French
|
| 17 |
+
that can be used for benchmarking and developing knowledge-based enrolment, identification, and identification
|
| 18 |
+
for spoken dialogue systems.
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
|
| 22 |
import csv
|
| 23 |
import json
|
|
|
|
| 29 |
logger = datasets.logging.get_logger(__name__)
|
| 30 |
|
| 31 |
|
|
|
|
|
|
|
| 32 |
_CITATION = """\
|
| 33 |
@inproceedings{Spithourakis2022evi,
|
| 34 |
author = {Georgios P. Spithourakis and Ivan Vuli\'{c} and Micha\l{} Lis and I\~{n}igo Casanueva and Pawe\l{} Budzianowski},
|
|
|
|
| 46 |
|
| 47 |
_LANGS = sorted(["en", "fr", "pl"])
|
| 48 |
|
| 49 |
+
_DESCRIPTION = """
|
| 50 |
+
EVI is a challenging spoken multilingual dataset with 5,506 dialogues in English, Polish, and French
|
| 51 |
+
that can be used for benchmarking and developing knowledge-based enrolment, identification, and identification
|
| 52 |
+
for spoken dialogue systems.
|
| 53 |
+
""" # noqa
|
| 54 |
|
| 55 |
+
_LICENSE = "CC-BY-4.0"
|
| 56 |
+
|
| 57 |
+
_HOMEPAGE = "https://github.com/PolyAI-LDN/evi-paper"
|
| 58 |
|
| 59 |
_BASE_URL = "https://huggingface.co/datasets/PolyAI/evi/resolve/main/data"
|
| 60 |
|
|
|
|
| 64 |
|
| 65 |
_AUDIO_DATA_URL = "https://poly-public-data.s3.eu-west-2.amazonaws.com/evi-paper/audios.zip" # noqa
|
| 66 |
|
| 67 |
+
_VERSION = datasets.Version("0.0.1", "")
|
|
|
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
class EviConfig(datasets.BuilderConfig):
|
|
|
|
| 77 |
self.languages = _LANGS if name == "all" else [name.split("-")[0]] # all langs if config == "all"
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
class Evi(datasets.GeneratorBasedBuilder):
|
| 81 |
|
| 82 |
+
DEFAULT_WRITER_BATCH_SIZE = 512
|
| 83 |
+
BUILDER_CONFIGS = [EviConfig(name) for name in _ALL_CONFIGS + ["all"]]
|
| 84 |
|
| 85 |
def _info(self):
|
| 86 |
features = datasets.Features(
|
|
|
|
| 98 |
)
|
| 99 |
|
| 100 |
return datasets.DatasetInfo(
|
| 101 |
+
version=_VERSION,
|
| 102 |
+
description=_DESCRIPTION,
|
| 103 |
+
license=_LICENSE,
|
| 104 |
citation=_CITATION,
|
| 105 |
features=features,
|
| 106 |
+
homepage=_HOMEPAGE
|
| 107 |
)
|
| 108 |
|
| 109 |
def _split_generators(self, dl_manager):
|
|
|
|
| 110 |
langs = self.config.languages
|
|
|
|
|
|
|
| 111 |
lang2text_urls = {
|
| 112 |
lang: _TEXT_URL[lang] for lang in langs
|
| 113 |
}
|
|
|
|
| 118 |
datasets.SplitGenerator(
|
| 119 |
name=datasets.Split.TEST,
|
| 120 |
gen_kwargs={
|
|
|
|
| 121 |
"audio_data_path": audio_data_path,
|
| 122 |
"text_paths": lang2text_paths,
|
|
|
|
| 123 |
},
|
| 124 |
)
|
| 125 |
]
|
|
|
|
| 132 |
reader = csv.DictReader(
|
| 133 |
fin, delimiter="\t", skipinitialspace=True
|
| 134 |
)
|
| 135 |
+
for dictrow in reader:
|
|
|
|
|
|
|
| 136 |
dialogue_id = dictrow["dialogue_id"]
|
| 137 |
turn_id = dictrow["turn_num"]
|
| 138 |
file_path = os.path.join(
|
|
|
|
| 141 |
dialogue_id,
|
| 142 |
f'{turn_id}.wav'
|
| 143 |
)
|
| 144 |
+
full_path = os.path.join(audio_data_path, file_path)
|
| 145 |
|
| 146 |
yield file_path, {
|
| 147 |
"language": lang,
|