From 9d61acf173ec1b26d71d147a08edc9b7177f9e49 Mon Sep 17 00:00:00 2001 From: Robert Sachunsky Date: Mon, 31 Mar 2025 02:02:30 +0200 Subject: [PATCH] simplify --- src/eynollah/eynollah.py | 6 ++---- src/eynollah/utils/__init__.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/eynollah/eynollah.py b/src/eynollah/eynollah.py index 68a9580..bfc93f0 100644 --- a/src/eynollah/eynollah.py +++ b/src/eynollah/eynollah.py @@ -4084,10 +4084,8 @@ class Eynollah: ind_textline_inside_tr = list(range(len(contours[jj]))) index_textline_inside_textregion = index_textline_inside_textregion + ind_textline_inside_tr - #ind_ins = [0] * len(contours[jj]) + jj - ind_ins = np.zeros( len(contours[jj]) ) + jj - list_ind_ins = list(ind_ins) - indexes_of_textline_tot = indexes_of_textline_tot + list_ind_ins + ind_ins = [jj] * len(contours[jj]) + indexes_of_textline_tot = indexes_of_textline_tot + ind_ins M_main_tot = [cv2.moments(contours_txtline_of_all_textregions[j]) for j in range(len(contours_txtline_of_all_textregions))] diff --git a/src/eynollah/utils/__init__.py b/src/eynollah/utils/__init__.py index a67fc38..70216e1 100644 --- a/src/eynollah/utils/__init__.py +++ b/src/eynollah/utils/__init__.py @@ -237,10 +237,8 @@ def return_x_start_end_mothers_childs_and_type_of_reading_order( if len(remained_sep_indexes)>1: #print(np.array(remained_sep_indexes),'np.array(remained_sep_indexes)') #print(np.array(mother),'mother') - ##remained_sep_indexes_without_mother = remained_sep_indexes[mother==0] - ##remained_sep_indexes_with_child_without_mother = remained_sep_indexes[mother==0 & child==1] - remained_sep_indexes_without_mother=np.array(list(remained_sep_indexes))[np.array(mother)==0] - remained_sep_indexes_with_child_without_mother=np.array(list(remained_sep_indexes))[(np.array(mother)==0) & (np.array(child)==1)] + remained_sep_indexes_without_mother = remained_sep_indexes[mother==0] + remained_sep_indexes_with_child_without_mother = remained_sep_indexes[(mother==0) & (child==1)] #print(remained_sep_indexes_without_mother,'remained_sep_indexes_without_mother') #print(remained_sep_indexes_without_mother,'remained_sep_indexes_without_mother')