211
|
1 |
|
|
2 |
import io.Source
|
|
3 |
import scala.util._
|
|
4 |
|
403
|
5 |
import M2._
|
284
|
6 |
|
211
|
7 |
def urban_get_csv_file(name: String) : List[String] = {
|
379
|
8 |
val csv = Source.fromFile(name)("ISO-8859-1")
|
211
|
9 |
csv.mkString.split("\n").toList.drop(1)
|
|
10 |
}
|
|
11 |
|
|
12 |
val urban_ratings = urban_get_csv_file("ratings.csv")
|
|
13 |
val urban_movies = urban_get_csv_file("movies.csv")
|
|
14 |
|
422
|
15 |
val urban_res1 = process_ratings(urban_ratings)
|
|
16 |
val urban_rat_elems = List(("1","1"), ("1","3"), ("1","6"), ("1","47"))
|
211
|
17 |
|
422
|
18 |
assert(urban_res1.length == 48580)
|
|
19 |
assert(urban_rat_elems.forall(urban_res1.contains(_)))
|
211
|
20 |
|
|
21 |
assert(process_movies(urban_movies).length == 9742)
|