INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Feature Request: Fix Swap-Function  (Read 406 times)

wstreit

  • Member
  • *
  • Posts: 4
Feature Request: Fix Swap-Function
« on: June 26, 2023, 02:07:45 am »

Unfortunately, the swap function does not work correctly for names with 4 words or units, for example:
swap(Sonny Boy Williamson II) returns: Boy Williamson, Sonny II,
or swap(Billy Joe Walker Jr.) becomes: Joe Walker, Billy Jr.

I wish this feature can be fixed in the next build.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42048
  • Shoes gone again!
Re: Feature Request: Fix Swap-Function
« Reply #1 on: June 26, 2023, 07:40:10 am »

We have special handling for a few suffixes like Jr., Sr., roman numerals, etc.

It makes "Billy Walker Jr." become "Walker, Billy Jr.".

Are you thinking "Billy Joe Walker Jr." should become "Walker, Billy Joe Jr."?  Today it's "Joe Walker, Billy Jr.".

In my head it's not clear that one is better than the other.
Logged
Matt Ashland, JRiver Media Center

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Feature Request: Fix Swap-Function
« Reply #2 on: June 26, 2023, 08:14:48 am »

I think that the logical swap is "Walker, Billy Joe Jr." .

That said, I no longer sort by last name.  It's too confusing.  My physical media collection, and my digital ones, are all sorted by first real word.  Billy Joel is under B.  "The Hunt For Red October" is sorted under H.  John Lee Hooker is sorted under J.  This is simple and consistent, which is normally how I structure things.

Brian.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3027
Re: Feature Request: Fix Swap-Function
« Reply #3 on: June 26, 2023, 08:37:41 am »

The vast majority of my titles sort fine with the current swap. There are always going to be anomalies that no algorithm can get right - e.g. Grateful Dead. I just use swap with a manual override for anomalies. I guess that is cumbersome for a huge library but it works for me. Swap can never get everything right.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42048
  • Shoes gone again!
Re: Feature Request: Fix Swap-Function
« Reply #4 on: June 26, 2023, 08:39:55 am »

Next build:
Changed: Tuned the Swap(...) expression function to work better with big strings.

We now make "Billy Joe Walker Jr." into "Walker, Billy Joe Jr."

Testing appreciated.

Thanks!
Logged
Matt Ashland, JRiver Media Center

markf2748

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 732
Re: Feature Request: Fix Swap-Function
« Reply #5 on: June 26, 2023, 10:04:31 am »

I always sort in MC by first real word, but my 2 cents...

APA is a widely used style.  This old blog entry, while it talks about citing references, also has a logical ring to it for sorting and listing by last name:
https://blog.apastyle.org/apastyle/2012/03/jr-sr-and-other-suffixes-in-apa-style.html

More recently:  https://writeanswers.royalroads.ca/faq/199230

Same for MLA style:  https://owl.purdue.edu/owl/research_and_citation/mla_style/mla_formatting_and_style_guide/mla_works_cited_page_basic_format.html
"Do, however, include suffixes like "Jr." or "II." Putting it all together, a work by Dr. Martin Luther King, Jr. would be cited as "King, Martin Luther, Jr." Here the suffix following the first or middle name and a comma."

So I prefer displaying
"Walker, Billy Joe, Jr."
"Billy Joe Walker Jr."  (unless of course Billy Joe himself uses "Billy Joe Walker, Jr.", which must be respected)
though internally it may be stored in whatever way simplifies programming.

Sample Cases:
1) Based on album covers, I conclude "Billy Joe Walker, Jr." is correct, notwithstanding a lot of variation in references to his work.
2) More ambiguous is "Sammy Davis Jr." vs. "Sammy Davis, Jr." since it appears both ways on album covers.  I would still want swap() to return "Davis, Sammy, Jr." in both cases.

Win 11 64-bit  MC 31.0.26
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3027
Re: Feature Request: Fix Swap-Function
« Reply #6 on: June 26, 2023, 10:48:20 am »

Does this effect people who have Swap in a calculated field? If so it may change their database without them knowing it. I do a swap in some calculated fields but I still use Mr. C's original regex.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3027
Re: Feature Request: Fix Swap-Function
« Reply #7 on: June 26, 2023, 01:30:40 pm »

Parsing the last "word" of the name (minus suffix) and putting that first probably handles the vast majority of the cases, although it will not be perfect. Grabbing the last part means it does not matter how many parts there are to the full name. It also handles von, de and other similar parts of the name, but fails on ... the younger, for example. I guess things like "the younger" could be treated like Jr. III etc., but that might be too much. So, much better than the current, but not perfect.
Logged

markf2748

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 732
Re: Feature Request: Fix Swap-Function
« Reply #8 on: June 26, 2023, 01:49:51 pm »

Parsing the last "word" of the name (minus suffix) and putting that first...
Minus suffix and then minus any remaining trailing symbol if present (so you don't end up displaying a double comma, for example).
Also need to be smart about hyphenated name cases.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3027
Re: Feature Request: Fix Swap-Function
« Reply #9 on: June 26, 2023, 02:03:46 pm »

Minus suffix and then minus any remaining trailing symbol if present (so you don't end up displaying a double comma, for example).
Also need to be smart about hyphenated name cases.

Agreed.
Logged
Pages: [1]   Go Up