title: How to use the spotify's annoy library in python?
body: <p>I want to know how the annoy library works. I got this test code from github but I'm new to coding, so it is difficult for me to understand . </p>
  
  <pre><code>from annoy import AnnoyIndex
  import random
  f = 40
  
  t = AnnoyIndex(f, 'angular')  #Length of item vector that will be indexed
  for i in range(1000):
      v = [random.gauss(0, 1) for z in range(f)]
      t.add_item(i, v)
  
  t.build(10) # 10 trees
  t.save('test.ann')
  
  u = AnnoyIndex(f, 'angular')
  u.load('test.ann') # super fast, will just mmap the file
  print(u.get_nns_by_item(0, 1000)) # will find the 1000 nearest neighbors
  </code></pre>