author | Christian Urban <christian.urban@kcl.ac.uk> |
Mon, 08 Nov 2021 02:20:35 +0000 | |
changeset 410 | 5bc7183e865e |
parent 403 | ffce7b61b446 |
child 422 | 217bbd700594 |
permissions | -rw-r--r-- |
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 |
||
15 |
||
16 |
assert(process_ratings(urban_ratings).length == 48580) |
|
17 |
||
18 |
assert(process_movies(urban_movies).length == 9742) |
|
19 |
||
20 |