'Returns a filtered list of documents, without impairing classification accuracy.
Iteratively constructs a set of "prototype" documents.
Documents that are correctly classified by the set are discarded.
Documents that are incorrectly classified by the set are added to the set.'

def condensed_nearest_neighbor(self, k=1, distance=COSINE):

    d = DistanceMap(method=distance)
    u = []
    v = list(self.documents)
    b = False
    while (not b):
        b = True
        for (i, x) in enumerate(v):
            nn = heapq.nsmallest(k, ((d(x.vector, y.vector), y) for y in u))
            if ((not u) or (x.type in (y.type for (d, y) in nn))):
                b = False
                u.append(x)
                v.pop(i)
                break
    return v
