Closed a-gardner1 closed 1 year ago
@@ -359,7 +359,7 @@ class VernacSentence:
from different documents can still be sorted together (although
the significance of the results may be suspect).
"""
- return [s for _, s in sorted([(s.location, s) for s in sentences])]
+ return sorted(sentences,key=lambda s:s.location)
The problem seems to occur when a list of sentences that come from different documents are sorted together (or if the same sentence or one that overlaps occur in the list) If two sentences have the exact same position, sorted
will try to tiebreak by the second item in the tuple, the sentence itself. However, dataclasses aren't ordered by default.
A simple fix would be to sort using only the location by use of a sort key. Though, I'm not sure why sentences from multiple files would be sorted together.
I'll stick this commit in a to-be-made PR.