def countWords(text: String) = text.split(" ").map(_.toLowerCase).groupBy(identity).mapValues(_.size)
Uso:
scala> countWords("What I would do to see what you would do when I see what everybody would do")
res8: scala.collection.immutable.Map[String,Int] = Map(what -> 3, would -> 3, do -> 3, everybody -> 1, i -> 2, to -> 1, you -> 1, see -> 2, when -> 1)