Method: FeldtRuby::NgramWordCounter#all_ngrams
- Defined in:
- lib/feldtruby/word_counter.rb
#all_ngrams(array) ⇒ Object
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/feldtruby/word_counter.rb', line 90 def all_ngrams(array) res = [] length = array.length index = 0 while (length - index) >= @n res << array[index, @n] index += 1 end res end |