first commit

This commit is contained in:
qinzy
2024-02-19 17:49:56 +00:00
parent 736366e546
commit aeb2fa60e4
69 changed files with 139400 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
from .cleaner import french_cleaners
from .gruut_wrapper import Gruut
def remove_consecutive_t(input_str):
result = []
count = 0
for char in input_str:
if char == 't':
count += 1
else:
if count < 3:
result.extend(['t'] * count)
count = 0
result.append(char)
if count < 3:
result.extend(['t'] * count)
return ''.join(result)
def fr2ipa(text):
e = Gruut(language="fr-fr", keep_puncs=True, keep_stress=True, use_espeak_phonemes=True)
# text = french_cleaners(text)
phonemes = e.phonemize(text, separator="")
# print(phonemes)
phonemes = remove_consecutive_t(phonemes)
# print(phonemes)
return phonemes