Skip to content

Instantly share code, notes, and snippets.

@kabirahuja2431
Last active October 7, 2019 15:29
Show Gist options
  • Save kabirahuja2431/e39f22eb038a49cc1344d6c3167c39df to your computer and use it in GitHub Desktop.
Save kabirahuja2431/e39f22eb038a49cc1344d6c3167c39df to your computer and use it in GitHub Desktop.
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
#For single sequence input
sentence = 'I really enjoyed this movie a lot.'
tokens = tokenizer.tokenize(sentence)
print(tokens)
# Out: ['i', 'really', 'enjoyed', 'this', 'movie', 'a', 'lot', '.']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment