info.ephyra.io
Class MsgPrinter

java.lang.Object
  extended by info.ephyra.io.MsgPrinter

public class MsgPrinter
extends java.lang.Object

Prints out status and error messages as well as results to the standard output. The output of status and error messages can be enabled or disabled. By default, all status and error messages are disabled.

All print methods are thread-save to avoid overlapping outputs from different threads.

Version:
2007-07-14
Author:
Nico Schlaefer

Field Summary
private static boolean errorMsgs
          True, iff error messages are enabled.
private static java.io.BufferedWriter logWriter
           
private static boolean statusMsgs
          True, iff status messages are enabled.
private static java.text.SimpleDateFormat timestampFormatter
          the DateFormat object used in getTimespamt
 
Constructor Summary
MsgPrinter()
           
 
Method Summary
static void enableErrorMsgs(boolean enable)
          Enables or disables error messages.
static void enableStatusMsgs(boolean enable)
          Enables or disables status messages.
static java.lang.String getTimestamp()
           
static void printAnalyzingQuestion()
          Prints out the status message that the engine is in the question analysis phase.
static void printAnswers(Result[] results)
          Prints out the answers.
static void printAnswerTypes(java.lang.String[] ats)
          Prints out the answer types.
static void printAnswerUnknown()
          Prints out an "answer unknown" message.
static void printAssessingPatterns()
          Prints out the status message that patterns are being assessed.
static void printErrorMsg(java.lang.String error)
          Prints out an arbitrary error message.
static void printErrorMsgTimestamp(java.lang.String error)
          Prints out an arbitrary error message with a timestamp.
static void printExtractingPatterns()
          Prints out the status message that patterns are being extracted.
static void printFetchingPassages()
          Prints out the status message that text passages are being fetched.
static void printFilterFinished(Filter filter, int resCount)
          Prints out the status message that a filter has finished its work in the answer selection phase, plus the number of remaining results.
static void printFilteringPatterns()
          Prints out the status message that patterns are being filtered.
static void printFilterStarted(Filter filter, int resCount)
          Prints out the status message that a filter has started its work in the answer selection phase, plus the number of results passed to the filter.
static void printFormingQueries()
          Prints out the status message that queries are being formed.
static void printGeneratingQueries()
          Prints out the status message that the engine is in the query generation phase.
static void printHttpError(java.lang.String error)
          Prints out an HTTP error message.
static void printInitializing()
          Prints out the status message that the engine is in the initialization phase.
static void printInterpretations(QuestionInterpretation[] qis)
          Prints out the interpretations of a question.
static void printInterpretingQuestions()
          Prints out the status message that the questions are being interpreted.
static void printLoadingPatterns()
          Prints out the status message that patterns are being loaded.
static void printLoadingTRECData()
          Prints out the status message that the TREC data is being loaded.
private static void printMessage(java.lang.String message)
          print a message
static void printNormalization(java.lang.String qn)
          Prints out the normalization of a question.
static void printPredicates(Predicate[] ps)
          Prints out the predicates in a question.
static void printQueryStrings(Query[] queries)
          Prints out query strings.
static void printQuestion(java.lang.String question)
          Prints out a question.
static void printQuestionPrompt()
          Prints a prompt for a question.
static void printQuestionString(java.lang.String qs)
          Prints out the question string.
static void printResolvedQuestion(java.lang.String res)
          Prints out the question string with resolved coreferences.
static void printResolvingCoreferences()
          Prints out the status message that the engine is in the coreference resolution phase.
static void printSavingPatterns()
          Prints out the status message that patterns are being saved.
static void printSearchError(java.lang.Exception e)
          Prints out a search error message.
static void printSearching()
          Prints out the status message that the engine is in the search phase.
static void printSelectingAnswers()
          Prints out the status message that the engine is in the answer selection phase.
static void printStatusMsg(java.lang.String status)
          Prints out an arbitrary status message.
static void printStatusMsgTimestamp(java.lang.String status)
          Prints out an arbitrary status message with a timestamp.
static void printTarget(java.lang.String target)
          Prints out a target.
static void printUsage(java.lang.String instr)
          Prints out instructions on how to use the program.
static void setLogFile(java.lang.String logFile)
          set the log file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statusMsgs

private static boolean statusMsgs
True, iff status messages are enabled.


errorMsgs

private static boolean errorMsgs
True, iff error messages are enabled.


timestampFormatter

private static java.text.SimpleDateFormat timestampFormatter
the DateFormat object used in getTimespamt


logWriter

private static java.io.BufferedWriter logWriter
Constructor Detail

MsgPrinter

public MsgPrinter()
Method Detail

enableStatusMsgs

public static void enableStatusMsgs(boolean enable)
Enables or disables status messages.

Parameters:
enable - true to enable status messages, false to disable them

enableErrorMsgs

public static void enableErrorMsgs(boolean enable)
Enables or disables error messages.

Parameters:
enable - true to enable error messages, false to disable them

printStatusMsg

public static void printStatusMsg(java.lang.String status)
Prints out an arbitrary status message.

Parameters:
status - a status message

printStatusMsgTimestamp

public static void printStatusMsgTimestamp(java.lang.String status)
Prints out an arbitrary status message with a timestamp.

Parameters:
status - a status message

printTarget

public static void printTarget(java.lang.String target)
Prints out a target.

Parameters:
target - a target

printQuestion

public static void printQuestion(java.lang.String question)
Prints out a question.

Parameters:
question - a question

printInitializing

public static void printInitializing()
Prints out the status message that the engine is in the initialization phase.


printResolvingCoreferences

public static void printResolvingCoreferences()
Prints out the status message that the engine is in the coreference resolution phase.


printAnalyzingQuestion

public static void printAnalyzingQuestion()
Prints out the status message that the engine is in the question analysis phase.


printGeneratingQueries

public static void printGeneratingQueries()
Prints out the status message that the engine is in the query generation phase.


printSearching

public static void printSearching()
Prints out the status message that the engine is in the search phase.


printSelectingAnswers

public static void printSelectingAnswers()
Prints out the status message that the engine is in the answer selection phase.


printLoadingTRECData

public static void printLoadingTRECData()
Prints out the status message that the TREC data is being loaded.


printInterpretingQuestions

public static void printInterpretingQuestions()
Prints out the status message that the questions are being interpreted.


printFormingQueries

public static void printFormingQueries()
Prints out the status message that queries are being formed.


printFetchingPassages

public static void printFetchingPassages()
Prints out the status message that text passages are being fetched.


printExtractingPatterns

public static void printExtractingPatterns()
Prints out the status message that patterns are being extracted.


printSavingPatterns

public static void printSavingPatterns()
Prints out the status message that patterns are being saved.


printLoadingPatterns

public static void printLoadingPatterns()
Prints out the status message that patterns are being loaded.


printAssessingPatterns

public static void printAssessingPatterns()
Prints out the status message that patterns are being assessed.


printFilteringPatterns

public static void printFilteringPatterns()
Prints out the status message that patterns are being filtered.


printQuestionString

public static void printQuestionString(java.lang.String qs)
Prints out the question string.

Parameters:
qs - question string

printResolvedQuestion

public static void printResolvedQuestion(java.lang.String res)
Prints out the question string with resolved coreferences.

Parameters:
res - resolved question string

printNormalization

public static void printNormalization(java.lang.String qn)
Prints out the normalization of a question.

Parameters:
qn - question normalization

printAnswerTypes

public static void printAnswerTypes(java.lang.String[] ats)
Prints out the answer types.

Parameters:
ats - answer types

printInterpretations

public static void printInterpretations(QuestionInterpretation[] qis)
Prints out the interpretations of a question.

Parameters:
qis - QuestionInterpretation array

printPredicates

public static void printPredicates(Predicate[] ps)
Prints out the predicates in a question.

Parameters:
ps - Predicate array

printQueryStrings

public static void printQueryStrings(Query[] queries)
Prints out query strings.

Parameters:
queries - Query objects

printFilterStarted

public static void printFilterStarted(Filter filter,
                                      int resCount)
Prints out the status message that a filter has started its work in the answer selection phase, plus the number of results passed to the filter.

Parameters:
filter - the filter that has just started its work
resCount - the number of results passed to the filter

printFilterFinished

public static void printFilterFinished(Filter filter,
                                       int resCount)
Prints out the status message that a filter has finished its work in the answer selection phase, plus the number of remaining results.

Parameters:
filter - the filter that has just finished its work
resCount - the number of remaining results

printErrorMsg

public static void printErrorMsg(java.lang.String error)
Prints out an arbitrary error message.

Parameters:
error - an error message

printErrorMsgTimestamp

public static void printErrorMsgTimestamp(java.lang.String error)
Prints out an arbitrary error message with a timestamp.

Parameters:
error - an error message

printSearchError

public static void printSearchError(java.lang.Exception e)
Prints out a search error message.

Parameters:
e - an Exception that has been thrown

printHttpError

public static void printHttpError(java.lang.String error)
Prints out an HTTP error message.

Parameters:
error - an error msg

printUsage

public static void printUsage(java.lang.String instr)
Prints out instructions on how to use the program.

Parameters:
instr - instructions

printQuestionPrompt

public static void printQuestionPrompt()
Prints a prompt for a question.


printAnswers

public static void printAnswers(Result[] results)
Prints out the answers.

Parameters:
results - Result objects

printAnswerUnknown

public static void printAnswerUnknown()
Prints out an "answer unknown" message.


getTimestamp

public static java.lang.String getTimestamp()
Returns:
a timestamp String for logging

printMessage

private static void printMessage(java.lang.String message)
print a message

Parameters:
message - the message to print

setLogFile

public static void setLogFile(java.lang.String logFile)
set the log file

Parameters:
logFile - the path and name of the filte to write log entries to (in addition to System.out)