Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from annoy import AnnoyIndex
a = AnnoyIndex(3)
a.add_item(10, [1, 0, 0])
a.add_item(11, [0, 1, 0])
a.add_item(13, [0, 0, 1])
a.build(-1)
print a.get_nns_by_item(13, 10)
print a.get_nns_by_item(1, 10)
# [13, 0, 1, 2, 3, 4, 5, 6, 7, 8]
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.