mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-30 23:11:01 +00:00
various fixes and updates
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ani.dantotsu.parsers
|
||||
|
||||
import ani.dantotsu.logger
|
||||
|
||||
class StringMatcher {
|
||||
companion object {
|
||||
private fun levenshteinDistance(s1: String, s2: String): Int {
|
||||
@@ -52,8 +54,10 @@ class StringMatcher {
|
||||
val closestShowAndIndex = closestShow(target, shows)
|
||||
val closestIndex = closestShowAndIndex.second
|
||||
if (closestIndex == -1) {
|
||||
logger("No closest show found for $target")
|
||||
return shows // Return original list if no closest show found
|
||||
}
|
||||
logger("Closest show found for $target is ${closestShowAndIndex.first.name}")
|
||||
return listOf(shows[closestIndex]) + shows.subList(0, closestIndex) + shows.subList(closestIndex + 1, shows.size)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user