unt-libraries / pycallnumber

Parse, model, and manipulate any type of call number string.
BSD 3-Clause "New" or "Revised" License
64 stars 9 forks source link

LC class that includes first cutter not recognized as an LcClass #32

Open mbelvadi2 opened 4 years ago

mbelvadi2 commented 4 years ago

I'm trying to work with the entire LC class table, defining labels for every LC class range defined in the official class tables (https://www.loc.gov/catdir/cpso/lcco/) as having an official description. For instance, Z116-659 is described as Book industries and trade I first break the string into start and end, and each piece, converted into your data class types, eg: range_start = pycn.callnumber(lc_range_part1) range_end = pycn.callnumber(lc_range_part2) and check the results before I proceed with my program: Range start Z116 type: <class 'pycallnumber.units.callnumbers.lc.LcClass'> Range end Z659 type: <class 'pycallnumber.units.callnumbers.lc.LcClass'> But when I get to the official LC defined ranges that include a first cutter (which as I'm sure you know is not an item-level cutter but still defines the subject) such as: Z116.A2 Treatises on the modern printed book the conversion is to the wrong class: Range start Z116.A2 type: <class 'pycallnumber.units.callnumbers.lc.LC'> I'm not sure how you can programmatically tell the difference between this kind of cutter and the item-level cutter. You might have to hardcode these special cases, which are after all enumerated in all those LCCO pdfs.