SHARE
TWEET

Untitled

a guest Oct 19th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top