Add some missing typing annotations in transcribe.py
This commit is contained in:
@@ -747,7 +747,7 @@ class WhisperModel:
|
|||||||
prepend_punctuations: str,
|
prepend_punctuations: str,
|
||||||
append_punctuations: str,
|
append_punctuations: str,
|
||||||
last_speech_timestamp: float,
|
last_speech_timestamp: float,
|
||||||
):
|
) -> None:
|
||||||
if len(segments) == 0:
|
if len(segments) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -953,7 +953,10 @@ def get_compression_ratio(text: str) -> float:
|
|||||||
return len(text_bytes) / len(zlib.compress(text_bytes))
|
return len(text_bytes) / len(zlib.compress(text_bytes))
|
||||||
|
|
||||||
|
|
||||||
def get_suppressed_tokens(tokenizer, suppress_tokens):
|
def get_suppressed_tokens(
|
||||||
|
tokenizer: Tokenizer,
|
||||||
|
suppress_tokens: Optional[List[int]],
|
||||||
|
) -> Optional[List[int]]:
|
||||||
if not suppress_tokens or -1 in suppress_tokens:
|
if not suppress_tokens or -1 in suppress_tokens:
|
||||||
return suppress_tokens
|
return suppress_tokens
|
||||||
|
|
||||||
@@ -974,7 +977,7 @@ def get_suppressed_tokens(tokenizer, suppress_tokens):
|
|||||||
return sorted(set(suppress_tokens))
|
return sorted(set(suppress_tokens))
|
||||||
|
|
||||||
|
|
||||||
def merge_punctuations(alignment: List[dict], prepended: str, appended: str):
|
def merge_punctuations(alignment: List[dict], prepended: str, appended: str) -> None:
|
||||||
# merge prepended punctuations
|
# merge prepended punctuations
|
||||||
i = len(alignment) - 2
|
i = len(alignment) - 2
|
||||||
j = len(alignment) - 1
|
j = len(alignment) - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user