RE: Separating index terms

2005-05-31 Thread Ian . Hamilton
Amin,

This should do the trick:

my @keywords = split(/[]+/,$keywords );

Ian

_
Ian Hamilton 
Library Systems Administrator
European Commission - Directorate General for Education and Culture 
EAC C4 - Central Library Unit 
* +32-2-295.24.60 (direct phone) 
* +32-2-299.91.89 (fax)
 http://europa.eu.int/comm/dgs/education_culture/index_en.htm
 http://europa.eu.int/comm/libraries/index.htm
 http://europa.eu.int/eclas/

-Original Message-
From: Saiful Amin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 31, 2005 2:32 PM
To: perl4lib@perl.org
Subject: Separating index terms


Hi all,

I'm doing some data cleaning for MARC data. The MARC export I got from a 
legacy system has field 653 in following format:
$a FinanceFinance personalFinancial planningLiquidity management

I want to create repeatable field separating the individual index terms.

my $tag_653 = $record-field('653');
$record-delete_field('653');

my $keywords = $tag_653-subfield('a');

/*** I'm lost here (How do I separate keywords trapped in '' ?)**/ 

foreach $keyword (@keywords) {
$record-append_fields( MARC::Field-new('653',0,'',
'a' = $keyword
);
}

Can someone please help me out? Thanks in advance.

Regards,
Saiful

-- 
Saiful Amin
Information Specialist
Edutech India
8 Khader Nawaz Khan Road
Chennai 66, India
Tel: +91 44 2833 0999
GSM: +91 98407 76214
Fax: +91 44 2833 1777
www.edutechindia.com http://www.edutechindia.com
Enhancing knowledge and skills for success, lifelong.


MARC::Record and UTF-8 Perl version

2005-03-08 Thread Ian . Hamilton
Hi Ed,

 How would people feel about the next version of MARC-Record (perhaps
 a v2.0) which handled utf8 properly and required a modern perl? 

Entirely agree with Michael Doran: Definitely a *good* thing.  
 
 Perhaps if people could respond to the list (or me if you prefer) with
 the version of Perl that you use MARC::Record with I could keep
 tallies and report back to the list.

- I am currently using MARC::Record 1.34 with Perl 5.6.0

- I'll soon be migrating to another machine running Aleph with utf8 data
with Perl 5.8.2
  I will install the latest stable version of MARC::Record on this machine.

Regards, Ian
_
Ian Hamilton 
Library Systems Administrator
European Commission - Directorate General for Education and Culture 
EAC C4 - Central Library Unit 
* +32-2-295.24.60 (direct phone) 
* +32-2-299.91.89 (fax)
 http://europa.eu.int/comm/dgs/education_culture/index_en.htm
   http://europa.eu.int/comm/libraries/index.htm
 http://europa.eu.int/eclas/


RE: Customising MARC::Lint LintAdditions/ErrorChecks

2004-11-10 Thread Ian . Hamilton
Bryan wrote: Your modifications look interesting
I would suggest you post about them on the Perl4Lib discussion list

Bryan,
 
Following your suggestion I'm copying our recent corresponence on this to
the list.
 
Like you I need a bit of time to implment my ideas on this - we're just
about to launch into a major migration after selection of a new ILMS.

My intention is to reimplement your AACR2 043, 245, 260, 300 et al. field
and subfield checks via a modified version of Lint.pm with an extended rule
set (this will involve modification to the parsing of rules) + code to
indicate the next subfield, etc. As far as possible only cross-field checks
would be implemented via the custom check_xxx routines (which would pass a
Record object reference for this purpose).

This should facilitate maintenance/extension of the detailed AACR data
checking you've contributed.
When I've implemented this I'll post it to the list.

Examples of the lines I'm thinking along (based on your checks):

[Field level rules for 245]

MandatorySubfields=a
FirstSubfield=a
LastChars='.'

[NextSubfield rules]
LastCharsBeforeSubfield=c='/'   # 245
LastCharsBeforeSubfield=a=' ;'  # 260
LastCharsBeforeSubfield=c=','   # 260
LastCharsBeforeSubfield=b=' :'  # 300
LastCharsBeforeSubfield=c=' ;'  # 300
LastCharsBeforeSubfield=e=' +'  # 300

[SubfieldLength rules]
MinLength=7 # 043
MaxLength=7 # 043

Regards, Ian

_
Ian Hamilton 
Library Systems Administrator
European Commission - Directorate General for Education and Culture 
EAC D3 - Central Library Unit 
* +32-2-295.24.60 (direct phone) 
* +32-2-299.91.89 (fax)
*  http://europa.eu.int/eclas/


-Original Message-
From: Bryan Baldus [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 4:53 PM
To: HAMILTON Ian (EAC); Bryan Baldus
Cc: BREAM Carol (EAC)
Subject: RE: Customising MARC::Lint  LintAdditions/ErrorChecks


Your modifications look interesting. I would suggest you post about them on
the Perl4Lib discussion list or contact Andy Lester? (and Ed Summers?)
directly to see about having the changes to Lint integrated into the
official version. I am interested in joining the MARC::Record developers,
but am still waiting for more information about that. I've been working on
other things lately, so I haven't had time yet to rework Lintadditions to
fit into Lint. Perhaps by the end of the year.

Thank you,

Bryan Baldus
Cataloger
Quality Books Inc.
The Best of America's Independent Presses
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 05, 2004 10:15 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Customising MARC::Lint  LintAdditions/ErrorChecks



Bryan,

I've been working on customisng Lint.pm via a package I've called MyLint -
quite a few of the checks are based on the data validation logic in your
Lintadditions/ErrorChecks packages.
This is work in progress, but I'm already keeping you informed in case the
OOP perl approach is relevant to your work.

My implementation approach has been to modify Lint.pm as follows:

sub check_record

- I added a call a routine (for every field) to do leading/trailing space,
repeated spaces, commas, etc. checks 
  (aacr_checker: defined in MyLint.pm - the name is not very logical - just
the first thing I thought of)
#BEGIN MODIF
my $aacr_checker = 'aacr_check'; 
if ( $self-can( $aacr_checker ) ) {
$self-$aacr_checker($tagno,$code,$data);
}
#END MODIF  

- two modifs to the calling of custom check_XXX functions:
(NB The first modifn. is only necessary if no rules have been
defined for these control fields, 
so this should disappear when I've had time to look more closely at
your control field rules)
1) Repositioned before the following line
my $tagrules = $rules-{$tagno} or next;
  within loop to allow e.g. check_008

2) I've added an additional argument to the check_xxx calls: the
MARC::Record object ref
   to allow cross-field checking, while remaining within the Lint
structure.
  This allows you to do $record-filed('yyy') calls within the
check_xxx routine.
# MODIF
# call custom checks here to allow checks on fields without rules 
# add MARC::Record object ref to allow cross-field checking
# Check to see if a check_xxx() function exists, and call it
on the field if it does
my $checker = check_$tagno;
if ( $self-can( $checker ) ) {
$self-$checker($marc, $field);
}
# /MODIF

You'll find attached:

marclint.pl which uses a MARC::MyLint object (inheriting from the Lint
class) to do the checking and write out an HTML report
Lint.pm (modifications are indicated as shown above)
MyLint.pm

Best Regards, Ian Hamilton (I'm on holiday

Customising MARC::Lint - reading/parsing rules

2004-11-02 Thread Ian . Hamilton
Does anybody (Andy Lester ?) know of any documentation on the read rules,
parse rules functions in Lint.pm - I've looked at the code which has some
useful comments, but some aspects still escape me.

I'd like to adopt a similar approach as I develop my customised Lint checks
- if any one out there has some examples of a similar OO rule-based approach
or documentation of same I'd be very interested.

Ian H.

PS The MARC modules are really great, not only functionally but also as
examples of Perl OOP style. I'm finding them very useful in my day to day
work.

_ 
Ian Hamilton 
Library Systems Administrator 
European Commission - Directorate General for Education and Culture
EAC D3 - Central Library Unit
 +32-2-295.24.60 (direct phone)
 +32-2-299.91.89 (fax)
http://europa.eu.int/eclas/