def eval_phoneme_duration(phoneme_list, phoneme_dur_parser):
    """
    obtain duration for each phoneme in the phoneme_list
    :param phoneme_list: a list of phoneme strings
    :param phoneme_dur_parser: a map from phoneme to its duration
    :return:
        a list of (phoneme, duration) pairs
    example:
        input: ['k', 'a2', 'er2', 'p', 'u3', 'p', 'ei2', 'uai4']
        output:[('k', 18), ('a2', 32), ('er2', 40), ('p', 19), ('u3', 29), ('p', 19), ('ei2', 25), ('uai4', 38)]
    """
    phoneme_duration_list = []
    for ph in phoneme_list:
        assert ph in phoneme_dur_parser['duration'], '%s not found.' % ph
        ph_dur = (ph, int(phoneme_dur_parser['duration'][ph][1]))
        phoneme_duration_list.append(ph_dur)
    return phoneme_duration_list