mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Use coecreAtLeast
GitOrigin-RevId: 721e53efa7068cc6e14fbbb513909fd62de3fb27
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c4d1bfd17d
commit
db9b88ec8d
@@ -90,8 +90,7 @@ class EditSimilarity(showByDefault: Boolean = false) : SimilarityMetric(showByDe
|
||||
|
||||
override fun computeSimilarity(lookup: Lookup, expectedText: String): Double? {
|
||||
return lookup.suggestions.maxOfOrNull {
|
||||
val res = expectedText.length - LevenshteinDistance.getDefaultInstance().apply(it.text.drop(lookup.prefix.length), expectedText)
|
||||
if (res < 0) 0 else res
|
||||
}?.toDouble()
|
||||
expectedText.length - LevenshteinDistance.getDefaultInstance().apply(it.text.drop(lookup.prefix.length), expectedText)
|
||||
}?.toDouble()?.coerceAtLeast(0.0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user