]> cat aescling's git repositories - mastodon.git/commitdiff
Fix Thai being skipped from language detection (#13989)
authorSasha Sorokin <dafri.nochiterov8@gmail.com>
Thu, 25 Jun 2020 20:45:01 +0000 (03:45 +0700)
committerGitHub <noreply@github.com>
Thu, 25 Jun 2020 20:45:01 +0000 (22:45 +0200)
Thai does not separate words by spaces, so I figured out it should be
in 'reliable characters regexp' that denotes languages that do the same.

Related #13891.

app/lib/language_detector.rb

index 05a06726d7a02ceed1f0a4063e38ed83b43139f3..2cc8ac6158dcab83ac8e644ab3e08befe155858b 100644 (file)
@@ -4,7 +4,7 @@ class LanguageDetector
   include Singleton
 
   WORDS_THRESHOLD        = 4
-  RELIABLE_CHARACTERS_RE = /[\p{Hebrew}\p{Arabic}\p{Syriac}\p{Thaana}\p{Nko}\p{Han}\p{Katakana}\p{Hiragana}\p{Hangul}]+/m
+  RELIABLE_CHARACTERS_RE = /[\p{Hebrew}\p{Arabic}\p{Syriac}\p{Thaana}\p{Nko}\p{Han}\p{Katakana}\p{Hiragana}\p{Hangul}\p{Thai}]+/m
 
   def initialize
     @identifier = CLD3::NNetLanguageIdentifier.new(1, 2048)