from annoy import AnnoyIndex

length = 20*4
t = AnnoyIndex(length,metric="angular")
t.load('stock.ann')

stock_lines = []
with open("/data/quantization/stock.log") as f:
    for x in range(100):
        stock_lines.append(eval(f.readline()))


i = 0
for stock in stock_lines:
    v = []
    for x in range(len(stock) - 1):
        v.extend(stock[x]) 

    index,distance = t.get_nns_by_item(i,5,include_distances=True)
    print(index, distance)    

    i = i + 1

