mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-11-17 18:43:37 +08:00
Merge 854fc555d68f149e54c5bc53baaea5a3abe94b5a into 6d51ffceafbf240145619af4c92408a6e54b7924
This commit is contained in:
commit
e77aef2525
@ -86,7 +86,10 @@ def _expand_time(m):
|
||||
"""
|
||||
hours, minutes = map(int, m.group(1, 2))
|
||||
period = "a.m." if hours < 12 else "p.m."
|
||||
if hours > 12:
|
||||
# 00:00 is midnight. On a 12-hour clock that hour is twelve, not zero.
|
||||
if hours == 0:
|
||||
hours = 12
|
||||
elif hours > 12:
|
||||
hours -= 12
|
||||
|
||||
hour_word = _inflect.number_to_words(hours)
|
||||
|
||||
22
GPT_SoVITS/text/en_normalization/test_expend.py
Normal file
22
GPT_SoVITS/text/en_normalization/test_expend.py
Normal file
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from expend import normalize
|
||||
|
||||
|
||||
class TimeTests(unittest.TestCase):
|
||||
def test_midnight_is_twelve_am(self):
|
||||
self.assertEqual(normalize("0:00"), "twelve o'clock a.m.")
|
||||
self.assertEqual(normalize("00:30"), "twelve thirty a.m.")
|
||||
|
||||
def test_noon_and_afternoon_stay(self):
|
||||
self.assertEqual(normalize("12:00"), "twelve o'clock p.m.")
|
||||
self.assertEqual(normalize("4:00"), "four o'clock a.m.")
|
||||
self.assertEqual(normalize("13:00"), "one o'clock p.m.")
|
||||
self.assertEqual(normalize("13:30"), "one thirty p.m.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
x
Reference in New Issue
Block a user