Skip to content

Commit 6d24bda

Browse files
committed
Allow the use of 'tensed' as underspecification in EventSortinfo.
1 parent 82e4617 commit 6d24bda

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

pydmrs/components.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -752,15 +752,17 @@ def is_more_specific(self, other):
752752
if self.cvarsort != other.cvarsort:
753753
return False
754754
for key, value in other.iter_specified():
755-
if not self.is_specified(key) or value != self[key]:
756-
return False
757-
result = False
758-
for key, value in self.iter_specified():
759-
if not other.is_specified(key):
760-
result = True
761-
elif value != other[key]:
755+
if not self.is_specified(key):
762756
return False
763-
return result
757+
elif value != self[key]:
758+
if key == 'tense' and value == 'tensed' and self[key] != 'untensed':
759+
continue
760+
else:
761+
return False
762+
only_this_specified = set(other.iter_specified()).difference(other.iter_specified())
763+
if not only_this_specified:
764+
return False
765+
return True
764766

765767
def is_less_specific(self, other):
766768
"""
@@ -774,15 +776,17 @@ def is_less_specific(self, other):
774776
if self.cvarsort != other.cvarsort:
775777
return False
776778
for key, value in self.iter_specified():
777-
if not other.is_specified(key) or value != other[key]:
778-
return False
779-
result = False
780-
for key, value in other.iter_specified():
781-
if not self.is_specified(key):
782-
result = True
783-
elif value != self[key]:
779+
if not other.is_specified(key):
784780
return False
785-
return result
781+
elif value != other[key]:
782+
if key == 'tense' and value == 'tensed' and other[key] != 'untensed':
783+
continue
784+
else:
785+
return False
786+
only_other_specified = set(other.iter_specified()).difference(self.iter_specified())
787+
if not only_other_specified:
788+
return False
789+
return True
786790

787791

788792
class EventSortinfo(Sortinfo):

0 commit comments

Comments
 (0)