diff --git a/rust-whisper.d/hotwords.py b/rust-whisper.d/hotwords.py index bf548b6..7bdc700 100644 --- a/rust-whisper.d/hotwords.py +++ b/rust-whisper.d/hotwords.py @@ -142,9 +142,13 @@ class Parser(threading.Thread): log("stderr:", proc.stderr.decode().strip()) log("raw transcript:", result) result = result.replace(">>", "") - result = "".join([i.split("]")[-1] for i in result.split("[")[0]]) - result = "".join([i.split(")")[-1] for i in result.split("(")[0]]) - result = "".join([i.split(">")[-1] for i in result.split("<")[0]]) + for pair in [ + ("[", "]") + ("(", ")") + ("<", ">") + ("*", "*") + ]: + result = "".join([i.split(pair[1])[-1] for i in result.split(pair[0])[0]]) if os.environ.get("DEBUG", None): log("annotation-free transcript:", result) return result