Skip to content

Instantly share code, notes, and snippets.

@billpku
Created July 30, 2019 14:59
Show Gist options
  • Select an option

  • Save billpku/a1bdc2d7e27f37fd8dc1fd0e9dd54d69 to your computer and use it in GitHub Desktop.

Select an option

Save billpku/a1bdc2d7e27f37fd8dc1fd0e9dd54d69 to your computer and use it in GitHub Desktop.
NER with BERT in Action
from keras.preprocessing.sequence import pad_sequences
# Make text token into id
input_ids = pad_sequences([tokenizer.convert_tokens_to_ids(txt) for txt in tokenized_texts],
maxlen=max_len, dtype="long", truncating="post", padding="post")
print(input_ids[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment