Sha256: 092bbafa8507ad312dc67c6b74091a59efe03e03226d456dbbe35a082757bfdb
Contents?: true
Size: 343 Bytes
Versions: 270
Compression:
Stored size: 343 Bytes
Contents
object WordCount { fun phrase(phrase: String): Map<String, Int> { val withoutPunctuation = phrase.toLowerCase().replace(Regex("[^\\w']"), " ").trim() val words = withoutPunctuation.split(Regex("\\s+")) val groupedWords = words.groupBy({ w -> w }) return groupedWords.mapValues({ it.value.size }) } }
Version data entries
270 entries across 270 versions & 1 rubygems