'Returns the nearest neighbors to the query (a word or vector).'

def neighbors(self, query):

    if isinstance(query, basestring):
        idx = self.word_to_idx.get(query)
        if (idx is None):
            return None
        query = self.vecs[idx]
    neighbors = (self.vecs * query.transpose())
    return sorted(zip(self.vocab, neighbors.flat), key=(lambda kv: kv[1]), reverse=True)
