Created
March 23, 2019 19:08
-
-
Save adekunleba/ebacc4b0767298a5d0edb0bfb1194e60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val split :RDD[String] = rdd.flatMap(_.split(" ")) | |
val trim :RDD[String] = split.map(_.trim.toLowerCase) | |
val stopwordsRemoved = trim.filter( x => !Set("and", "the", "is", "to", "she", "he").contains(x)) | |
val assignOne = stopwordsRemoved.map((_, 1)) | |
val counts = assignOne.reduceByKey(_ + _) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment