def computeSimilarityScores(inputs, fvecfunc, combfunc, clsfunc):
    """Computes similarity scores for all pairs in the given set of inputs.
    Exhaustively goes through all pairs of inputs, and looks up feature vectors
    using the given fvecfunc. Pairs of feature vectors are combined using the
    combfunc. These are fed into clsfunc (as a list) to get a score.
    Returns a dict mapping pairs (input1, input2) -> similarity score.
    """
    ret = []
    for i, i1 in enumerate(inputs):
        f1 = fvecfunc(i1)
        for i2 in inputs[i+1:]:
            f2 = fvecfunc(i2)
            fvec = combfunc(f1, f2)
            ret.append((i1,i2,fvec))
    allin1, allin2, allfvecs = zip(*ret)
    scores = clsfunc(allfvecs)
    ret = dict(((i1,i2), s) for (i1,i2,fvec), s in zip(ret, scores))
    return ret