From 7c369e72d432557227f3d1afaaeb85d0cf184774 Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 8 Apr 2023 22:22:22 -0600 Subject: [PATCH] delimiters --- rust-whisper.d/hotwords.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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