lib/opener/language_identifier/detector.rb in opener-language-identifier-4.2.1 vs lib/opener/language_identifier/detector.rb in opener-language-identifier-4.2.2

- old
+ new

@@ -80,9 +80,15 @@ ## # @return [String] # def detect(input) return new_detector(input).detect + + # The core Java code raise an exception when it can't detect a language. + # Since this isn't actually something fatal we'll capture this and return + # "unknown" instead. + rescue com.cybozu.labs.langdetect.LangDetectException + return 'unknown' end ## # @return [Array] #