Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def cut_sent(post, embedding):
  2. elmo_embedding.embed(sent)
  3.  
  4. matrix = []
  5. for token in sent:
  6. matrix.append(np.array(token.embedding))
  7. sent_emb = np.matrix(matrix)
  8.  
  9. if len(post.split()) < med:
  10. pads = np.zeros((med - len(post.split()), 3072))
  11. return np.vstack((sent_emb, pads))
  12. else:
  13. return sent_emb[:med]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement