Merge pull request #623 from ebraminio/patch-1

Only checking 20 first words is usually enough
This commit is contained in:
Athou
2014-10-06 09:58:11 +02:00

View File

@@ -41,6 +41,11 @@ class EstimateDirection {
} else if (hasAnyLtr(token)) { } else if (hasAnyLtr(token)) {
total++; 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); return total == 0 ? false : ((float) rtlCount / total > RTL_DETECTION_THRESHOLD ? true : false);