I'm trying to count the number of bigrams in a large group of text. I have already taken the text line by line from standard input, cleaned the text, and generated by bigrams. Now I have a nested loop that looks like this line by line:
Input:
[['breakfast', 'large'], ['large', 'portions'], ['portions', 'and'], ['friendly', 'staff']]
[['highly', 'recommend'), ['recommend', 'coming'], ['coming', 'here'], ['here', 'excellent'], ['excellent', 'service']]
What I want to do is split each of these nested lists into one line, so that I can print to standard out using
print ('%s\t%s' % (list(bigrams), 1))
This would give a line by line output such as:
Output:
['breakfast', 'large'], 1
['large', 'portions'], 1
['portions', 'and'], 1