Supporting different xml:id variations
This commit is contained in:
parent
31483c79ff
commit
2f2bb91d0f
10
wani.py
10
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user