Raise error when alphabet and bytes_mode both specified

This commit is contained in:
Josh Meyer 2021-07-21 08:44:57 -04:00
parent 0389560a92
commit 6da7b5fc26

View File

@ -104,7 +104,11 @@ class _SttConfig(Coqpit):
if not self.available_devices:
self.available_devices = [self.cpu_device]
if self.bytes_output_mode:
if self.bytes_output_mode and self.alphabet_config_path:
raise RuntimeError(
"You cannot set --alphabet_config_path *and* --bytes_output_mode"
)
elif self.bytes_output_mode:
self.alphabet = UTF8Alphabet()
elif self.alphabet_config_path:
self.alphabet = Alphabet(os.path.abspath(self.alphabet_config_path))