def _preprocess_transcript(phrase, use_phonemes, word_phoneme_dict):
    """
        transform the input phrase. if use_phonemes is true, the words in phrase
        are transformed into phoneme labels specified in word_phoneme_dict
        Arguments:
            phrase (list): list of words
            use_phonemes (bool): if True, transform phrase into phonemes
            word_phoneme_dict (dict): dictionary mapping words to phonemes
    """
    phrase = phrase.strip()
    if use_phonemes:
        if type(phrase) == str:
            phrase = phrase.split() #converting string of space-separated words to list of words
        elif type(phrase) == list: 
            pass
        else: 
            raise(TypeError("input text is not string or list type"))
        phonemes = []
        for word in phrase:
            phonemes.extend(word_phoneme_dict[word])
        phrase = phonemes
    
    return phrase