info.ephyra.trec
Class TREC13To16Parser

java.lang.Object
  extended by info.ephyra.trec.TREC13To16Parser

public class TREC13To16Parser
extends java.lang.Object

A parser for the TREC 13-16 QA tracks.

Version:
2008-02-07
Author:
Nico Schlaefer

Field Summary
private static java.util.ArrayList<java.lang.String> factoidEntries
          Cached log file entries of type "factoid".
private static java.util.ArrayList<java.lang.String> listEntries
          Cached log file entries of type "list".
private static java.util.ArrayList<java.lang.String> otherEntries
          Cached log file entries of type "other".
private static java.lang.String[] REPLACEMENTS
          Replacements for the special characters.
private static java.lang.String[] SPECIALCHARS
          Characters that have to be replaced before parsing an XML document.
 
Constructor Summary
TREC13To16Parser()
           
 
Method Summary
static void dropAllCachedEntries()
          Drops the cached entries of all types.
static void dropCachedFactoidEntries()
          Drops the cached entries of type "factoid".
static void dropCachedListEntries()
          Drops the cached entries of type "list".
static void dropCachedOtherEntries()
          Drops the cached entries of type "other".
static TRECPattern[] loadPatterns(java.lang.String filename)
          Loads patterns for the factoid or list questions from a file.
static Result[] loadResults(java.lang.String question, java.lang.String type, java.lang.String logfile)
          Loads the results for a question from a log file.
static TRECTarget[] loadTargets(java.lang.String filename)
          Loads the target objects from a file.
static boolean saveAnswers(java.lang.String filename, TRECAnswer[] answers, boolean[] correct, java.lang.String runTag)
          Appends answers to an output file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIALCHARS

private static final java.lang.String[] SPECIALCHARS
Characters that have to be replaced before parsing an XML document.


REPLACEMENTS

private static final java.lang.String[] REPLACEMENTS
Replacements for the special characters.


factoidEntries

private static java.util.ArrayList<java.lang.String> factoidEntries
Cached log file entries of type "factoid".


listEntries

private static java.util.ArrayList<java.lang.String> listEntries
Cached log file entries of type "list".


otherEntries

private static java.util.ArrayList<java.lang.String> otherEntries
Cached log file entries of type "other".

Constructor Detail

TREC13To16Parser

public TREC13To16Parser()
Method Detail

dropCachedFactoidEntries

public static void dropCachedFactoidEntries()
Drops the cached entries of type "factoid".


dropCachedListEntries

public static void dropCachedListEntries()
Drops the cached entries of type "list".


dropCachedOtherEntries

public static void dropCachedOtherEntries()
Drops the cached entries of type "other".


dropAllCachedEntries

public static void dropAllCachedEntries()
Drops the cached entries of all types.


loadTargets

public static TRECTarget[] loadTargets(java.lang.String filename)
Loads the target objects from a file.

Parameters:
filename - file that contains the targets
Returns:
targets or null, if the file could not be parsed

loadPatterns

public static TRECPattern[] loadPatterns(java.lang.String filename)
Loads patterns for the factoid or list questions from a file.

Parameters:
filename - file that contains the patterns
Returns:
patterns or null, if the file could not be parsed

loadResults

public static Result[] loadResults(java.lang.String question,
                                   java.lang.String type,
                                   java.lang.String logfile)
Loads the results for a question from a log file.

Parameters:
question - the question
type - the type of question ("factoid", "list" or "other")
logfile - the log file
Returns:
array of results or null if the question could not be found in the log file

saveAnswers

public static boolean saveAnswers(java.lang.String filename,
                                  TRECAnswer[] answers,
                                  boolean[] correct,
                                  java.lang.String runTag)
Appends answers to an output file.

Parameters:
filename - the output file
answers - the answers
correct - for each answer a flag that is true iff the answer is correct or null if the answers were not evaluated
runTag - tag that uniquely identifies the run
Returns:
true, iff the answers could be saved