/** * prints the current settings to a file with the same name as the current * results file. This assists in tracing the settings used to generate a * given run. */ public void printSettings(final SearchRequest default_q, final String[] topicsFiles, final String otherComments) { try { OutputStream bos = Files.writeFileStream(resultsFilename.replaceFirst("\\.res(\\.\\w+)?$", ".res") + ".settings"); ApplicationSetup.getUsedProperties().store( bos, " Settings of Terrier (TRECQuerying) generated for run " + resultsFilename); PrintWriter pw = new PrintWriter(bos); if (topicsFiles != null) for (String f : topicsFiles) pw.println("# topicfile: " + f); Map<String, String> defaultcontrols = new HashMap<>(default_q.getControls()); defaultcontrols.putAll(super.controls); for (Map.Entry<String,String> kv : defaultcontrols.entrySet()) { pw.println(String.format("# control: %s=%s", kv.getKey(), kv.getValue())); } pw.println(otherComments); pw.close(); logger.info("Settings of Terrier written to " + resultsFilename + ".settings"); } catch (IOException ioe) { logger.warn("Couldn't write settings out to disk in TRECQuerying (.res.settings)", ioe); } }
/** * prints the current settings to a file with the same name as the current * results file. This assists in tracing the settings used to generate a * given run. */ public void printSettings(final SearchRequest default_q, final String[] topicsFiles, final String otherComments) { try { OutputStream bos = Files.writeFileStream(resultsFilename.replaceFirst("\\.res(\\.\\w+)?$", ".res") + ".settings"); ApplicationSetup.getUsedProperties().store( bos, " Settings of Terrier (TRECQuerying) generated for run " + resultsFilename); PrintWriter pw = new PrintWriter(bos); if (topicsFiles != null) for (String f : topicsFiles) pw.println("# topicfile: " + f); Map<String, String> defaultcontrols = new HashMap<>(default_q.getControls()); defaultcontrols.putAll(super.controls); for (Map.Entry<String,String> kv : defaultcontrols.entrySet()) { pw.println(String.format("# control: %s=%s", kv.getKey(), kv.getValue())); } pw.println(otherComments); pw.close(); logger.info("Settings of Terrier written to " + resultsFilename + ".settings"); } catch (IOException ioe) { logger.warn("Couldn't write settings out to disk in TRECQuerying (.res.settings)", ioe); } }