def compute_tag_stats(all_tags, segdata):
    """
    Counts occurrence of all considered tags

    Parameters
    ----------

    all_tags:
        Considered tags
    segdata:
        List of segdata used

    Returns
    -------

    A dict indexed by tag name with tuples containing 0 and 1 occurrence count.

    """

    stats = {}

    for i, tag in enumerate(all_tags):
        count0 = 0
        count1 = 0

        for data in segdata:
            for t, v in data["tag"]:
                if t == tag:
                    if v > 0:
                        count1 += 1
                    else:
                        count0 += 1

        stats[tag] = (
            count0,
            count1,
        )
    return stats