Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def flip[A,B]: (A,B) => (B,A) = { case (k,v) => (v,k) }
- val word_count = words map {sentWords => sentWords map (w => (w.toLowerCase,1))} flatMap {ws => ws} reduceByKey (_ + _) map { case (k,v) => (v,k) } //works ok
- val word_count = words map {sentWords => sentWords map (w => (w.toLowerCase,1))} flatMap {ws => ws} reduceByKey (_ + _) map flip //doesnt work
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement