Skip to content

Commit 969f598

Browse files
committed
use a properties file for configuring the file inputs
1 parent 389793f commit 969f598

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

config.properties

Whitespace-only changes.

data/lifelogging_topics_formal.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
<keywords>rugby football television</keywords>
211211
<constraints>at home</constraints>
212212
<mapping>
213-
<concept id="c_852" weight="1" />
213+
<concept id="c_852" weight="1.0" />
214214
</mapping>
215215
</topic>
216216
<topic>

src/java/Run1.java

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import java.io.File;
2-
import java.io.IOException;
3-
import java.io.PrintWriter;
1+
import java.io.*;
42
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.*;
94

105
import com.google.common.collect.ListMultimap;
116
import dao.TimelineDao;
@@ -101,20 +96,19 @@ public static void scoreQueryset(QuerySetReader queryset, InvertedImageIndex ind
10196
System.out.println("-----------------------------------------------------------------------------");
10297
}
10398
}
104-
/**
105-
* @param args
106-
* @throws IOException
107-
* @throws SQLException
108-
* @throws ClassNotFoundException
109-
*/
99+
110100
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");
113107
ConceptVocabulary cv = new ConceptVocabulary();
114108
cv.readVocabulary(filepath_concept_list);
115109
ImageCollection iCollection = new ImageCollection();
116110
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");
118112
iCollection.readCollection(filepath);
119113

120114
System.out.println("Start indexing");
@@ -123,13 +117,13 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
123117

124118
System.out.println("Setting up a timelineDao");
125119
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"));
127121
System.out.println("... timelineDao finished");
128122

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");
130124

131125
QuerySetReader queryset = new QuerySetReader();
132-
queryset.readQueryFile("data/lifelogging_topics_formal.xml");//("data/lifelogging_topics_dryrun.xml");
126+
queryset.readQueryFile(properties.getProperty("topics"));
133127
scoreQueryset(queryset, index, iCollection, timelineDao, writer, 100);
134128
writer.close();
135129
}

src/java/util/InvertedImageIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public List<Image> get() {
106106
}
107107
return ranking;
108108
}
109-
109+
110110
/**
111111
*
112112
* This method allows to search the image collection by querying with a concept

0 commit comments

Comments
 (0)