add fuzzy for computing string distance

This commit is contained in:
Eddy 2022-09-08 23:23:45 +02:00
parent 487da69efd
commit 6785df1f8f
2 changed files with 11 additions and 9 deletions

View File

@ -28,15 +28,6 @@ class NekoSamaProvider : MainAPI() {
**/
data class Genre(
@JsonProperty("0") val action: String,
@JsonProperty("1") val adventure: String,
@JsonProperty("2") val drama: String?,
@JsonProperty("3") val fantasy: String?,
@JsonProperty("4") val military: String?,
@JsonProperty("5") val shounen: String,
)
private fun List<EpisodeData>.sortByQuery(query: String?): List<EpisodeData> {
return if (query == null) {
// Return list to base state if no query
@ -60,6 +51,15 @@ class NekoSamaProvider : MainAPI() {
}
}
data class Genre(
@JsonProperty("0") val action: String,
@JsonProperty("1") val adventure: String,
@JsonProperty("2") val drama: String?,
@JsonProperty("3") val fantasy: String?,
@JsonProperty("4") val military: String?,
@JsonProperty("5") val shounen: String,
)
data class EpisodeData(
@JsonProperty("id") val id: Int?,
@JsonProperty("title") val title: String?,

View File

@ -84,6 +84,8 @@ subprojects {
//run JS
implementation("org.mozilla:rhino:1.7.14")
// Library/extensions searching with Levenshtein distance
implementation ("me.xdrop:fuzzywuzzy:1.4.0")
}
}