How do I use collocation() to store it as a list

704 Views Asked by At

I have to save the bigram collocations as a list in a variable but unable to do it with collocation(). I need to later return the variable from a function.

1

There are 1 best solutions below

0
dankal444 On

Try collocation_list() instead, collocations() is printing as it was designed to.

a=nltk.Text(tokenizedwords).collocation_list()

Sources: