Implementation with weighted values (relative to total).
bigram and n-gram implementation.