Last active
May 28, 2022 15:43
-
-
Save mbednarski/f45182602e33547f2619046498649dd6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| vocabulary = [] | |
| for sentence in tokenized_corpus: | |
| for token in sentence: | |
| if token not in vocabulary: | |
| vocabulary.append(token) | |
| word2idx = {w: idx for (idx, w) in enumerate(vocabulary)} | |
| idx2word = {idx: w for (idx, w) in enumerate(vocabulary)} | |
| vocabulary_size = len(vocabulary) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did: