import eng_to_ipa from aip_trainer.models import ModelInterfaces from aip_trainer import app_logger class EpitranPhonemConverter(ModelInterfaces.ITextToPhonemModel): word_locations_in_samples = None audio_transcript = None def __init__(self, epitran_model) -> None: super().__init__() self.epitran_model = epitran_model def convertToPhonem(self, sentence: str) -> str: app_logger.info(f'starting EpitranPhonemConverter.convertToPhonem...') phonem_representation = self.epitran_model.transliterate(sentence) app_logger.info(f'EpitranPhonemConverter: got phonem_representation!') return phonem_representation class EngPhonemConverter(ModelInterfaces.ITextToPhonemModel): def __init__(self,) -> None: super().__init__() def convertToPhonem(self, sentence: str) -> str: phonem_representation = eng_to_ipa.convert(sentence) phonem_representation = phonem_representation.replace('*','') return phonem_representation