Skip to content

Commit f39f2a8

Browse files
committed
Remove non-speech descriptions from output
1 parent b8708e4 commit f39f2a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wyoming_whisper_api_client/handler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import httpx
44
import logging
55
import wave
6+
import re
67

78
from io import BytesIO
89

@@ -67,6 +68,9 @@ async def handle_event(self, event: Event) -> bool:
6768
#_LOGGER.debug(r.json())
6869
text = r.json()['text']
6970

71+
text = re.sub(r'\[.*?\]', '', text).strip()
72+
text = re.sub(r'\(.*?\)', '', text).strip()
73+
7074
_LOGGER.info(text)
7175

7276
await self.write_event(Transcript(text=text).event())

0 commit comments

Comments
 (0)