def compute_precision(golden_standard, mappings):
    """
    Computes the precision between the mappings and the gold standard.
    If the mappings is an empty list, the precision is 0
    :param golden_standard: The list of tuples containing the correct mappings
    :param mappings: The list of tuples generated by the algorithm
    :return: One float corresponding to precision
    """
    if len(mappings) == 0:
        return 0

    matches = [item for item in golden_standard if item in mappings]
    return len(matches) / len(mappings)