Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/unsupervised-language-detection/language-detector.rb

Instance Method Summary collapse

Instance Method Details

#to_ngrams(n) ⇒ Object

Returns a set of ‘n`-grams computed from this string.



6
7
8
# File 'lib/unsupervised-language-detection/language-detector.rb', line 6

def to_ngrams(n)
  self.normalize_tweet.scan(/.{#{n}}/)
end