Created
June 24, 2021 13:34
-
-
Save AmrutaKoshe/5b18bae063fded882beb9167011f9fc0 to your computer and use it in GitHub Desktop.
Tokenizing labels
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
# Tokenize label data | |
label_tokenizer = Tokenizer(lower=True) | |
label_tokenizer.fit_on_texts(labels) | |
label_index = label_tokenizer.word_index | |
print(dict(list(label_index.items()))) | |
# Print example label encodings from train and test datasets | |
train_label_sequences = label_tokenizer.texts_to_sequences(train_labels) | |
test_label_sequences = label_tokenizer.texts_to_sequences(test_labels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment