def quantify( phrase, number=0, args={} )
num = number.to_i
config = QuantifyDefaults.merge( args )
case num
when 0
no( phrase )
when 1
a( phrase )
when SeveralRange
"several " + plural( phrase, num )
when NumberRange
"a number of " + plural( phrase, num )
when NumerousRange
"numerous " + plural( phrase, num )
when ManyRange
"many " + plural( phrase, num )
else
thousands, subthousands = Math::log10( num ).to_i.divmod( 3 )
stword =
case subthousands
when 2
"hundreds"
when 1
"tens"
else
nil
end
thword = plural( to_thousands(thousands).strip )
thword = nil if thword.empty?
[
stword,
thword,
plural(phrase, number)
].compact.join( config[:joinword] )
end
end