From c685a6bb545b80192aa6aeaa0654a8390c5ea755 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 24 Mar 2021 00:42:59 -0300 Subject: getNameScore algorithm todo --- playlist-utils.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/playlist-utils.js b/playlist-utils.js index 317ff84..899a349 100644 --- a/playlist-utils.js +++ b/playlist-utils.js @@ -837,6 +837,24 @@ function getNameScore(name1, name2) { // length of that series, so a higher score is better (and a zero score // means no overlap). + // TODO: + // This ain't perfect! Case example: User A has library structure: + // + // Very Cool Album/ + // 01 Beans + // + // User B has library structure: + // + // Very Cool Album/ + // Very Cool Album- 01 Beans + // + // Now if user B queues 'Very Cool Album- 01 Beans', the search will match + // the *group* 'Very Cool Album' on User A's end, because that name has a + // 3-word match, in comparison to the track '01 Beans', which is only a + // 2-word match. Not sure what a proper solution here would be, but probably + // it'd involve somehow prioritizing series of words which match closer to + // the end! + // Split into chunks of word characters, taking out any non-word (\W) // characters between. const toWords = name => name.split(/\W+/) -- cgit 1.3.0-6-gf8a5