Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. from tqdm import tqdm_notebook as tqdm
  2.  
  3.  
  4. remade_sentences = []
  5. sentences = []
  6. head_sentences = []
  7. with open(r"C:\Users\Paul\Desktop\seq2label\cs230-code-examples\pytorch\nlp\data\small\test\sentences.txt", "r") as f:
  8. sentences = f.read().splitlines()
  9. print(len(sentences[3].split()))
  10. for j in tqdm(range(len(sentences))):
  11. sentence = cube(sentences[j])
  12. head_sentences.append([])
  13. for x in sentence:
  14. new_sent = []
  15. for i, word in enumerate(x):
  16. new_sent.append(x[i].word)
  17. head_sentences[j].append(x[i].head)
  18. remade_sentences.append(' '.join(new_sent))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement