Skip to content

Instantly share code, notes, and snippets.

@mcohen01
Last active December 26, 2015 00:08
Show Gist options
  • Save mcohen01/7061517 to your computer and use it in GitHub Desktop.
Save mcohen01/7061517 to your computer and use it in GitHub Desktop.
top letters
import scala.util.matching.Regex
import sys.process._
val str = "curl http://www.giwersworld.org/computers/linux/common-words.phtml" !!
val pattern = "<pre>[A-Z\n]*</pre>".r
val words = pattern findFirstIn str
words.mkString
.replace("\n", "")
.groupBy(_.toChar)
.mapValues(_.size)
.toList
.sortBy { _._2 }
.reverse
.take(10)
.map { _._1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment