Created
March 13, 2018 18:01
-
-
Save dipanjanS/865248edadb721f754bad10e874a9866 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
from keras.preprocessing.sequence import skipgrams | |
# generate skip-grams | |
skip_grams = [skipgrams(wid, vocabulary_size=vocab_size, window_size=10) for wid in wids] | |
# view sample skip-grams | |
pairs, labels = skip_grams[0][0], skip_grams[0][1] | |
for i in range(10): | |
print("({:s} ({:d}), {:s} ({:d})) -> {:d}".format( | |
id2word[pairs[i][0]], pairs[i][0], | |
id2word[pairs[i][1]], pairs[i][1], | |
labels[i])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment