Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def text_from_tagged_ngram(ngram):
  2. if type(ngram) == tuple:
  3. return ngram[0]
  4. return " ".join(zip(*ngram)[0]) # zip(*ngram)[0] returns a tuple with words from a (word,tag) list
  5.  
  6. return " ".join(list[zip(*ngram)[0]])
  7. TypeError: 'zip' object is not subscriptable
  8.  
  9. list(zip(*ngram))[0]
  10.  
  11. next(zip(*ngram))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement