Documentation
¶
Index ¶
- func CleanText(text string) string
- func Contains(slice []string, item string) bool
- func DefaultInt(values ...int) int
- func DefaultString(values ...string) string
- func ExtractYear(text string) int
- func LevenshteinDistance(s1, s2 string) int
- func NormalizeTitle(title string) string
- func ParseFloat(s string) float64
- func ParseInt(s string) int
- func RemoveDuplicates(slice []string) []string
- func SimilarityScore(title1, title2 string) float64
- func SplitGenres(genres string) []string
- func TruncateString(s string, maxLen int) string
- type MatchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultString ¶
DefaultString returns the first non-empty string
func ExtractYear ¶
ExtractYear extracts a 4-digit year from a string Returns 0 if no year is found
func LevenshteinDistance ¶
LevenshteinDistance calculates the Levenshtein distance between two strings It returns the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into the other
func NormalizeTitle ¶
NormalizeTitle normalizes a title for comparison Removes special characters, converts to lowercase, removes season/part patterns
func ParseFloat ¶
ParseFloat safely parses a string to float64, returning 0.0 on error
func RemoveDuplicates ¶
RemoveDuplicates removes duplicate strings from a slice while preserving order
func SimilarityScore ¶
SimilarityScore calculates a similarity score between two titles (0.0 to 1.0) 1.0 means perfect match, 0.0 means completely different
func SplitGenres ¶
SplitGenres splits a genre string by common delimiters
func TruncateString ¶
TruncateString truncates a string to maxLen characters If truncated, appends "..." to the end
Types ¶
type MatchResult ¶
MatchResult represents a search result with its similarity score
func FindBestMatch ¶
func FindBestMatch(query string, results []providers.Media, minScore float64) *MatchResult
FindBestMatch finds the single best matching media item Returns nil if no match meets the minimum score threshold
func FindBestMatches ¶
func FindBestMatches(query string, results []providers.Media, minScore float64) []MatchResult
FindBestMatches finds the best matching media items from a list based on title similarity Returns sorted list of matches with similarity scores minScore is the minimum similarity threshold (0.0 to 1.0)