def find_n_threshold(word, representations, threshold, increment=500):
    """
    Find number of neighbours with cosine similarity >= threshold.
    Assumes that representations.closest is sorted (largest to smallest).
    :param word:
    :param representations:
    :param threshold:
    :param increment:
    :return:
    """
    n=increment
    neighbours =  [neigh[0] for neigh in representations.closest(word, n)]
    #Get more neighbours while we don't hit the threshold
    while neighbours[-1] >= threshold:
        n+=increment
        neighbours =  [neigh[0] for neigh in representations.closest(word, n)]
    #Reduce list to include only until threshold
    limit = len(neighbours) - 1
    while neighbours[limit] < threshold:
        limit -= 1
    return limit + 1