package com.fuxi.zji
object Ten4 {
def main(args: Array[String]): Unit = {
val words = """Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries."""
val w = Array(words).toBuffer
println(w)
println("======================================")
val x = w.flatMap(_.split(" ")).map((_,1)).groupBy(_._1).map(t=>(t._1,t._2.size))
x.foreach(kv=>println(kv._1,kv._2))
println(x)
}
}
scala 词频统计
最新推荐文章于 2024-11-27 15:39:28 发布