diff --git a/wani.py b/wani.py index 734d297..7ce397f 100644 --- a/wani.py +++ b/wani.py @@ -145,12 +145,13 @@ class Order(Enum): else: return Order.Any + def match(self, from_w, to_w): if self is Order.Any: return True - fi = int(from_w.id.split('.')[-1][1:]) - ti = int(to_w.id.split('.')[-1][1:]) + fi = from_w.int_id + ti = to_w.int_id if self is Order.FromTo: return fi < ti @@ -717,6 +718,11 @@ class Word: self.text = xml.text self.links = defaultdict(list) + last_num = self.id.split('.')[-1] + if last_num[0] not in '0123456789': + last_num = last_num[1:] + self.int_id = int(last_num) + assert(None not in (self.id, self.lemma, self.msd)) @staticmethod