Skip to content

Commit

Permalink
Fixes in transforms.py (#94)
Browse files Browse the repository at this point in the history
Change docstring which uses '\w' to add `r` before string to make it a "raw string" and thus prevent it from raising Python errors.
Fix typing of `BaseRemoveTransform`
  • Loading branch information
benglewis authored Nov 1, 2024
1 parent 8788099 commit 9deb71c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jiwer/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import string
import unicodedata

from typing import Union, List, Mapping
from typing import Iterable, Union, List, Mapping


__all__ = [
Expand Down Expand Up @@ -133,7 +133,7 @@ def __call__(self, text):


class BaseRemoveTransform(AbstractTransform):
def __init__(self, tokens_to_remove: List[str], replace_token=""):
def __init__(self, tokens_to_remove: Iterable[str], replace_token=""):
self.tokens_to_remove = tokens_to_remove
self.replace_token = replace_token

Expand Down Expand Up @@ -267,7 +267,7 @@ def process_list(self, inp: List[str]):


class SubstituteRegexes(AbstractTransform):
"""
r"""
Transform strings by substituting substrings matching regex expressions into
another substring.
Expand Down

0 comments on commit 9deb71c

Please sign in to comment.