Only checking 20 first words is usually enough

This commit is contained in:
ebraminio
2014-09-12 16:36:18 +04:30
committed by Ebrahim Byagowi
parent 17288017d8
commit d8537a98aa

View File

@@ -41,6 +41,11 @@ class EstimateDirection {
} else if (hasAnyLtr(token)) {
total++;
}
// only checking 20 first words is usually enough
if (i == 20) {
break;
}
}
return total == 0 ? false : ((float) rtlCount / total > RTL_DETECTION_THRESHOLD ? true : false);