Created
October 10, 2020 15:50
-
-
Save joshua-taylor/a08ef935cc075b49b42889984e7848bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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