speechmatics / speechmatics-python

Python library and CLI for Speechmatics
https://speechmatics.github.io/speechmatics-python/
MIT License
58 stars 14 forks source link

translation_config not used when provided in TranscriptionConfig #94

Closed bpaulwitz closed 5 months ago

bpaulwitz commented 5 months ago

Describe the bug So I tried to adapt the transcribe_from_microphone.py example to be able to translate. For this, I found out that the class TranscriptionConfig can optionally take a TranslationConfig (following the advice of checking the output of speechmatics.cli.get_transcription_config({"config_file":"","mode":"rt"}). But it will never get used as it is thrown out again when as_config() is called on TranscriptionConfig. However using TranslationConfig (or RTTranslationConfig) is not allowed as they don't provide as_config().

I would expect to be able to add either a TranslationConfig into TranscriptionConfig or to use TranslationConfig with as a configuration. I'm not sure what of those two options is supposed to work but none of them working seems like a bug to me - please correct me if I'm wrong! It doesn't seem as there is any working example of doing translation in the current version of speechmatics-python.

bpaulwitz commented 5 months ago

Pardon me, looking in the Code of cli.py, I saw that TranslationConfig needs to be passed over to add_printing_handlers before it gets stripped out from TranscriptionConfig. But maybe it would be a little bit clearer if it would not be thrown out of TranscriptionConfig and instead is used, because it is confusing if arguments are set and then just thrown away later, at least for me.