From d2ef93e844b09344e7a6e328568babfaa4e1894f Mon Sep 17 00:00:00 2001 From: Owen Song Date: Wed, 17 Jun 2026 23:54:43 +0000 Subject: [PATCH] Remove obsolete package file tiny_tts/text/english_utils/time_norm.py --- tiny_tts/text/english_utils/time_norm.py | 47 ------------------------ 1 file changed, 47 deletions(-) delete mode 100644 tiny_tts/text/english_utils/time_norm.py diff --git a/tiny_tts/text/english_utils/time_norm.py b/tiny_tts/text/english_utils/time_norm.py deleted file mode 100644 index bbbdbdc..0000000 --- a/tiny_tts/text/english_utils/time_norm.py +++ /dev/null @@ -1,47 +0,0 @@ -import re - -import inflect - -_inflect = inflect.engine() - -_time_re = re.compile( - r"""\b - ((0?[0-9])|(1[0-1])|(1[2-9])|(2[0-3])) # hours - : - ([0-5][0-9]) # minutes - \s*(a\\.m\\.|am|pm|p\\.m\\.|a\\.m|p\\.m)? # am/pm - \b""", - re.IGNORECASE | re.X, -) - - -def _expand_num(n: int) -> str: - return _inflect.number_to_words(n) - - -def _expand_time_english(match: "re.Match") -> str: - hour = int(match.group(1)) - past_noon = hour >= 12 - time = [] - if hour > 12: - hour -= 12 - elif hour == 0: - hour = 12 - past_noon = True - time.append(_expand_num(hour)) - - minute = int(match.group(6)) - if minute > 0: - if minute < 10: - time.append("oh") - time.append(_expand_num(minute)) - am_pm = match.group(7) - if am_pm is None: - time.append("p m" if past_noon else "a m") - else: - time.extend(list(am_pm.replace(".", ""))) - return " ".join(time) - - -def expand_time_english(text: str) -> str: - return re.sub(_time_re, _expand_time_english, text)