Skip to content

Tag: Callnumbers

Help me test yet another LC Callnumber parser

Those who have followed this blog and my code for a while know that I have a long, slightly sad, and borderline abusive relationship with Library of Congress call numbers. They’re a freakin’ nightmare. They just are. But, based on the premise that Sisyphus was a quitter, I took another stab at it, this time writing a real (PEG-) parser instead of trying to futz with extended regular expressions. The results, so far, aren’t too bad. The gem is called lc_callnumber, but more importantly, I’ve put together a little heroku app to let you play with it, and then correct…

Comments closed

Normalizing LoC Call Numbers for sorting

Updated: I missed a ‘?’ in the original code that pushed a single cutter into the second-cutter position. Fixed below. Crap. Update 2: Initial letters can be three characters long. Regexp and output changed. LoC Call numbers tend to be a mess, and I’ve been working this morning trying to normalize them for easy string comparison. The perl function below takes a call number (with some level of sloppiness) and returns a string suitable for comparisons with other strings returned by the function. It outputs stuff like this: E E 0000.0000 0000 0000 E 184 .A1 G78 E 0184.0000A 1000G…

Comments closed