def closest_first_order(self, w, n=10): if self.oov(w): return [] scores = self.m[self.wi[w], :] return heapq.nlargest(n, zip(scores.data, [self.iw[i] for i in scores.indices]))