Skip to content

Instantly share code, notes, and snippets.

@joshua-taylor
Created October 10, 2020 15:50
Show Gist options
  • Save joshua-taylor/a08ef935cc075b49b42889984e7848bd to your computer and use it in GitHub Desktop.
Save joshua-taylor/a08ef935cc075b49b42889984e7848bd to your computer and use it in GitHub Desktop.
input = 'flood defences'.lower().split()
query = [ft_model[vec] for vec in input]
query = np.mean(query,axis=0)
t0 = time.time()
ids, distances = index.knnQuery(query, k=10)
t1 = time.time()
print(f'Searched {df.shape[0]} records in {round(t1-t0,4) } seconds \n')
for i,j in zip(ids,distances):
print(round(j,2))
print(df.text.values[i])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment