#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,367

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

#4 2022-09-21 18:52

adostrom
Member
From: Carlisle, MA
Registered: 2022-09-21
Posts: 8

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

This is my #1 request for a new "feature".  I don't think it needs to be very complex to address 99% of the issues I have (and I suspect most people have).

What we need is a checkbox that says: Do not apply to first word in filename.  Use Case:  You need to use lower case short words unless they're a the beginning of a file name.  Example: if you use "capitalize first letter" and put the wordS "in,to,the" into the "fragment list using current rule you get results like this:

Changes: "THE RULE NEEDS TO WORK IN THE BEST WAY.JPG"
Result: "the Rule Needs to Work in the Best Way.jpg"

With a "skip first word" checkbox you'd get:

Result: "The Rule Needs to Work in the Best Way.jpg"

which is the desired result.  This would save a LOT of time managing my many photos and other files.

Thanks.

Offline

#5 2022-09-25 19:57

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

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

adostrom wrote:

Changes: "THE RULE NEEDS TO WORK IN THE BEST WAY.JPG"
Result: "the Rule Needs to Work in the Best Way.jpg"

With a "skip first word" checkbox you'd get:

Result: "The Rule Needs to Work in the Best Way.jpg"

which is the desired result.

Not exactly. It will actually become "THE Rule Needs to Work in the Best Way.jpg" if the first word is skipped. You would need two separate Case rules, one to capitalise all words and then another one to lower case the desired fragments (prepositions), except the first one.

I think I understand what you are looking for. There is a planned feature which would allow users to apply a rule only to a selected part of file names.

In the meantime, you can convert the first letter to upper case with this Regular Expressions rule: replace expression "\A(\w)" with "\U$1".

Offline

#6 2022-09-26 04:06

adostrom
Member
From: Carlisle, MA
Registered: 2022-09-21
Posts: 8

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

Thanks for the reply.  Actually, I think the way I was suggesting it would work it should do exactly what I said.  Maybe my explanation was not clear. I was NOT proposing that the checkbox would cause the entire rule to skip the first word, but that the checkbox would negate the checkbox that forces fragments to be capitalized in the list.  Think of it as a checkbox (maybe radio button with the current checkbox) that says, Force all fragments, except the first word, to be capitalized as in the list.

Andy

Last edited by adostrom (2022-09-26 04:16)

Offline

Board footer

Powered by FluxBB