Created
July 13, 2019 13:46
-
-
Save RoaldSchuring/61c1a78fbbe0d7b41a8bb7620d8960d9 to your computer and use it in GitHub Desktop.
retrieve_idf_weighted_word_embeddings
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
obj = client.get_object(Bucket='data-science-wine-reviews', Key='word_vectors_idf.csv') | |
wine_df = pd.read_csv(obj['Body']) | |
wine_df.set_index(['word'], inplace=True) | |
word_vectors = [] | |
for p in payload: | |
word_vector_string = wine_df.at[p, 'word_vec_idf'] | |
word_vector_string = word_vector_string.replace('[', '').replace(r'\n', '').replace(']', '') | |
word_vector = np.fromstring(word_vector_string, dtype=float, sep=' ') | |
word_vectors.append(word_vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment