Module: UnsupervisedLanguageDetection

Defined in:
lib/unsupervised-language-detection.rb,
lib/unsupervised-language-detection/version.rb

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.is_english_tweet?(tweet) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/unsupervised-language-detection.rb', line 4

def self.is_english_tweet?(tweet)
  @detector ||= LanguageDetector.load_yaml(File.expand_path('../unsupervised-language-detection/english-tweet-detector.yaml', __FILE__))
  @detector.classify(tweet) == "majority"
end