Parsing LC call numbers?

From: Rob Dumas <robdumas_at_nyob>
Date: Fri, 28 Aug 2015 10:03:06 -0500
To: CODE4LIB_at_LISTSERV.ND.EDU
Several years ago, I wrote a simple report generator for MPOW which broke
down our daily list of items to send to other branches into separate
reports. I'm looking to refactor it and one of my big targets is to make
the collection/call number smarter.

Right now, it treats an LC call number as a simple string, so I can do some
simple searches against it (e.g., "coll. HERITAGE", call number starts with
"P"), but this has some limitations. For example, when I select a range, I
can't sort by the numeric part, which means that an item PN6728 will appear
in the list before an item from PN704.

Does anyone know of a decent script (preferably Python or Ruby) which will
break the call number down into an array (or other set) of values (e.g.,
PN6728.S4546F73 2015 v.2 coll. GRAPHICNOVELS would become ["PN", 6728, "S",
4546, "F", 73, 2015, "2", "GRAPHICNOVELS"])? This way, I could have
granular control over sorting by call number.

---
Rob D.
robdumas_at_gmail.com
Received on Fri Aug 28 2015 - 11:08:49 EDT