from typing import Counter


def to_hist(phoneme_list):
    """
    Takes a list of all phonemes in a corpus and constructs a histogram from it.

    :param phoneme_list: a list of all phonemes
    :return: labels, hist, ticks
        where labels is an ordered sequence of the phoneme labels (x-axis)
        where hist is an ordered sequence of frequency counts (y-axis)
        where ticks is simply [0, 1, 2, ..., len(labels)]
    """
    labels, hist = list(zip(*Counter(phoneme_list).most_common()))
    return labels, hist, list(range(len(hist)))