Java File Save saveTrecOneEntry(BufferedWriter trecFile, String topicId, String docId, int docPos, float score, String runId)

Here you can find the source of saveTrecOneEntry(BufferedWriter trecFile, String topicId, String docId, int docPos, float score, String runId)

Description

Save positions, scores, etc information for a single retrieved documents.

License

Apache License

Parameter

Parameter Description
trecFile an object used to write to the output file.
topicId a question ID.
docId a document ID of the retrieved document.
docPos a position in the result set (the smaller the better).
score a score of the document in the result set.
runId a run ID.

Exception

Parameter Description
IOException an exception

Declaration

private static void saveTrecOneEntry(BufferedWriter trecFile, String topicId, String docId, int docPos,
        float score, String runId) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.BufferedWriter;
import java.io.IOException;

public class Main {
    protected static final String NL = System.getProperty("line.separator");

    /**/*from  w  w  w. j  ava2s  . com*/
     * Save positions, scores, etc information for a single retrieved documents.
     * 
     * @param trecFile    an object used to write to the output file.
     * @param topicId     a question ID.
     * @param docId       a document ID of the retrieved document.
     * @param docPos      a position in the result set (the smaller the better).
     * @param score       a score of the document in the result set.
     * @param runId       a run ID.
     * @throws IOException
     */
    private static void saveTrecOneEntry(BufferedWriter trecFile, String topicId, String docId, int docPos,
            float score, String runId) throws IOException {
        trecFile.write(String.format("%s\tQ0\t%s\t%d\t%f\t%s%s", topicId, docId, docPos, score, runId, NL));
    }
}

Related

  1. saveIntArray(int[] array, PrintStream out)
  2. SaveIntFile(int[] list, String filename)
  3. saveStreamAsString(InputStream is)
  4. saveStringDoubleMap(Map map, int dim, PrintStream out)
  5. saveToInputStream(ByteArrayInputStream in, OutputStream out)