Post by @sidvishnoi@mastodon.social

Ana Tudor 🐯
@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.

Sid Vishnoi
@sidvishnoi @mastodon.social

@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.

1 like
The origin reports likes but does not publish who liked this post.
Refresh interactions
Ana Tudor 🐯
@anatudor @mastodon.social

@sidvishnoi I don't necessarily have the language, I have a country reference. Which is not quite the same...