change: Use SAM with `sortWith` comparator

This commit is contained in:
Nik Clayton 2024-04-30 16:13:56 +02:00
parent 8ee5463bba
commit 45b7e8777f
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ open class Extractor {
private fun removeOverlappingEntities(entities: MutableList<Entity>) { private fun removeOverlappingEntities(entities: MutableList<Entity>) {
// sort by index // sort by index
entities.sortWith(Comparator { e1, e2 -> e1.start - e2.start }) entities.sortWith { e1, e2 -> e1.start - e2.start }
// Remove overlapping entities. // Remove overlapping entities.
// Two entities overlap only when one is URL and the other is hashtag/mention // Two entities overlap only when one is URL and the other is hashtag/mention