I have a tagged file in the format token/tag and I try a function that returns a tuple with words from a (word,tag) list.
def text_from_tagged_ngram(ngram):
if type(ngram) == tuple:
return ngram[0]
return " ".join(zip(*ngram)[0]) # zip(*ngram)[0] returns a tuple with words from a (word,tag) list
In python 2.7 it worked well, but in python 3.4 it gives me the following error:
return " ".join(list[zip(*ngram)[0]])
TypeError: 'zip' object is not subscriptable
Can someone help?