xrange(1000): v = [random.gauss(0, 1) for z in xrange(f)] t.add_item(i, v) t.build(10) t.save('test.ann') # ... u = AnnoyIndex(f) u.load('test.ann') print(u.get_nns_by_item(0, 1000))
worker := func(n Node) { for index := range buildChan { g.build(index, g.meta.roots()[index], n) wg.Done() } } for i := 0; i < 3; i++ { go worker(n) } for index, _ := range g.meta.roots() { buildChan <- index } wg.Wait() close(buildChan)