namecase(3)

NAME

NameCase - Perl module to fix the case of people's names.

SYNOPSIS

# Working with scalars; complementing lc and uc.
use Lingua::EN::NameCase qw( nc ) ;
$FixedCasedName  = nc( $OriginalName ) ;
$FixedCasedName  = nc( riginalName ) ;
# Working with arrays or array references.
use Lingua::EN::NameCase 'NameCase' ;
$FixedCasedName  = NameCase( $OriginalName ) ;
@FixedCasedNames = NameCase( @OriginalNames ) ;
$FixedCasedName  = NameCase( riginalName ) ;
@FixedCasedNames = NameCase( @OriginalNames ) ;
NameCase( @OriginalNames ) ; # In-place.
# NameCase will not change a scalar in-place, i.e.
NameCase( riginalName ) ; # WRONG: null operation.

DESCRIPTION

Forenames and surnames are often stored either wholly in
UPPERCASE or wholly in lowercase. This module allows you
to convert names into the correct case where possible.

Although forenames and surnames are normally stored sepa
rately if they do appear in a single string, whitespace
separated, NameCase and nc deal correctly with them.

NameCase currently correctly name cases names which
include any of the following:
Mc, Mac, al, el, ap, da, de, delle, della, di, du,
del, der,
la, le, lo, van and von.
It correctly deals with names which contain apostrophies
and hyphens too.
EXAMPLE FIXES

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

BUGS

The module covers the rules that I know of. There are
probably a lot more rules, exceptions etc. for "West
ern"-style languages which could be incorporated.

We don't fix "ben" - for hebrew names this means son of,
but it can mean "Ben" as a name in itself or as a form of
"Benjamin". However we do fix "al" - for arabic names this
means son of, even though it can also mean "Al" as a name
in itself.

There are probably lots of exceptions and problems - but
as a general data 'cleaner' it may be all you need.

Use Kim Ryan's NameParse.pm for any really sophisticated
name parsing.

CHANGES

1998/04/20 First release.

1998/06/25 First public release.

1999/01/18 Second public release.

1999/02/08 Added Mac with Mack as an exception, thanks to
Kim Ryan for this.

1999/05/05 Copied Kim Ryan's Mc/Mac solution from his
NameParse.pm and
replaced my Mc/Mac solution with his.
1999/05/08 nc can now use $_ as its default argument
e.g. "$ans = nc ;" and "nc ;", both of which
set $_, with the
first one setting $ans also.
1999/07/30 Modified for CPAN and automatic testing.
Stopped using $_ as the
default argument.
1999/08/08 Changed licence to LGPL.
1999/09/07 Minor change to packaging for CPAN.
1999/09/09 Renamed package Lingua::EN::NameCase.pm as per
John Porter's
(CPAN) suggestion.
1999/11/13 Added code for names with roman numerals,
thanks to David Lynn
Rice for this suggestion. (If you need to go
beyond LXXXIX let me
know.)
2000/11/22 Added use locale at the suggestion of Eric
Kolve. It should have been there in the first
place.

AUTHOR

Mark Summerfield. I can be contacted as <summer@perl
press.com> - please include the word 'namecase' in the
subject line.

Thanks to Kim Ryan <kimaryan@ozemail.com.au> for his
Mc/Mac solution.

COPYRIGHT

Copyright (c) Mark Summerfield 1998-2000. All Rights
Reserved.

This module may be used/distributed/modified under the
LGPL.
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout