Permalink
Browse files
Fix missing language filtering in rule-based engine (#23)
- Loading branch information
|
@@ -229,10 +229,13 @@ class LanguageDetector internal constructor( |
|
|
.filter { it.value >= minimalRequiredCharCount } |
|
|
.count() > 0 |
|
|
|
|
|
return if (languagesWithMinimumRequiredCharCountExist) |
|
|
languageCharCounts.toList().maxBy { it.second }!!.first |
|
|
else |
|
|
return if (languagesWithMinimumRequiredCharCountExist) { |
|
|
val language = languageCharCounts.toList().maxBy { it.second }!!.first |
|
|
if (language in languages) language else UNKNOWN |
|
|
} |
|
|
else { |
|
|
UNKNOWN |
|
|
} |
|
|
} |
|
|
|
|
|
internal fun filterLanguagesByRules(words: List<String>): Sequence<Language> { |
|
|