Method: String#type_token_ratio
- Defined in:
- lib/textstats.rb
#type_token_ratio(downcase = false) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/textstats.rb', line 27 def type_token_ratio(downcase=false) if downcase w = words.map{|w|w.downcase} else w = words end Float(w.uniq.size)/w.size end |