Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created February 6, 2019 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/bf7bc3b1513467f2a7fcd6779331a778 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/bf7bc3b1513467f2a7fcd6779331a778 to your computer and use it in GitHub Desktop.
Encode Sequences
# encode and pad sequences
def encode_sequences(tokenizer, length, lines):
# integer encode sequences
seq = tokenizer.texts_to_sequences(lines)
# pad sequences with 0 values
seq = pad_sequences(seq, maxlen=length, padding='post')
return seq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment