Skip to content

Commit

Permalink
Allow the use of 'tensed' as underspecification in EventSortinfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
emm68 committed Aug 18, 2018
1 parent 82e4617 commit 6d24bda
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions pydmrs/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,15 +752,17 @@ def is_more_specific(self, other):
if self.cvarsort != other.cvarsort:
return False
for key, value in other.iter_specified():
if not self.is_specified(key) or value != self[key]:
return False
result = False
for key, value in self.iter_specified():
if not other.is_specified(key):
result = True
elif value != other[key]:
if not self.is_specified(key):
return False
return result
elif value != self[key]:
if key == 'tense' and value == 'tensed' and self[key] != 'untensed':
continue
else:
return False
only_this_specified = set(other.iter_specified()).difference(other.iter_specified())
if not only_this_specified:
return False
return True

def is_less_specific(self, other):
"""
Expand All @@ -774,15 +776,17 @@ def is_less_specific(self, other):
if self.cvarsort != other.cvarsort:
return False
for key, value in self.iter_specified():
if not other.is_specified(key) or value != other[key]:
return False
result = False
for key, value in other.iter_specified():
if not self.is_specified(key):
result = True
elif value != self[key]:
if not other.is_specified(key):
return False
return result
elif value != other[key]:
if key == 'tense' and value == 'tensed' and other[key] != 'untensed':
continue
else:
return False
only_other_specified = set(other.iter_specified()).difference(self.iter_specified())
if not only_other_specified:
return False
return True


class EventSortinfo(Sortinfo):
Expand Down

0 comments on commit 6d24bda

Please sign in to comment.