lib/marc_cleanup/bib_rubymarc_fixes.rb
### Replaces obsolete values with the current value;
#     if encoding level, cataloging form or multipart indicators
#     are outside accepted values, replace them with 'unknown'
#     normalize the indicator length and subfield code length to 2;
#     make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value;
if encoding level, cataloging form or multipart indicators
are outside accepted values, replace them with 'unknown'
normalize the indicator length and subfield code length to 2;
make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value ; if encoding level cataloging form or multipart indicators are outside accepted values replace them with ' unknown ' normalize the indicator length and subfield code length to 2 ; make the last 4 positions the only possible value of ' 4500 '
def fix_book_008(field)
    fixed_field = ''
    illus = field[0..3]
    audience = field[4]
    item_form = field[5]
    contents = field[6..9]
    gov_pub = field[10]
    conf_pub = field[11]
    festschrift = field[12]
    index_code = field[13]
    lit_form = field[15]
    biog = field[16]
    unless illus == '||||'
      illus_chars = illus.chars.select { |c| %w[a b c d e f g h i j k l m o p].include? c }.sort.join('')
      illus = illus_chars.ljust(4)
    end
    fixed_field << illus
    audience.gsub!(/[uv]/, 'j')
    fixed_field << audience
    fixed_field << item_form
    contents = fix_contents_chars(contents)
    fixed_field << contents
    gov_pub.gsub!('n', 'o')
    fixed_field << gov_pub
    fixed_field << conf_pub
    fixed_field << festschrift
    fixed_field << index_code
    fixed_field << ' '
    lit_form.gsub!(' ', '0')
    fixed_field << lit_form
    fixed_field << biog
    fixed_field.gsub('-', '|')
  end
def fix_book_008 ( field ) fixed_field = '' illus = field [ 0 .. 3 ] audience = field [ 4 ] item_form = field [ 5 ] contents = field [ 6 .. 9 ] gov_pub = field [ 10 ] conf_pub = field [ 11 ] festschrift = field [ 12 ] index_code = field [ 13 ] lit_form = field [ 15 ] biog = field [ 16 ] unless illus == '||||' illus_chars = illus . chars . select { | c | %w[ a b c d e f g h i j k l m o p ] . include? c } . sort . join ( '' ) illus = illus_chars . ljust ( 4 ) end fixed_field << illus audience . gsub! ( / [uv] / , 'j' ) fixed_field << audience fixed_field << item_form contents = fix_contents_chars ( contents ) fixed_field << contents gov_pub . gsub! ( 'n' , 'o' ) fixed_field << gov_pub fixed_field << conf_pub fixed_field << festschrift fixed_field << index_code fixed_field << ' ' lit_form . gsub! ( ' ' , '0' ) fixed_field << lit_form fixed_field << biog fixed_field . gsub ( '-' , '|' ) end
Replaces obsolete values with the current value;
if encoding level, cataloging form or multipart indicators
are outside accepted values, replace them with 'unknown'
normalize the indicator length and subfield code length to 2;
make the last 4 positions the only possible value of '4500'
Replaces obsolete values with the current value ; if encoding level cataloging form or multipart indicators are outside accepted values replace them with ' unknown ' normalize the indicator length and subfield code length to 2 ; make the last 4 positions the only possible value of ' 4500 '
field