# File lib/linguistics/en.rb, line 1045
    def number_to_words( num, config )
        return [config[:zero]] if num.to_i.zero?
        chunks = []

        # Break into word-groups if groups is set
        if config[:group].nonzero?

            # Build a Regexp with <config[:group]> number of digits. Any past
            # the first are optional.
            re = Regexp::new( "(\\d)" + ("(\\d)?" * (config[:group] - 1)) )

            # Scan the string, and call the word-chunk function that deals with
            # chunks of the found number of digits.
            num.to_s.scan( re ) {|digits|
                debug_msg "   digits = #{digits.inspect}"
                fn = NumberToWordsFunctions[ digits.nitems ]
                numerals = digits.flatten.compact.collect {|i| i.to_i}
                debug_msg "   numerals = #{numerals.inspect}"
                chunks.push fn.call( config[:zero], *numerals ).strip
            }
        else
            phrase = num.to_s
            phrase.sub!( /\A\s*0+/, '' )
            mill = 0

            # Match backward from the end of the digits in the string, turning
            # chunks of three, of two, and of one into words.
            mill += 1 while
                phrase.sub!( /(\d)(\d)(\d)(?=\D*\Z)/ ) {
                    words = to_hundreds( $1.to_i, $2.to_i, $3.to_i, mill, 
                                         config[:and] )
                    chunks.unshift words.strip.squeeze(' ') unless words.nil?
                    ''
                }

            phrase.sub!( /(\d)(\d)(?=\D*\Z)/ ) {
                chunks.unshift to_tens( $1.to_i, $2.to_i, mill ).strip.squeeze(' ')
                ''
            }
            phrase.sub!( /(\d)(?=\D*\Z)/ ) {
                chunks.unshift to_units( $1.to_i, mill ).strip.squeeze(' ')
                ''
            }
        end

        return chunks
    end