From a0dc776890b01d39ebe6643256430d39e5b46774 Mon Sep 17 00:00:00 2001
From: Mathieu Loiseau <mathieu.loiseau@liris.cnrs.fr>
Date: Mon, 29 May 2023 11:18:36 +0200
Subject: [PATCH] Subdef's examples

---
 wikstraktor.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/wikstraktor.py b/wikstraktor.py
index 3c09e8a..8fa0ff7 100755
--- a/wikstraktor.py
+++ b/wikstraktor.py
@@ -599,24 +599,21 @@ class Wikstraktor:
 			pattern_ex = self.constants['sense_pattern'][0]["add_subdef"] + self.constants['sense_pattern'][0]["ex"]
 		#Process examples
 		a = 0
-		#print(sub_items)# DEBUG:
 		for item_list in sub_items:
-			# print(a, item_list.pattern, 'vs', pattern_ex)# DEBUG:
 			if item_list.pattern == pattern_ex:
 				for item in item_list.items:
 					newSense.add_example(self.process_example(item))
 					#Si on veut traiter les sous items (ex traductions), on peut utiliser
-					#item_list.sublists(a)
-			# print(a, item_list.pattern, 'vs', pattern_subdef, item_list.items, len(item_list.sublists()))# DEBUG:
-			# print(item_list.sublists(a))# DEBUG:
 			if def_level and item_list.pattern == pattern_subdef:
+				b = 0
 				for item in item_list.items:
 					try:
-						sub_sub = item_list.sublists(a)
+						sub_sub = item_list.sublists(b)
 					except IndexError as err:
 						sub_sub = []
-					# print(sub_sub, item_list.sublists())
+						print(f"There is an error in the selection of subitems:\n\t{b}th item of\n\t{itm_list.sublists()}\ntriggered {err}")
 					newSense.add_subsense(self.process_definition(item, sub_sub, False))
+					b += 1
 			a += 1
 		return newSense
 
-- 
GitLab