Files
linguist/lib/linguist/strategy/classifier.rb
Brandon Keepers 74fa4b9b75 docs
2014-11-03 08:54:11 -05:00

14 lines
426 B
Ruby

module Linguist
module Strategy
# Detect language using the bayesian classifier
class Classifier
def self.call(blob, languages)
Linguist::Classifier.classify(Samples.cache, blob.data, laguages.map(&:name)).map do |name|
# Return the actual Language object based of the string language name (i.e., first element of `#classify`)
Language[name]
end
end
end
end
end