#1 2021-04-20 02:21

vertigo
Member
Registered: 2019-03-10
Posts: 7

Capitalization issue with articles (the, a, an) and prepositions

There's a limitation in the case rule that prevents the necessary flexibility to change the case based on a word's position. For example:

The title of the file - The title of the file

cannot be changed to

The Title of the File - The Title of the File

If "the" and "of" are used in the "Force case for fragments" box (with the either "Capitalize..." option), it results in this:

the Title of the File - the Title of the File

I tried putting " the" in the hopes it would at least capitalize "the" at the beginning of the sentence, but it didn't work.
I tried putting "^The" and "- The" in an attempt to get it to capitalize it at the beginning of the sentence and immediately following the hyphen but, again, no luck.

So it seems this box is very limited in what it will accept, and therefore only works in some cases and not others, thereby preventing proper capitalization. I'm sure it can be done via regex afterward, as a separate rule, but that's a lot more hassle. It seems the best and easiest solution is to change how ReNamer interprets the entries in this box, so it actually obeys entire strings (i.e. spaces, hyphens, etc) and supports regex (though that's not even necessary, if it goes in order, so it could change all instances of " the" to lowercase (which wouldn't affect ones at the start of the filename, and so those would be capitalized ("The")) then an entry afterward could be set for "- The" so those would be adjusted accordingly.

Offline

#2 2021-05-18 01:32

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,119

Re: Capitalization issue with articles (the, a, an) and prepositions

It is a known limitation, and one that is difficult to address without making the rule a lot more complex than an average user would expect.

The words (or "fragments", as called in the user interface) are processed as whole words. All white space characters on either side of a fragment are trimmed on purpose, in order to correctly and unambiguously identify the word boundaries.

There are at least two ways for addressing this limitation:
1) Handle more complex pattern matching, similar to regex or wildcards.
2) Offer an option to apply the Case rule (or any other rule really) only to a pre-selected part of the filename.

I think the 2nd option is the way to go, because the added complexity will be optional and will be available elsewhere, perhaps as a separate rule that would allow users to select a part of the filename which will be affected by the next rule, or something like that.

Offline

#3 2021-05-18 05:08

vertigo
Member
Registered: 2019-03-10
Posts: 7

Re: Capitalization issue with articles (the, a, an) and prepositions

I feel like option 2 would be far too limiting. How would you define what part of the filename? Could it be defined in a way that would allow it to be flexible, used with various files, or would it have to be configured each time? Maybe you have a specific idea in mind of how to do it that would work well, but I'm visualizing it being far too specific and limiting.

To me, it makes the most sense to not strip the whitespace, and allow the text to apply exactly as entered in between the commas. If you want to avoid confusion from this, e.g. from someone typing a, the, of for readability instead of a,the,of and finding it doesn't work as expected, you could simply make it an option with a checkbox, and default it to off. Another option would be to enable escaping, so instead of enabling an option to include whitespaces and doing a, the,of you could just do a,\ the,of. Also, wildcards would be extremely useful and borderline essential, so instead of having to do -\ The,-\ A,-\ An,-\ Of,-\ With, etc, etc, you could just do -\ ? to have any word preceded by "- " capitalized. Basically mixing in a little bit of very basic regex to allow a significantly higher level of complexity and flexibility with minimal extra effort on the user's part.

Offline

Board footer

Powered by FluxBB