def precision(c, tweets):
    """Computes precision for class `c` on the specified test data."""

    tp = 0
    fp = 0
    for tweet in tweets:
        if c in tweet['predictions']:
            if c in tweet['tags']:
                tp+=1
            else:
                fp+=1

    if(tp+fp == 0):
        return float('nan')
    else:
        return tp/(tp+fp)