Re: Parsing LC call numbers?

From: William Denton <wtd_at_nyob>
Date: Fri, 28 Aug 2015 11:35:01 -0400
To: CODE4LIB_at_LISTSERV.ND.EDU
On 28 August 2015, Rob Dumas wrote:

> 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.

I know of two Ruby gems that sort LC for you.  There's one Bill Dueber created 
and I hacked a bit:

    https://github.com/billdueber/lc_callnumber

and then there's this more recent one I saw mentioned on Planet Code4Lib a day 
or two ago:

    https://github.com/pulibrary/lcsort

I haven't tried it and don't know how it relates to the first, but if you want a 
Ruby approach, those should help.

Bill
-- 
William Denton ↔  Toronto, Canada ↔  https://www.miskatonic.org/
Received on Fri Aug 28 2015 - 11:35:11 EDT