From a83fc7f8c0f8a4b4d8e08c90275369f23b6821db Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 3 Nov 2025 14:38:23 -0400 Subject: search: fresher artist groups math --- src/search-select.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/search-select.js b/src/search-select.js index db347914..02002057 100644 --- a/src/search-select.js +++ b/src/search-select.js @@ -62,32 +62,41 @@ function determineArtistGroups(artist, opts) { const contributionGroups = contributions.flatMap(contrib => contrib.groups); + const scores = + new Map( + unique(contributionGroups).map(group => [group, 0])); + const artistNamesish = unique( [artist.name, ...artist.artistAliases.map(alias => alias.name)] .map(name => getKebabCase(name))); - const interestingGroups = - unique(contributionGroups) - .filter(group => !artistNamesish.includes(getKebabCase(group.name))); + for (const group of scores.keys()) { + if (artistNamesish.includes(getKebabCase(group.name))) { + scores.delete(group); + } + } - if (contributions.length < 50) { - return interestingGroups; + for (const group of contributionGroups) { + scores.set(group, scores.get(group) + 1 / contributions.length); } const dividingGroups = opts.wikiInfo.divideTrackListsByGroups; - const scores = - new Map(interestingGroups.map(group => [group, 0])); + const dividingGroupThreshold = + (contributions.length < 50 ? 0.08 : 0.16); - for (const group of contributionGroups) { - scores.set(group, scores.get(group) + 1 / contributions.length); - } + const generalGroupThreshold = + (contributions.length < 50 ? 0.00 : 0.12); + + for (const group of scores.keys()) { + const threshold = + (dividingGroups.includes(group) + ? dividingGroupThreshold + : generalGroupThreshold); - for (const group of interestingGroups) { - if (dividingGroups.includes(group)) continue; - if (scores.get(group) < 0.12) { + if (scores.get(group) < threshold) { scores.delete(group); } } -- cgit 1.3.0-6-gf8a5