mirror of
https://github.com/shafat-96/anicrush-api.git
synced 2026-04-17 15:51:44 +00:00
mapper
This commit is contained in:
18
mapper.js
18
mapper.js
@@ -248,11 +248,23 @@ function findBestMatch(anilistData, anicrushResults) {
|
||||
}
|
||||
|
||||
// Add bonus for type match
|
||||
if (expectedType && result.type && expectedType === result.type) {
|
||||
currentSimilarity += 10; // Reduced from 20 to 10
|
||||
if (expectedType && result.type) {
|
||||
if (expectedType === result.type) {
|
||||
currentSimilarity += 25; // Increased from 10 to 25
|
||||
} else {
|
||||
currentSimilarity -= 30; // Add significant penalty for type mismatch
|
||||
}
|
||||
}
|
||||
|
||||
// Add penalty for significant length difference
|
||||
// Add penalty for episode count mismatch (if available)
|
||||
if (anilistData.episodes && result.episodes_count) {
|
||||
const episodeDiff = Math.abs(anilistData.episodes - result.episodes_count);
|
||||
if (episodeDiff > 2) { // Allow small differences
|
||||
currentSimilarity -= (episodeDiff * 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Add penalty for length difference
|
||||
const lengthDiff = Math.abs(cleanTitle1.length - cleanTitle2.length);
|
||||
if (lengthDiff > 10) {
|
||||
currentSimilarity -= (lengthDiff * 0.5);
|
||||
|
||||
Reference in New Issue
Block a user