def marc_lcc_to_broad_category( options = {}, spec="050a:060a:090a:096a")
      # Trying to match things that look like LCC, and not match things
      # that don't. Is tricky.
      lcc_regex = LCC_REGEX
      default_value = options.has_key?(:default) ? options[:default] : "Unknown"
      translation_map = Traject::TranslationMap.new("lcc_top_level")

      extractor = MarcExtractor.new(spec, :separator => nil)

      lambda do |record, accumulator|
        candidates = extractor.extract(record)

        candidates.reject! do |candidate|
          !(lcc_regex.match candidate)
        end

        accumulator.concat translation_map.translate_array!(candidates.collect {|a| a.lstrip.slice(0, 1)}).uniq

        if default_value && accumulator.empty?
          accumulator << default_value
        end
      end
    end
def marc_lcc_to_broad_category( options = {}, spec="050a:060a:090a:096a")
      # Trying to match things that look like LCC, and not match things
      # that don't. Is tricky.
      lcc_regex = LCC_REGEX
      default_value = options.has_key?(:default) ? options[:default] : "Unknown"
      translation_map = Traject::TranslationMap.new("lcc_top_level")

      extractor = MarcExtractor.new(spec, :separator => nil)

      lambda do |record, accumulator|
        candidates = extractor.extract(record)

        candidates.reject! do |candidate|
          !(lcc_regex.match candidate)
        end

        accumulator.concat translation_map.translate_array!(candidates.collect {|a| a.lstrip.slice(0, 1)}).uniq

        if default_value && accumulator.empty?
          accumulator << default_value
        end
      end
    end
Looks up Library of Congress Classification (LCC) or NLM Medical Subject Headings (MeSH)
 from usual parts of the marc record. Maps them to high-level broad categories,
 basically just using the first part of the LCC. Note it's just looking in bib-level
 locations for LCCs, you're on your own with holdings.

 Sanity checks to make sure the thing looks like an LCC with a regex, before
 mapping.

 Will call it 'Unknown' if it's got nothing else, or pass in :default => something else,
 or nil.

 The categories output aren't great, but they're something.