I have a list of sentences. I want to add padding to them; but when I use keras pad_sequence like this:
from keras.preprocessing.sequence import pad_sequences
s = [["this", "is", "a", "book"], ["this", "is", "not"]]
g = pad_sequences(s, dtype='str', maxlen=10, value='_PAD_')
the result is:
array([['_', '_', '_', '_', '_', '_', 't', 'i', 'a', 'b'],
['_', '_', '_', '_', '_', '_', '_', 't', 'i', 'n']], dtype='<U1')
Why it is not working properly?
I want to use this result as the input to the ELMO embedding and I need string sentences not integer encoding.