• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Lingua/EN/H15-Nov-2020-350121

t/H15-Nov-2020-469312

ChangesH A D15-Nov-20203.3 KiB10682

LICENSEH A D13-Nov-2020261 85

MANIFESTH A D15-Nov-2020282 2423

MANIFEST.SKIPH A D14-Nov-20201 KiB6744

Makefile.PLH A D13-Nov-20201.6 KiB5240

READMEH A D13-Nov-20204.5 KiB15498

README.mdH A D15-Nov-20203.6 KiB12981

README

1=head1 NAME
2
3NameCase - Perl module to fix the case of people's names.
4
5=head1 SYNOPSIS
6
7    # Working with scalars; complementing lc and uc.
8
9    use Lingua::EN::NameCase qw( nc ) ;
10
11    $FixedCasedName  = nc( $OriginalName ) ;
12
13    $FixedCasedName  = nc( \$OriginalName ) ;
14
15    # Working with arrays or array references.
16
17    use Lingua::EN::NameCase 'NameCase' ;
18
19    $FixedCasedName  = NameCase( $OriginalName ) ;
20    @FixedCasedNames = NameCase( @OriginalNames ) ;
21
22    $FixedCasedName  = NameCase( \$OriginalName ) ;
23    @FixedCasedNames = NameCase( \@OriginalNames ) ;
24
25    NameCase( \@OriginalNames ) ; # In-place.
26
27    # NameCase will not change a scalar in-place, i.e.
28    NameCase( \$OriginalName ) ; # WRONG: null operation.
29
30    $Lingua::EN::NameCase::SPANISH = 1;
31    # Now 'El' => 'El' instead of (default) Greek 'El' => 'el'.
32    # Now 'La' => 'La' instead of (default) French 'La' => 'la'.
33
34=head1 DESCRIPTION
35
36Forenames and surnames are often stored either wholly in UPPERCASE
37or wholly in lowercase. This module allows you to convert names into
38the correct case where possible.
39
40Although forenames and surnames are normally stored separately if they
41do appear in a single string, whitespace separated, NameCase and nc deal
42correctly with them.
43
44NameCase currently correctly name cases names which include any of the
45following:
46    Mc, Mac, al, el, ap, da, de, delle, della, di, du, del, der,
47    la, le, lo, van and von.
48
49It correctly deals with names which contain apostrophies and hyphens too.
50
51=head2 EXAMPLE FIXES
52
53    Original            Name Case
54    --------            ---------
55    KEITH               Keith
56    LEIGH-WILLIAMS      Leigh-Williams
57    MCCARTHY            McCarthy
58    O'CALLAGHAN         O'Callaghan
59    ST. JOHN            St. John
60
61plus "son (daughter) of" etc. in various languages, e.g.:
62
63    VON STREIT          von Streit
64    VAN DYKE            van Dyke
65    AP LLWYD DAFYDD     ap Llwyd Dafydd
66etc.
67
68plus names with roman numerals (up to 89, LXXXIX), e.g.:
69
70    henry viii          Henry VIII
71    louis xiv           Louis XIV
72
73=head1 BUGS
74
75The module covers the rules that I know of. There are probably a lot
76more rules, exceptions etc. for "Western"-style languages which could be
77incorporated.
78
79There are probably lots of exceptions and problems - but as a general
80data 'cleaner' it may be all you need.
81
82Use Kim Ryan's NameParse.pm for any really sophisticated name parsing.
83
84=head1 CHANGES
85
86These are the original change comments. These have now been moved to the new
87Changes file within the distribution.
88
891998/04/20  First release.
90
911998/06/25  First public release.
92
931999/01/18  Second public release.
94
951999/02/08  Added Mac with Mack as an exception, thanks to Kim Ryan for this.
96
971999/05/05  Copied Kim Ryan's Mc/Mac solution from his NameParse.pm and
98            replaced my Mc/Mac solution with his.
99
1001999/05/08  nc can now use $_ as its default argument
101            e.g. "$ans = nc ;" and "nc ;", both of which set $_, with the
102            first one setting $ans also.
103
1041999/07/30  Modified for CPAN and automatic testing. Stopped using $_ as the
105            default argument.
106
1071999/08/08  Changed licence to LGPL.
108
1091999/09/07  Minor change to packaging for CPAN.
110
1111999/09/09  Renamed package Lingua::EN::NameCase.pm as per John Porter's
112            (CPAN) suggestion.
113
1141999/11/13  Added code for names with roman numerals, thanks to David Lynn
115            Rice for this suggestion. (If you need to go beyond LXXXIX let me
116            know.)
117
1182000/11/22  Added use locale at the suggestion of Eric Kolve. It should have
119    	    been there in the first place.
120
1212002/04/25  Al, Ben and Van are preserved if single names and namecased
122	        otherwise, e.g. 'Al' => 'Al', 'Al Fahd' => 'al Fahd'. Added
123	        $SPANISH_EL variable. All thanks to a suggestion by Aaron
124    	    Patterson.
125
1262002/04/26  Changed $SPANISH_EL to $SPANISH and now 'La' => 'la' unless
127	        $SPANISH is set in which case 'La' => 'La'. Again thanks to
128	        Aaron Patterson.
129
1302007/04/27  Added 16 "Mac" exceptions provided by Stuart McConnachie.
131    	    The license is now "the same terms as Perl itself".
132
1332008/02/07  Fixed the version number.
134
135=head1 AUTHOR
136
137  Mark Summerfield <summer@qtrac.eu> - 1998-2014
138  Barbie <barbie@cpan.org>  2014-present
139
140=head1 ACKNOWLEDGEMENTS
141
142Thanks to Kim Ryan <kimaryan@ozemail.com.au> for his Mc/Mac solution.
143
144=head1 COPYRIGHT
145
146Copyright (c) Mark Summerfield 1998-2014. All Rights Reserved.
147Copyright (c) Barbie 2014-2015. All Rights Reserved.
148
149This distribution is free software; you can redistribute it and/or
150modify it under the Artistic Licence v2.
151
152=cut
153
154

README.md

1# NAME
2
3Lingua::EN::NameCase - Correctly case a person's name from UPERCASE or lowcase
4
5# VERSION
6
7Version 0.70
8
9# SYNOPSIS
10
11    # Working with scalars; complementing lc and uc.
12
13    use Lingua::EN::NameCase qw( nc );
14
15    $FixedCasedName  = nc( $OriginalName );
16
17    $FixedCasedName  = nc( \$OriginalName );
18
19    # Working with arrays or array references.
20
21    use Lingua::EN::NameCase 'NameCase';
22
23    $FixedCasedName  = NameCase( $OriginalName );
24    @FixedCasedNames = NameCase( @OriginalNames );
25
26    $FixedCasedName  = NameCase( \$OriginalName );
27    @FixedCasedNames = NameCase( \@OriginalNames );
28
29    NameCase( \@OriginalNames ) ; # In-place.
30
31    # NameCase will not change a scalar in-place, i.e.
32    NameCase( \$OriginalName ) ; # WRONG: null operation.
33
34    $Lingua::EN::NameCase::SPANISH = 1;
35    # Now 'El' => 'El' instead of (default) Greek 'El' => 'el'.
36    # Now 'La' => 'La' instead of (default) French 'La' => 'la'.
37
38    $Lingua::EN::NameCase::HEBREW = 0;
39    # Now 'Aharon BEN Amram Ha-Kohein' => 'Aharon Ben Amram Ha-Kohein'
40    #   instead of (default) => 'Aharon ben Amram Ha-Kohein'.
41
42    $Lingua::EN::NameCase::ROMAN = 0;
43    # Now 'Li' => 'Li' instead of (default) 'Li' => 'LI'.
44
45    $Lingua::EN::NameCase::POSTNOMINAL = 0;
46    # Now 'PHD' => 'PhD' instead of (default) 'PHD' => 'Phd'.
47
48# DESCRIPTION
49
50Forenames and surnames are often stored either wholly in UPPERCASE
51or wholly in lowercase. This module allows you to convert names into
52the correct case where possible.
53
54Although forenames and surnames are normally stored separately if they
55do appear in a single string, whitespace separated, NameCase and nc deal
56correctly with them.
57
58NameCase currently correctly name cases names which include any of the
59following:
60
61    Mc, Mac, al, el, ap, da, de, delle, della, di, du, del, der,
62    la, le, lo, van and von.
63
64It correctly deals with names which contain apostrophes and hyphens too.
65
66## EXAMPLE FIXES
67
68    Original            Name Case
69    --------            ---------
70    KEITH               Keith
71    LEIGH-WILLIAMS      Leigh-Williams
72    MCCARTHY            McCarthy
73    O'CALLAGHAN         O'Callaghan
74    ST. JOHN            St. John
75
76plus "son (daughter) of" etc. in various languages, e.g.:
77
78    VON STREIT          von Streit
79    VAN DYKE            van Dyke
80    AP LLWYD DAFYDD     ap Llwyd Dafydd
81    etc.
82
83plus names with roman numerals (up to 89, LXXXIX), e.g.:
84
85    henry viii          Henry VIII
86    louis xiv           Louis XIV
87
88# METHODS
89
90- NameCase
91
92    Takes a scalar, scalarref, array or arrayref, and changes the case of the
93    contents, as appropriate. Essentially a wrapper around nc().
94
95- nc
96
97    Takes a scalar or scalarref, and change the case of the name in the
98    corresponding string appropriately.
99
100# BUGS
101
102The module covers the rules that I know of. There are probably a lot
103more rules, exceptions etc. for "Western"-style languages which could be
104incorporated.
105
106There are probably lots of exceptions and problems - but as a general
107data 'cleaner' it may be all you need.
108
109Use Kim Ryan's [Lingua::EN::NameParse](https://metacpan.org/pod/Lingua%3A%3AEN%3A%3ANameParse) for any really sophisticated name parsing.
110
111# AUTHOR
112
113    1998-2014    Mark Summerfield <summer@qtrac.eu>
114    2014-present Barbie <barbie@cpan.org>
115
116    2020- Maintained by Nigel Horne, C<< <njh at bandsman.co.uk> >>
117
118# ACKNOWLEDGEMENTS
119
120Thanks to Kim Ryan <kimaryan@ozemail.com.au> for his Mc/Mac solution.
121
122# COPYRIGHT
123
124Copyright (c) Mark Summerfield 1998-2014. All Rights Reserved.
125Copyright (c) Barbie 2014-2015. All Rights Reserved.
126
127This distribution is free software; you can redistribute it and/or
128modify it under the Artistic Licence v2.
129