# File lib/text/hyphen/language.rb, line 39
  def patterns(pats = nil)
    return @patterns if pats.nil?

    @patterns = {
      :both   => {}, 
      :start  => {},
      :stop   => {},
      :hyphen => {}
    }

    plist = pats.split($/).map { |ln| ln.gsub(%r{%.*$}, '') }
    plist.each do |line|
      line.split.each do |word|
        next if word.empty?

        start = stop = false

        start = true if word.sub!(WORD_START_RE, '')
        stop  = true if word.sub!(WORD_END_RE, '')

        # Insert zeroes and start with some digit
        word.gsub!(ZERO_INSERT_RE) { "#{$1}0" }
        word.gsub!(ZERO_START_RE, "0")

        # This assumes that the pattern lists are already in lowercase
        # form only.
        tag   = word.gsub(DIGIT_RE, '')
        value = word.gsub(NONDIGIT_RE, '')

        if start and stop
          set = :both
        elsif start
          set = :start
        elsif stop
          set = :stop
        else
          set = :hyphen
        end

        @patterns[set][tag] = value
      end
    end

    true
  end