name initials in all caps string gets incorrectly lower cased
Does NOT work:
$> perl
use Lingua::EN::Titlecase::Simple qw(titlecase);
my $str = 'HAHA AND HEHE A.B TEAM UP';
print titlecase($str), "\n";
Haha and Hehe a.b Team Up
$>
Thanks!
@ap would you be interested/willing to look into this? Thanks!
Yes, I’ve meant to reply for a while. Sorry you’re having to wait.
Uhm, what is your expected output here? “A.b” or “A.B”? Can you provide a non-gibberish example sentence that illustrates the case?
Uhm, what is your expected output here? “A.b” or “A.B”?
A.B
Can you provide a non-gibberish example sentence that illustrates the case?
Oh, no, my example is not gibberish :-) Anyway, how about this?
Input: MICHAEL AND JOHN A.P TEAM UP TO DO SOMETHING AWESOME!
Output (current): Michael and John a.p Team Up to Do Something Awesome!
Output (desired): Michael and John A.P Team up to Do Something Awesome!
I guess that helps, insofar as it tells me that a simple example doesn’t make it obvious what’s going on linguistically. This “A.P” with a missing trailing period is not something I have ever seen or would normally write. How does it chunk? Is one person called “Michael” and the other “John A. P”? Are they “Michael A. P.” and “John A. P.”? Is “A.P” some kind of oddball nonstandard personal style (kinda like the people who insist their names be written in lowercase)?
Thanks! I don't so much have control on the input text (often received from external sources). That being said, the way I saw the input above as - one person is called "Michael" and the other "John A.P" but I agree with you that there are other ways to look at it.
Just to make sure this isn't really a corner case, I tried the following online titlecase conversions and they all seem to match the desired output:
- http://titlecase.com/
- http://individed.com/code/to-title-case/
- https://capitalizemytitle.com/
Is “A.P” some kind of oddball nonstandard personal style (kinda like the people who insist their names be written in lowercase)
Hmm ... I guess I didn't run into such a case with my input names at the least (about 10K names and counting) - who knows what could be next? :-)