with open('text.txt', 'rU') as f:
    sixgrams = ngrams(f.read().decode('utf8').split(), 2)
result = collections.Counter(sixgrams)
print(result)
with open('output.txt', 'w') as f:
    for item, count in sorted(result.items()):
        if count >= 2:
            pass
Counting frequency of ngrams