1
- import java .io .File ;
2
- import java .io .IOException ;
3
- import java .io .PrintWriter ;
1
+ import java .io .*;
4
2
import java .sql .SQLException ;
5
- import java .util .ArrayList ;
6
- import java .util .HashMap ;
7
- import java .util .Iterator ;
8
- import java .util .List ;
3
+ import java .util .*;
9
4
10
5
import com .google .common .collect .ListMultimap ;
11
6
import dao .TimelineDao ;
@@ -101,20 +96,19 @@ public static void scoreQueryset(QuerySetReader queryset, InvertedImageIndex ind
101
96
System .out .println ("-----------------------------------------------------------------------------" );
102
97
}
103
98
}
104
- /**
105
- * @param args
106
- * @throws IOException
107
- * @throws SQLException
108
- * @throws ClassNotFoundException
109
- */
99
+
110
100
public static void main (String [] args ) throws IOException , ClassNotFoundException , SQLException {
111
- //TODO: read paths from a configuration file; need to set gradlew to accept and parse inputs
112
- String filepath_concept_list = "/data/ntcir2015_lifelogging/Caffe_concepts_list.txt" ;//"/Users/harryscells/data/ntcir2015_lifelogging/Caffe_concepts_list.txt";
101
+
102
+ String propertiesFileName = "config.properties" ;
103
+ Properties properties = new Properties ();
104
+ properties .load (new FileInputStream (propertiesFileName ));
105
+
106
+ String filepath_concept_list = properties .getProperty ("concepts" );
113
107
ConceptVocabulary cv = new ConceptVocabulary ();
114
108
cv .readVocabulary (filepath_concept_list );
115
109
ImageCollection iCollection = new ImageCollection ();
116
110
iCollection .setConceptVocabulary (cv );
117
- String filepath = "/Users/harryscells/data/ntcir2015_lifelogging/NTCIR_Lifelog_Formal_Dataset/NTCIR-Lifelog_Formal_Concepts.txt" ;
111
+ String filepath = properties . getProperty ( "collection" ) ;
118
112
iCollection .readCollection (filepath );
119
113
120
114
System .out .println ("Start indexing" );
@@ -123,13 +117,13 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
123
117
124
118
System .out .println ("Setting up a timelineDao" );
125
119
TimelineDao timelineDao = new TimelineDao ("jdbc:mysql://localhost:3306/" , "NTCIRLifelogging" , "root" , null );
126
- timelineDao .loadTimeline ("/Users/harryscells/data/ntcir2015_lifelogging/NTCIR_Lifelog_Formal_Dataset/NTCIR-Lifelog_Formal_dataset.xml" );
120
+ timelineDao .loadTimeline (properties . getProperty ( "dataset" ) );
127
121
System .out .println ("... timelineDao finished" );
128
122
129
- PrintWriter writer = new PrintWriter ("/data/ntcir2015_lifelogging/runs/run1.txt" , "UTF-8" ); //"/Users/harryscells/data/ntcir2015_lifelogging/run1.txt" , "UTF-8");
123
+ PrintWriter writer = new PrintWriter (properties . getProperty ( "output" ) , "UTF-8" );
130
124
131
125
QuerySetReader queryset = new QuerySetReader ();
132
- queryset .readQueryFile ("data/lifelogging_topics_formal.xml" ); //("data/lifelogging_topics_dryrun.xml" );
126
+ queryset .readQueryFile (properties . getProperty ( "topics" ) );
133
127
scoreQueryset (queryset , index , iCollection , timelineDao , writer , 100 );
134
128
writer .close ();
135
129
}
0 commit comments