lib/myaso/ngrams.rb
# Trigrams enumerator. Yes, this method should return an Enumerator
# instance, but it is too slow.
#
Trigrams enumerator. Yes, this method should return an Enumerator
instance, but it is too slow.
Trigrams enumerator . Yes this method should return an Enumerator instance but it is too slow .
def each_trigram
    table.each do |unigram, bigrams|
      bigrams.each do |bigram, trigrams|
        next unless bigram
        trigrams.each do |trigram, count|
          next unless trigram
          yield [[unigram, bigram, trigram], count]
        end
      end
    end
  end
def each_trigram table . each do | unigram , bigrams | bigrams . each do | bigram , trigrams | next unless bigram trigrams . each do | trigram , count | next unless trigram yield [ [ unigram , bigram , trigram ] , count ] end end end end
Trigrams enumerator.
Trigrams enumerator .