Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def flip[A,B]: (A,B) => (B,A) = { case (k,v) => (v,k) }
  2.  
  3. val word_count = words map {sentWords => sentWords map (w => (w.toLowerCase,1))} flatMap {ws => ws} reduceByKey (_ + _) map { case (k,v) => (v,k) } //works ok
  4.  
  5. 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