class Ai::Nlp::NGram
Class for calculating n-grams, storing and exploiting them
Public Instance Methods
calculate(input)
click to toggle source
Calculates the n-gram frequencies for the data set passed as an argument @param string input The dataset @return Frequencies of ngram or sorted array
# File lib/ai/nlp/n_gram/n_gram.rb, line 23 def calculate(input) hash = Hasher.new(input) hash.calculate end
hash(input)
click to toggle source
Cuts the data set into a grouping of letters @param string input The dataset
# File lib/ai/nlp/n_gram/n_gram.rb, line 15 def hash(input) calculate(input).map { |letters, _gram| letters } end