new sorting option: ignore articles

Features wanted...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: new sorting option: ignore articles

Post by TheQwerty »

ladner wrote:"a" and "an" are ignored as expected but "at" is not ignored. This is what I want but I am curious how it works. Can you please translate the Regex dictionary item "an?" into English for me?
First try reading this: http://regex101.com/r/iP3lU8
I suspect it does a better job of explaining than I can. :lol:
Plus it's colorful!


^ means the match must start at the beginning.
(...) is a group - usually used for capturing the contents but in this case it aids the OR.
the means match 'the'.
| means match either the left side or the right side (the group limits it to 'the' OR 'an?' instead of everything to the left/right of the |.
an? means match 'a' followed by zero or one instances of 'n'.
\b means the previous matches must take place at a word boundary - not really needed because of the next part.
\s+ means all of the previous must be follow by 1 or more white space characters.

http://www.regular-expressions.info/ is another great source.


EDIT: Curiously enough popular Ebook manager Calibre took a stab at listing the articles for other languages: https://github.com/kovidgoyal/calibre/b ... ks.py#L219

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

TheQwerty wrote:
ladner wrote:"a" and "an" are ignored as expected but "at" is not ignored. This is what I want but I am curious how it works. Can you please translate the Regex dictionary item "an?" into English for me?
First try reading this: http://regex101.com/r/iP3lU8
I suspect it does a better job of explaining than I can. :lol:
Plus it's colorful!


^ means the match must start at the beginning.
(...) is a group - usually used for capturing the contents but in this case it aids the OR.
the means match 'the'.
| means match either the left side or the right side (the group limits it to 'the' OR 'an?' instead of everything to the left/right of the |.
an? means match 'a' followed by zero or one instances of 'n'.
\b means the previous matches must take place at a word boundary - not really needed because of the next part.
\s+ means all of the previous must be follow by 1 or more white space characters.

http://www.regular-expressions.info/ is another great source.


EDIT: Curiously enough popular Ebook manager Calibre took a stab at listing the articles for other languages: https://github.com/kovidgoyal/calibre/b ... ks.py#L219
Thanks again. I did some reading before asking the question but could not find "an? means match 'a' followed by zero or one instances of 'n'.".

Now I understand.

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

Although I am satisfied with this script solution it is not as good as an ignore article feature built into the product for 2 reasons:

1) I now have an extra name column for sorting purposes which clutters my view. I cannot remove the original name column because I need to keep it for renaming purposes.

2) The "type a few letters to find an item in the list" feature does not work on the scripted column.

Anyway it's good enough as is. Maybe someday this will become a native feature.

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

EDIT: Curiously enough popular Ebook manager Calibre took a stab at listing the articles for other languages: https://github.com/kovidgoyal/calibre/b ... ks.py#L219
JRiver Media Center uses the following multi-language list of ignored articles:
a;an;the;ein;eine;das;der;die;el;il;la;las;le;les;los;un;une;de l';de la;des;du;l';la;le;les;un;une

And Collectorz.com Movie Collector uses:
the
a
an
de
het
een
die
der
das
des
dem
der
ein
eines
einer
einen
la
le
l'
les
un
une
el
las
los
las
un
una
unos
unas
o
a
os
as
um
uma
uns
umas
en
et
il
lo
uno
gli

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

OK, I will try to add something more streamlined...

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

Check beta v13.90.0008...

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

admin wrote:Check beta v13.90.0008...
Wonderful news. Thanks!

I tried beta 13.90.008 but was unable to get the new sort option to work. Perhaps I am not applying the tweak correctly?

I added the lines
SortIgnoreLeadingWords=1
SortLeadingWordsToIgnore="a;an;the"

to the [Settings] section of XYplorer.ini

Maybe I need to add these settings to the registry instead?

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »


ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

Got it. The new sort feature works well.

Much appreciated. XYP is perfect now. You should be very proud of your product.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

Well, it's just a hobby. :mrgreen:

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

A very satisfying hobby I suspect.

I found one small problem. Typing a few characters to find an item in the list does not work for items with an ignored article.

If this is difficult to fix it is probably ok to leave as is.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

The ignoring is only done for sorting.

If you want typing you have to go the earlier way (scripted column), and tick Use sorted column (Menus, Mouse, Safety - Type Ahead Find).

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

PS: Or you select "Match anywhere" in "Enable type ahead find" (Menus, Mouse, Safety - Type Ahead Find).

ladner
Posts: 39
Joined: 30 Sep 2011 18:44

Re: new sorting option: ignore articles

Post by ladner »

admin wrote:PS: Or you select "Match anywhere" in "Enable type ahead find" (Menus, Mouse, Safety - Type Ahead Find).
A good suggestion but does not behave as expected since it matches words in the middle of the name. I need to keep it set to match at the beginning to find the first item in an alphabetically sorted list.

Not a problem. It is plenty good enough as is.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: new sorting option: ignore articles

Post by admin »

Feature now available in config:

Code: Select all

v13.90.0105 - 2014-04-11 14:10
    + Configuration | Sort and Rename | Sort: Added option "Ignore articles when 
      sorting". Elevates tweak SortIgnoreLeadingWords to UI.
      Still to be tweaked is which articles are ignored. This is the factory 
      default:
        SortLeadingWordsToIgnore=a;an;the

Post Reply