Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cut_sent(post, embedding):
- elmo_embedding.embed(sent)
- matrix = []
- for token in sent:
- matrix.append(np.array(token.embedding))
- sent_emb = np.matrix(matrix)
- if len(post.split()) < med:
- pads = np.zeros((med - len(post.split()), 3072))
- return np.vstack((sent_emb, pads))
- else:
- return sent_emb[:med]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement