Post Reply 
Basic error in numerical sorting of album names
13-01-2014, 08:55
Post: #26
RE: Basic error in numerical sorting of album names
(12-01-2014 23:27)Andre Gosselin Wrote:  Simon,
Different aspects shoud be considered on their own merits in all this discussion about "natural" numeric sorting.
1. Is it a desirable "feature" ?
2. Can it provoke bad side-effects ?
3. Can it be efficiently implemented or would it consume too much resources ?

On point 1, I still have difficulty understanding why someone would prefer seeing sequence :
"Bach J.S BWV 1 ...", "Bach J.S. BWV 10 ...", "Bach J.S. BWV 100 ...", "Bach J.S. BWV 2 ..."
instead of :
"Bach J.S BWV 1 ...", "Bach J.S. BWV 2 ...", "Bach J.S. BWV 10...", "Bach J.S. BWV 100 ..."
If you look at the major classical musical catalogs listing works of Bach, Mozart, Haydn, Teleman. Scarlatti, etc , you can see that compositions are named along similar patterns. It is quite "natural" for one to replicate those naming patterns when tagging music files. Use of ALBUMSORT tags to circumvent this issue is a technique applicable only to album titles, whereas the issue is exhbited in many other places, for example in playlists names (playlists, expecilly when organized hierarchically, are one of the best way to organize a music collection, and opus/catalog numbers will appear everywhere). The only generally applicable approach to achieve correct sorting is the "left zero-fill in a fixed width numeric field" technique :
"Bach J.S. BWV 0001 ...", "BACH J.S. BWV 0002 ...", "Bach J.S. BWV 0010 ...", etc
This is the technique I use myself (as many others do), for lack of a better solution. It is something you can surely live with (if you start with it and choose a correct field width at first, otherwise you are in for a lot of work), but I always resent it as an ugly kludge. For me, and many others, it is "Scarlatti Keyboard Sonata in A minor, K.7", not "... K.007".

About my point 2, I still need to see a convincing example of those bad results that could be produced by "number aware sorting" in the domain of music. True, there can be cases where "0.82u1" sorts before "0.20", but I humbly feel this example is a bit contrived and appears to apply to software releases id's. My experience is that in the vast majority of cases where numbers are used in titles (or similar) tags (especially for classical music), those numbers are simple ones which follow a simple usage pattern, similar to the examples given above.

Now to point 3. I humbly feel this is the real issue. Among all those music managers/servers I tried my hand on so far, only Windows Media Player implements numeric sort for strings (including play list names). So MinimServer is not alone here in it's use of strict lexicographic sorting. The fact that so few softwares attempt to deal with embedded numbers when sorting strings could be indicative of a certain level of difficulty. Here the software developpers must be trusted in their decision to implement or not numerical sorting in strings.

In short, I would love to see embedded numbers treated specially when sorting strings, but would accept to see this issue left on the back burner for a while, not because it is "bad", "incorrect", "unnatural", etc , but because it would be too difficult to implement correctly and, above all, efficiently. It could then be seen as a desireable goal for a future release.

Regards to all

Thanks for this helpful summary of the issues involved. I'd like to add a few points:

1) Given that this feature does involve some extra cost, it needs to be optional and it needs to be implemented in a way that doesn't cause overhead for users who don't have the feature enabled. Also, it is very desirable that it doesn't cause overhead when sorting strings that don't contain embedded numbers.

2) It needs to be well specified. For example, is '00' greater or less than '0' and is '01' greater or less than '1'? These strings cannot be considered exactly equal because this would violate the principle that comparison operations should be consistent with equals, as explained on this page. The case of '0' and '00' is relevant for classical music, as there are two Bruckner symphonies with these designations.

3) It needs to be able to be combined with other features, such as the existing 'ignoreThe' capability, and also with any other custom sorting features that might be added in the future.

4) It needs to fit in with the existing design and implementation of MinimServer, without causing too much internal complexity in the code.

I am thinking about a possible approach that might satisfy all the above requirements. As usual with new features like this, I am reluctant to make any commitment that MinimServer will support the feature until I have prototyped a working implementation and convinced myself that it satisfies all the required criteria.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Basic error in numerical sorting of album names - simoncn - 13-01-2014 08:55

Forum Jump:


User(s) browsing this thread: 2 Guest(s)