Python 2.x sublist parameter equivalent in 3.x

Viewed 3327

I'm working some NLP experiments in Python and wanted to implement this function in Python 3.x though the lambda expansion here is giving me a hard time and I'm not sure how it'd be implemented in 3.x; any suggestions?

    candidates = [' '.join(word for word, pos, chunk in group).lower()
              for key, group in itertools.groupby(all_chunks, lambda (word,pos,chunk): chunk != 'O') if key]

The error I get is on this piece since sublist parameters are not supported in 3.x

lambda (word,pos,chunk)

The original source is the extract_candidate_words function here: http://bdewilde.github.io/blog/2014/09/23/intro-to-automatic-keyphrase-extraction/

1 Answers
Related