Skip to content

Commit

Permalink
Treat U_ARABIC_NUMBER as LTR
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreeshrii committed Feb 26, 2019
1 parent 449f1cd commit 25b02bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ccstruct/pageres.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@ class WERD_RES : public ELIST_LINK {
UNICHARSET::Direction dir =
uch_set->get_direction(unichar_id);
if (dir == UNICHARSET::U_RIGHT_TO_LEFT ||
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC ||
dir == UNICHARSET::U_ARABIC_NUMBER)
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC)
return true;
}
return false;
Expand All @@ -413,7 +412,8 @@ class WERD_RES : public ELIST_LINK {
if (unichar_id < 0 || unichar_id >= uch_set->size())
continue; // Ignore illegal chars.
UNICHARSET::Direction dir = uch_set->get_direction(unichar_id);
if (dir == UNICHARSET::U_LEFT_TO_RIGHT)
if (dir == UNICHARSET::U_LEFT_TO_RIGHT ||
dir == UNICHARSET::U_ARABIC_NUMBER)
return true;
}
return false;
Expand Down
5 changes: 3 additions & 2 deletions src/training/boxchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ void BoxChar::GetDirection(int* num_rtl, int* num_ltr) const {
for (char32 ch : uni_vector) {
UCharDirection dir = u_charDirection(ch);
if (dir == U_RIGHT_TO_LEFT || dir == U_RIGHT_TO_LEFT_ARABIC ||
dir == U_ARABIC_NUMBER || dir == U_RIGHT_TO_LEFT_ISOLATE) {
dir == U_RIGHT_TO_LEFT_ISOLATE) {
++*num_rtl;
} else if (dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL) {
} else if ((dir == U_ARABIC_NUMBER) ||
(dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL)) {
++*num_ltr;
}
}
Expand Down

0 comments on commit 25b02bf

Please sign in to comment.