mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-28 09:08:54 +00:00
wip
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from typing import List
|
||||
from tts.text.input_parsing.parser import ArpabetSequence, GraphemeSequence, ParsedSequence
|
||||
from tts.text.phonetization.base_phonetization import BasePhonetization
|
||||
from tts.text.phonetization.cmudict import CMUDict
|
||||
|
||||
@@ -7,7 +8,7 @@ class EnglishPhonetization(BasePhonetization):
|
||||
def __init__(self, phoneme_dictionary: CMUDict):
|
||||
super().__init__(phoneme_dictionary)
|
||||
|
||||
def try_convert_to_phonemes(self, grapheme_sequence: str) -> List[str]:
|
||||
def try_convert_to_phonemes(self, grapheme_sequence: str) -> ParsedSequence:
|
||||
"""
|
||||
Attempt to enrich a grapheme sequence with phonemes where word lookup succeeds.
|
||||
Grapheme symbols will be left in place.
|
||||
@@ -21,9 +22,9 @@ class EnglishPhonetization(BasePhonetization):
|
||||
if maybe_phonemes:
|
||||
# NB: Dictionary returns a list of possible matches.
|
||||
# We'll just use the first.
|
||||
converted_words.append(maybe_phonemes[0])
|
||||
converted_words.append(ArpabetSequence(maybe_phonemes[0]))
|
||||
else:
|
||||
# TODO: Use g2p prediction to predict the phonemes.
|
||||
converted_words.append(word)
|
||||
converted_words.append(GraphemeSequence(word))
|
||||
|
||||
return converted_words
|
||||
|
||||
Reference in New Issue
Block a user