Post by @anatudor@mastodon.social
When you have a list of places from all around the world and want to order them alphabetically & group by letter, but without the article, so you don't have a ton of places like The Mill under "T", how do you get rid of the articles, considering the fact that these articles are not just in English?
Because my current (and probably stupid) solution is a regex that keeps growing.
And I'm spending my evening reading up on the grammar of languages I'll probably never learn.
@anatudor I got interested in this once. Try searching for "library filing rules". e.g. https://libguides.ala.org/filing-rules/publications . Librarians may have already thought this through.
@anatudor How I would do this:
I’d copy the list into the column of a spreadsheet twice (column A, B)
Then I’d search and replace the Articles incl space in column A with „nothing“
Now you can sort the columns A&B together and voila!
@anatudor Interesting problem! If we know the language of each item, we can split the large regex into multiple regexes by language. Regex by language will be helpful anyway - run the list through each regex/language to strip away the article in multiple passes.
`L'` in French/Italian could be a separate case, as not space separated word. Using `\b` around each article will simplify all cases likely.
I'm not sure of Romanian, where the article can be suffixed - maybe not an issue to address.
@sidvishnoi I don't necessarily have the language, I have a country reference. Which is not quite the same...
@anatudor a practical suggestion: make a second database field with the place name reordered for collation, e.g. "Mill, The" for "The Mill". You have to do a little more work at data entry time, but that regex can help you there, and it no longer needs to be perfect.
P.S. this seems to be an #internationalisation #i18n issue. Those hashtags may get you some help.
@anatudor But doesn't it seem odd to list El Paso, Texas, as "Paso, El?" And isn't there a comparable issue with all of the Norths, Wests, and News that appear in such lists?
@mastomuckle This is not about cities. It's about specific locations like "The Mill" example I gave. And I'm also not talking about display names in the list, those I'm not touching.
@anatudor @mastomuckle The same point applies to venue names, though. "El Mocambo" in Toronto would be alphabetized under E even if a similar name in Mexico might be alphabetized under M.
I agree with the other suggestion that you really need a separate data field to store the alphabetize-by string separate from the display string, and you need human judgment to confirm it's correct even if you have a regex to suggest a value when you enter the data.
@anatudor@mastodon.social
Just use a language that doesn't make use of any articles ;)
Like e.g. Lingwa de Planeta (Lidepla).
http://lingwadeplaneta.info
https://lidepla.net
(the latter designed by me)