
<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
write a function encode_output() to one-hot encode English output sequences.

<ASSISTANT_TASK:>
Python Code::
# one hot encode target sequence
def encode_output(sequences, vocab_size):
 ylist = list()
 for sequence in sequences:
 encoded = to_categorical(sequence, num_classes=vocab_size)
 ylist.append(encoded)
 y = array(ylist)
 y = y.reshape(sequences.shape[0], sequences.shape[1], vocab_size)
 return y

<END_TASK>
