Biblio::LCC - parse and normalize LC-style call numbers
use Biblio::LCC; $normalized = Biblio::LCC->normalize('PS3573.A472242 A88 1998'); ($begin, $limit) = Biblio::LCC->normalize_range('E184.5-E185'); @parts = Biblio::LCC->parse($call_number); $call_number = Biblio::LCC->add($class, $offset);
Biblio::LCC parses Library of Congress classification ranges and call numbers and normalizes them into a form suitable for a straight ASCII sort.
$normalized = Biblio::LCC->normalize('PS3573.A472242 A88 1998');
Convert an LC-style class (e.g., 'PS' or 'E184.5') or call number (e.g., 'PS3573.A472242 A88 1998') into a string that may be compared to other normalized call numbers (see normalize_range below).
($begin, $limit) = Biblio::LCC->normalize_range('E184.5-E185');
Parse a call number range, producing a pair of strings B and L such that a call number falls within the range if and only if its normalized form, in a straight lexicographic ASCII comparison, is greater than or equal to B and strictly less than L.
The range may be specified in one of three ways:
A pair of call numbers; the range includes the beginning call number, the ending call number, and any call numbers that have the ending call number as a prefix.
For example, the (unnormalized) range
AS131-AS142 encompasses any class or call number from
AS131 up to but not including
In this form, the alphabetic string that begins the second call number may be omitted, so (for example)
E184.5-185 is equivalent to
Space is optional around the hyphen.
A single class or call number, in unnormalized form. This is equivalent to a pair in which each call number is the same. For example, the unnormalized range
QA141.5.A1 encompasses call numbers from
QA141.5.A1 up to but not including
A pair of call numbers; the range includes the first call number and any call number up and not including the ending call number.
For example, the unnormalized range
DT6.7<DT7 includes everything greater than
DT6.7 and less than
In this form, the alphabetic string that begins the second call number may be omitted, as in the form of range that uses a hyphen to separate the parts.
Space is optional around the less-than sign (<).
($alpha, $int, $frac, $rmdr) = Biblio::LCC->parse($call_number);
Split an LC call number into alphabetic, integer, decimal fraction, and remainder (i.e., everything else).
$call_number = Biblio::LCC->add($class, $offset);
Add an offset (e.g., '180.3') to a base LC class (e.g., 'GN1600') to produce another LC class (e.g., 'GN1780.3').
The base class may have only alphabetic and integer parts; an exception will be thrown if it has a fractional part (e.g., as in 'GN1600.1') or a remainder (e.g., as in 'GN1600 R5').
Call numbers are first analyzed into four parts. For example, take the call number GB1001.72.M32 E73 1988.
The one to three alphabetic characters that begin the call number.
An integer from 1 to 9999 that follows.
Digits that follow a decimal point after the integer part.
M32 E73 1988
Everything that follows.
The LC Classification allows for a wide range of possible call numbers that do not fall into the simple (alpha, integer, fraction, remainder) model that this module implements. For example, the following are all valid call numbers:
It may be that in some cases further analysis, and fully correct sorting, are not possible without hardcoded knowledge of the LC classification. In many cases, however, a more sophisticated parsing model, while more complex, would result in better normalization.
There are no known bugs. Please report bugs on this module's RT page: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Biblio-LCC.
new method and rewrite other methods so they may be used as class or instance methods.
Special handling of "special" call numbers (e.g., in the Gs).
Allow caller to specify prefixes to strip (e.g., "Folio").
Parse straight from the 050 or 090 field of a MARC record.
Better error reporting.
Paul Hoffman (nkuitse AT cpan DOT org)
Copyright 2007-2008 Paul M. Hoffman.
This is free software, and is made available under the same terms as Perl itself.