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:
|
else:
|
||||||
return Order.Any
|
return Order.Any
|
||||||
|
|
||||||
|
|
||||||
def match(self, from_w, to_w):
|
def match(self, from_w, to_w):
|
||||||
if self is Order.Any:
|
if self is Order.Any:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
fi = int(from_w.id.split('.')[-1][1:])
|
fi = from_w.int_id
|
||||||
ti = int(to_w.id.split('.')[-1][1:])
|
ti = to_w.int_id
|
||||||
|
|
||||||
if self is Order.FromTo:
|
if self is Order.FromTo:
|
||||||
return fi < ti
|
return fi < ti
|
||||||
|
@ -717,6 +718,11 @@ class Word:
|
||||||
self.text = xml.text
|
self.text = xml.text
|
||||||
self.links = defaultdict(list)
|
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))
|
assert(None not in (self.id, self.lemma, self.msd))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user