Skip to content

Commit 8ef0b4e

Browse files
committed
minor changes
1 parent 14d667c commit 8ef0b4e

4 files changed

Lines changed: 30 additions & 6 deletions

File tree

src/common/Bookmark.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ public class Bookmark implements Comparable<Bookmark> {
3737
private String timestamp;
3838
private List<Integer> tags;
3939

40-
private double rating;
4140
private List<Integer> categories;
4241

42+
private double rating;
43+
private String title;
44+
4345
public Bookmark(int userID, int wikiID, String timestamp) {
4446
this.userID = userID;
4547
this.resID = wikiID;
4648
this.timestamp = timestamp;
4749

48-
this.rating = -2.0;
4950
this.categories = new ArrayList<Integer>();
5051
this.tags = new ArrayList<Integer>();
52+
53+
this.rating = -2.0;
54+
this.title = null;
5155
}
5256

5357
@Override
@@ -99,6 +103,14 @@ public void setRating(double rating) {
99103
this.rating = rating;
100104
}
101105

106+
public String getTitle() {
107+
return this.title;
108+
}
109+
110+
public void setTitle(String title) {
111+
this.title = title;
112+
}
113+
102114
public List<Integer> getCategories() {
103115
return this.categories;
104116
}

src/file/BookmarkReader.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ public boolean readFile(String filename) {
131131

132132
// TODO ----------------------
133133
// extend common/Bookmark class with fields for title (= lineParts[6]) and description (= lineParts[7])
134+
if (lineParts.length > 6) { // is there a rating?
135+
try {
136+
userData.setTitle(lineParts[5].replace("\"", ""));
137+
} catch (Exception e) { /* do nothing */ }
138+
}
134139
}
135140
processUserData(userID, userData, tags, categories, wikiID); // last user
136141
br.close();

src/file/BookmarkSplitter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ public static boolean writeSample(BookmarkReader reader, List<Bookmark> userSamp
220220
bw.write("\"");
221221
if (bookmark.getRating() != -2) {
222222
bw.write(";\"" + bookmark.getRating() + "\"");
223+
} else {
224+
bw.write("\"\"");
225+
}
226+
if (bookmark.getTitle() != null) {
227+
bw.write(";\"" + bookmark.getTitle() + "\"");
228+
} else {
229+
bw.write("\"\"");
223230
}
224231
bw.write("\n");
225232
}

src/test/Pipeline.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public class Pipeline {
8787
// placeholder for the topic posfix
8888
private static String TOPIC_NAME = null;
8989
// placeholder for the used dataset
90-
private final static String DATASET = "del";
91-
private final static String SUBDIR = "/ipm3";
90+
private final static String DATASET = "twitter";
91+
private final static String SUBDIR = "";//"/ipm3";
9292

9393
public static void main(String[] args) {
9494
System.out.println("TagRecommender:\n" + "" +
@@ -113,14 +113,14 @@ public static void main(String[] args) {
113113
//TagReuseProbAnalyzer.analyzeSample(path, TRAIN_SIZE, TEST_SIZE, false);
114114

115115
//evaluate(dir, path, "pitf", TOPIC_NAME, true, true, null);
116-
//try { getStatistics("bib_core/vedran/bib_bibtex_2_perc_1", false); } catch (Exception e) { e.printStackTrace(); }
116+
//try { getStatistics("twitter_core/seedUserTweets", false); } catch (Exception e) { e.printStackTrace(); }
117117

118118
//JSONProcessor.writeJSONOutput("bib_core/vedran/bib_bibtex_2_perc_1");
119119

120120
//evaluateAllTagRecommenderApproaches(dir, path);
121121
//startAllTagRecommenderApproaches(dir, path, true);
122122
//getTrainTestStatistics(path);
123-
//BookmarkSplitter.splitSample(DATASET + "_core/twitter", DATASET + "_core/" + DATASET + "_sample", 1, 0, true);
123+
//BookmarkSplitter.splitSample("twitter_core/seedUserTweets", "twitter_core/twitter_sample", 1, 0, true);
124124
//BookmarkSplitter.drawUserPercentageSample("bib_core/vedran/bib_bibtex", 5);
125125
//createLdaSamples("ml_core/core1/ml_sample", 1, 1000, true, true);
126126

0 commit comments

Comments
 (0)