mirror of
https://github.com/QuentinFuxa/WhisperLiveKit.git
synced 2026-03-07 14:23:18 +00:00
8 lines
188 B
Python
8 lines
188 B
Python
import re
|
|
|
|
|
|
def extract_number(s: str) -> int:
|
|
"""Extract the first integer from a string, e.g. 'speaker_2' -> 2."""
|
|
m = re.search(r'\d+', s)
|
|
return int(m.group()) if m else 0
|