Rob,
I wrote a script to aide library workers with shelf reading. This
Python script takes an LC call, breaks it into pieces, assigns each
piece to a variable, and "looks" at each piece to determine if it is a
string, integer, or float.
GitHub: https://github.com/pjomara/shelfReader
The script does more than parse call numbers; the "call_parser" and
"splitter" functions are relevant to the need described in your post.
If this suits your need, please let me know if you have questions.
Parker O'Mara
On 8/28/2015 11:03 AM, Rob Dumas wrote:
> 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.
> [log in to unmask]
--
Parker O'Mara, Systems Librarian, SUNY Plattsburgh, (518) 564-5196
|