-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovieRunnerWithFilters.java
195 lines (161 loc) · 8.73 KB
/
MovieRunnerWithFilters.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
import java.util.ArrayList;
public class MovieRunnerWithFilters {
public void printAverageRatings(){
System.out.println("I am in MovieRunner With Filters");
FourthRatings sr = new FourthRatings();
//ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//SecondRatings sr = new SecondRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratedmovies_short.csv", "C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings_short.csv");
//int numOfMovies = sr.getMovieSize();
//int numOfRaters = sr.getRaterSize();
int numOfRaters = 0;
//System.out.println("No of Movies:"+ numOfMovies);
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Fourth Ratings:"+ movieSize);
ArrayList<Rating> aveRating = sr.getAverageRatings(35);
System.out.println("Found Average Ratings "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getTitle(rater.getItem()));
}*/
}
public void printAverageRatingsByYear() {
//Create a Third Rating Object
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter(20, new YearAfterFilter(2000));
System.out.println("Found by year "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getTitle(rater.getItem()));
}*/
// TODO Auto-generated method stub
}
public void printAverageRatingsByGenre() {
//Create a Third Rating Object
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
String genre = "Comedy";
GenreFilter genrefiler = new GenreFilter(genre);
int miniRatings = 20;
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter (miniRatings, genrefiler);
//System.out.println("Total movie have above " + miniRatings + " ratings: " + aveRating.size());
System.out.println("Found By Genre "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getTitle(rater.getItem()));
System.out.println(" "+MovieDatabase.getGenres(rater.getItem()));
}*/
}
public void printAverageRatingsByMinutes() {
//Create a Third Rating Object
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
int minTime = 105;
int maxTime= 135;
MinutesFilter minMaxFilter = new MinutesFilter(minTime,maxTime);
int miniRatings = 5;
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter (miniRatings, minMaxFilter);
//System.out.println("Total movie have above " + miniRatings + " ratings: " + aveRating.size());
System.out.println("Found with Minutes "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" Time: "+MovieDatabase.getMinutes(rater.getItem())+" "+MovieDatabase.getTitle(rater.getItem()));
//System.out.println(" "+MovieDatabase.getMinutes(rater.getItem()));
}*/
}
public void printAverageRatingsByDirector() {
//Create a Third Rating Object
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
String director = "Clint Eastwood,Joel Coen,Martin Scorsese,Roman Polanski,Nora Ephron,Ridley Scott,Sydney Pollack";
DirectorsFilter directorFilter = new DirectorsFilter(director);
int miniRatings = 4;
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter (miniRatings, directorFilter);
//System.out.println("Total movie have above " + miniRatings + " ratings: " + aveRating.size());
System.out.println("Found By Director "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getTitle(rater.getItem()));
System.out.println(" "+MovieDatabase.getDirector(rater.getItem()));
}*/
}
public void printAverageRatingsByDirectorsAndMinutes(){
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
AllFilters allfilter= new AllFilters();
String director = "Clint Eastwood,Joel Coen,Tim Burton,Ron Howard,Nora Ephron,Sydney Pollack";
allfilter.addFilter(new DirectorsFilter(director));
int minTime = 90;
int maxTime= 180;
allfilter.addFilter(new MinutesFilter(minTime,maxTime));
int miniRatings = 3;
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter (miniRatings, allfilter);
System.out.println("Found by Director and Minutes "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getMinutes(rater.getItem()) +" "+MovieDatabase.getTitle(rater.getItem()));
System.out.println(" "+MovieDatabase.getDirector(rater.getItem()));
}*/
}
public void printAverageRatingsByYearAfterAndGenre(){
ThirdRatings sr = new ThirdRatings("C:/Users/aw634c/newJava/workspace/MovieRecommender/src/data/ratings.csv");
//Get the Number of raters
int numOfRaters = sr.getRaterSize();
System.out.println("No of Raters from Third Ratings:"+ numOfRaters);
MovieDatabase.initialize("ratedmoviesfull.csv");
int movieSize = MovieDatabase.size();
System.out.println("No of Movies Found from Third Ratings:"+ movieSize);
AllFilters allfilter= new AllFilters();
allfilter.addFilter(new YearAfterFilter(1990));
allfilter.addFilter(new GenreFilter("Drama"));
int miniRatings = 8;
ArrayList<Rating> aveRating = sr.getAverateRatingsByFilter (miniRatings, allfilter);
System.out.println("Found year and Genre "+aveRating.size()+" movies");
//String movieTitle = "Maze Runner";
//System.out.println("Size above 20 "+aveRating.size());
/*for (Rating rater:aveRating){
//System.out.println(rater.getItem());
System.out.println(rater.getValue()+" "+MovieDatabase.getYear(rater.getItem()) +" "+MovieDatabase.getTitle(rater.getItem()));
System.out.println(" "+MovieDatabase.getGenres(rater.getItem()));
}*/
}
}