Horizon "reconst" in Perl

Apologies to everyone who was interested in this for the delay in getting it posted!

The Horizon database stores several fields (e.g. title, author, etc) in the format “processed” / “reconst”, where the “processed” column contains the text stripped of punctuation and the indefinite/definite article, and “reconst” contains the stripped characters.

For example, the title “The great Aussie fashion : Australian fashion designers 1984-1985 /” is stored in Horizon as:

processed:
    great Aussie fashion Australian fashion designers 1984 1985
reconst:
    <M /7R-M: MThe

The “processed” version of the title is much more suitable for sorting than the original title.

Browsing through the Horizon mailing list archive, I came across a set of instructions for interpreting the “reconst” value.   As we generate a lot of custom HTML reports at Huddersfield, I decided to have a stab at coding the instructions in Perl:

reconstructTitle.txt

To use it in your own Perl script, just paste the subroutine in and call it with the “processed” and “reconst” strings, e.g.:

reconstructTitle( $processed, $reconst );

I’ve only used the code for reconstructing titles so far, but it might also work with author names, call number, etc.

The code is definitely “beta” and I’m not sure if it handles every “reconst” command yet, but feel free to make use of it.  If you can improve it, please do!

Advertisements
3 comments
  1. Alex said:

    We just ran in to an edge case. Some of our items have the same their $processed string equal to their $reconst string. In other words, the title isn’t encoded at all. Until we added a check for that condition however the code always died because it couldn’t recognize the reconstruction rules.

  2. Dave Pattern said:

    Cheers for that, Alex. A bit of guesswork went into the code, so I suspect it’s not capable of handle every scenario 😦

  3. gmcharlt said:

    Just wanted to leave a note thanking you for this bit of code … it saved me quite a bit of time today.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: