Lingua...meCase(3pm)
π Lingua::EN::NameCase π
okay so bestie, you know how databases be storing people's names in ALL CAPS like they're screaming, or in lowercase like they're whispering? yeah. this is the module that fixes that. it's Lingua::EN::NameCase(3pm), a User Contributed Perl Documentation page, and it's literally the glow-up your name data has been waiting for. periodt. π
β¨ NAME β¨
Lingua::EN::NameCase β correctly case a person's name from UPERCASE or lowcase π
(yes, "UPERCASE" β that's the original's typo and honestly? iconic. we keep it. no cap.)
πΈ VERSION πΈ
Version 1.21 β she's grown, she's evolved, she's thriving π¦
π SYNOPSIS π
the whole vibe, bestie:
# Working with scalars; complementing lc and uc.
use Lingua::EN::NameCase qw( nc );
$FixedCasedName = nc( $OriginalName );
$FixedCasedName = nc( \$OriginalName );
# Working with arrays or array references.
use Lingua::EN::NameCase 'NameCase';
$FixedCasedName = NameCase( $OriginalName );
@FixedCasedNames = NameCase( @OriginalNames );
$FixedCasedName = NameCase( \$OriginalName );
@FixedCasedNames = NameCase( \@OriginalNames );
NameCase( \@OriginalNames ) ; # In-place.
# NameCase will not change a scalar in-place, i.e.
NameCase( \$OriginalName ) ; # WRONG: null operation.
$Lingua::EN::NameCase::SPANISH = 1;
# Now 'El' => 'El' instead of (default) Greek 'El' => 'el'.
# Now 'La' => 'La' instead of (default) French 'La' => 'la'.
$Lingua::EN::NameCase::HEBREW = 0;
# Now 'Aharon BEN Amram Ha-Kohein' => 'Aharon Ben Amram Ha-Kohein'
# instead of (default) => 'Aharon ben Amram Ha-Kohein'.
$Lingua::EN::NameCase::ROMAN = 0;
# Now 'Li' => 'Li' instead of (default) 'Li' => 'LI'.
$Lingua::EN::NameCase::POSTNOMINAL = 0;
# Now 'PHD' => 'PhD' instead of (default) 'PHD' => 'Phd'.
β οΈ read thatWRONG: null operationline again bestie.NameCase( \$OriginalName )does not touch your scalar in place. it's giving nothing. it's giving empty. it's giving ghosting. only the arrayref version does in-place work. π
π DESCRIPTION π
Forenames and surnames are often stored either wholly in UPPERCASE or wholly in lowercase. This module lets you convert names into the correct case where possible. simple as that, and honestly? slay. π₯
Even though forenames and surnames are usually stored separately, if they do show up stuffed in a single string separated by whitespace, both NameCase and nc deal with them correctly. they don't get confused, they don't get messy, they just handle it. π
Right now NameCase correctly name cases names that include any of these lil prefix cuties:
Mc, Mac, al, el, ap, da, de, delle, della, di, du, del, der,
la, le, lo, van and von.
And she correctly deals with names that contain apostrophes and hyphens too. the tricky ones. the ones that make lesser modules cry. β¨
π EXAMPLE FIXES π
watch her work:
Original Name Case
-------- ---------
KEITH Keith
LEIGH-WILLIAMS Leigh-Williams
MCCARTHY McCarthy
O'CALLAGHAN O'Callaghan
ST. JOHN St. John
plus "son (daughter) of" etc. in various languages, e.g.:
VON STREIT von Streit
VAN DYKE van Dyke
AP LLWYD DAFYDD ap Llwyd Dafydd
etc.
plus names with roman numerals (up to 89, LXXXIX), e.g.:
henry viii Henry VIII
louis xiv Louis XIV
ngl the roman numeral thing goes hard. up to 89 only though, so don't come at her with your XC nonsense. π
π NameCase π
Takes a scalar, scalarref, array or arrayref, and changes the case of the contents, as appropriate. essentially it's just a cute little wrapper around nc(). π«Ά
π§ nc π§
Takes a scalar or scalarref, and changes the case of the name in the corresponding string appropriately. small, mighty, does exactly one job and does it well. main character energy fr fr. β
π BUGS π
The module covers the rules that I know of. There are probably a lot more rules, exceptions etc. for "Western"-style languages which could be incorporated. she's not omniscient, she's just doing her best. π
There are probably lots of exceptions and problems β but as a general data 'cleaner' it may be all you need. lowkey that's the whole pitch. πΈ
Use Kim Ryan's Lingua::EN::NameParse for any really sophisticated name parsing. when you need the deluxe treatment, go there. π
π¦ SUPPORT π¦
You can find documentation for this module with the perldoc command.
perldoc Lingua::EN::NameCase
You can also look for information at:
- MetaCPAN
https://metacpan.org/release/Lingua-EN-NameCase
- RT: CPAN's request tracker
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-EN-NameCase
- CPANTS
http://cpants.cpanauthors.org/dist/Lingua-EN-NameCase
- CPAN Testers' Matrix
http://matrix.cpantesters.org/?dist=Lingua-EN-NameCase
- CPAN Ratings
http://cpanratings.perl.org/d/Lingua-EN-NameCase
- CPAN Testers Dependencies
http://deps.cpantesters.org/?module=Lingua::EN::NameCase
π AUTHOR π
1998-2014 Mark Summerfield <summer@qtrac.eu>
2014-present Barbie <barbie@cpan.org>
2020- Maintained by Nigel Horne, C<< <njh at bandsman.co.uk> >>
three whole eras of maintainership, we love a legacy. π
π ACKNOWLEDGEMENTS π
Thanks to Kim Ryan <kimaryan@ozemail.com.au> for his Mc/Mac solution. the Mc/Mac of it all is chaos and we're so grateful someone figured it out. π«Ά
β COPYRIGHT β
Copyright (c) Mark Summerfield 1998-2014. All Rights Reserved.
Copyright (c) Barbie 2014-2015. All Rights Reserved.
This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.
and that's the whole page, bestie β¨ this was perl v5.36.0, dated 2022-10-22, from the Lingua...meCase(3pm) manual β go forth and fix those names, you absolute icon π
π
π¦ where this page comes from
- ubuntu noble: liblingua-en-namecase-perl 1.21-2 Β· Artistic-2.0
- ubuntu resolute: liblingua-en-namecase-perl 1.21-2 Β· Artistic-2.0
- ubuntu stonking: liblingua-en-namecase-perl 1.21-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms