Skip to content

Instantly share code, notes, and snippets.

@bpgergo
Created June 22, 2011 09:43
Ngrams with coroutines 3
counts = [[10 for i in xrange(k)] for i in xrange(k)]
bigrams = filter_chars(accepted_chars, ngrams(2, counter(counts)))
for c in open('big.txt').read().decode(enc): bigrams.send(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment