Lingua...meCase(3pm)

πŸ“¦
version 1.21 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 that WRONG: null operation line 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 (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