summaryrefslogtreecommitdiff
path: root/math/py-annoy/files/test-load.py
blob: 3eecbf6bb041c0dd8edab18c65081751f9b81bb4 (plain) (blame)
1
2
3
4
5
6
7
from annoy import AnnoyIndex

f = 40  # Length of item vector that will be indexed

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