gr.demokritos.iit.jinsect.console
Class summaryGenericEvaluator

java.lang.Object
  extended by gr.demokritos.iit.jinsect.console.summaryGenericEvaluator

public class summaryGenericEvaluator
extends java.lang.Object

A generic class for summary evaluation, which can host many different methods, through a single interface.


Field Summary
protected  java.lang.String ComparatorClass
           
protected  java.lang.Integer Dist
           
protected  java.lang.String DocumentClass
           
protected  java.util.Hashtable hModelCache
           
protected  java.util.Hashtable hNModelCache
           
protected  java.lang.String ModelDir
           
protected  java.lang.Integer NMax
           
protected  java.lang.Integer NMin
           
protected  java.lang.String OutFile
           
protected  java.util.concurrent.Semaphore OutputSemaphore
           
protected  boolean Progress
           
protected  boolean Silent
           
protected  java.lang.String SummaryDir
           
protected  java.lang.Integer Threads
           
 
Constructor Summary
summaryGenericEvaluator(java.util.concurrent.Semaphore sOutputSemaphore, int iNMin, int iNMax, int iDist, int iThreads, java.lang.String sOutFile, java.lang.String sSummaryDir, java.lang.String sModelDir, java.lang.String sDocumentClass, java.lang.String sComparatorClass, boolean bSilent, boolean bProgress)
          Creates a summaryGenericEvaluator, given a document class name, a comparator class name and a set of parameters indicating how to perform the evaluation.
summaryGenericEvaluator(java.lang.String[] args)
          Creates a new instance of summaryEvaluator, given an array of command-line like parameters.
 
Method Summary
protected  SimilarityArray calcSimilarityMeasures(CategorizedFileEntry cfeCur, java.util.List dsModelSet, boolean bOutput, java.io.PrintStream pOut, java.util.concurrent.Semaphore sSem, java.lang.String sDocumentClass, java.lang.String sEvaluatorClass, int NGramSize_Min, int NGramSize_Max, int Dmax, boolean bSilent)
          Calculates similarity measures between a file entry and a set of model documents.
protected  SimilarityArray calcSimilarityMeasures(CategorizedFileEntry cfeCur, java.util.List dsModelSet, boolean bOutput, java.util.concurrent.Semaphore sSem)
          Calculates similarity measures between a file entry and a set of model documents, using default representation (NGramDocument) and default comparator (StandardDocumentComparator) classes.
protected  void doOptimizedEval(java.util.concurrent.Semaphore sSem, java.io.PrintStream pOverallResultsOutStream, int NGramSize_Min, int NGramSize_Max, int Dmax, java.lang.String sSummaryDir, java.lang.String sModelDir, int iThreads, java.lang.String DocumentClass, java.lang.String ComparatorClass, boolean bSilent, boolean bProgress)
          Performs optimized evaluation of the documents in given dirs, given a document and a comparator class name, as well as a set of evaluation parameters.
protected  int getConstructor(java.lang.String sClassName, int iParams)
          Returns the index of the constructor of a class, given its parameter count.
static void main(java.lang.String[] args)
           
 void run()
          Executor of the evaluation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NMin

protected java.lang.Integer NMin

NMax

protected java.lang.Integer NMax

Dist

protected java.lang.Integer Dist

Threads

protected java.lang.Integer Threads

OutFile

protected java.lang.String OutFile

SummaryDir

protected java.lang.String SummaryDir

ModelDir

protected java.lang.String ModelDir

DocumentClass

protected java.lang.String DocumentClass

ComparatorClass

protected java.lang.String ComparatorClass

Silent

protected boolean Silent

Progress

protected boolean Progress

OutputSemaphore

protected java.util.concurrent.Semaphore OutputSemaphore

hModelCache

protected java.util.Hashtable hModelCache

hNModelCache

protected java.util.Hashtable hNModelCache
Constructor Detail

summaryGenericEvaluator

public summaryGenericEvaluator(java.lang.String[] args)
Creates a new instance of summaryEvaluator, given an array of command-line like parameters.


summaryGenericEvaluator

public summaryGenericEvaluator(java.util.concurrent.Semaphore sOutputSemaphore,
                               int iNMin,
                               int iNMax,
                               int iDist,
                               int iThreads,
                               java.lang.String sOutFile,
                               java.lang.String sSummaryDir,
                               java.lang.String sModelDir,
                               java.lang.String sDocumentClass,
                               java.lang.String sComparatorClass,
                               boolean bSilent,
                               boolean bProgress)
Creates a summaryGenericEvaluator, given a document class name, a comparator class name and a set of parameters indicating how to perform the evaluation. The document class can be any class that inherits from ILoadableTextPrint, while the comparator can be any offspring of SimilarityComparatorListener.

See Also:
ILoadableTextPrint, SimilarityComparatorListener
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

doOptimizedEval

protected void doOptimizedEval(java.util.concurrent.Semaphore sSem,
                               java.io.PrintStream pOverallResultsOutStream,
                               int NGramSize_Min,
                               int NGramSize_Max,
                               int Dmax,
                               java.lang.String sSummaryDir,
                               java.lang.String sModelDir,
                               int iThreads,
                               java.lang.String DocumentClass,
                               java.lang.String ComparatorClass,
                               boolean bSilent,
                               boolean bProgress)
Performs optimized evaluation of the documents in given dirs, given a document and a comparator class name, as well as a set of evaluation parameters.

Parameters:
sSem - A semaphore that ensures that the output is provided consistently.
pOverallResultsOutStream - The output stream for results.
NGramSize_Min - The min n-gram rank to take into account, if applicable to the method.
NGramSize_Max - The max n-gram rank to take into account, if applicable to the method.
Dmax - The n-gram neighbourhood distance to use, if applicable to the method.
sSummaryDir - The peer summary base directory.
sModelDir - The model summaries base directory.
iThreads - The umber of threads to use for parallel computation.
DocumentClass - The dodcment class by which to represent texts.
ComparatorClass - The comparator class to use for the evaluation.
bSilent - If true, no debug messages are output.
bProgress - If true, indicates that progress indication should be output, even in silent mode.

run

public void run()
Executor of the evaluation.


calcSimilarityMeasures

protected SimilarityArray calcSimilarityMeasures(CategorizedFileEntry cfeCur,
                                                 java.util.List dsModelSet,
                                                 boolean bOutput,
                                                 java.util.concurrent.Semaphore sSem)
Calculates similarity measures between a file entry and a set of model documents, using default representation (NGramDocument) and default comparator (StandardDocumentComparator) classes.


calcSimilarityMeasures

protected SimilarityArray calcSimilarityMeasures(CategorizedFileEntry cfeCur,
                                                 java.util.List dsModelSet,
                                                 boolean bOutput,
                                                 java.io.PrintStream pOut,
                                                 java.util.concurrent.Semaphore sSem,
                                                 java.lang.String sDocumentClass,
                                                 java.lang.String sEvaluatorClass,
                                                 int NGramSize_Min,
                                                 int NGramSize_Max,
                                                 int Dmax,
                                                 boolean bSilent)
Calculates similarity measures between a file entry and a set of model documents.

Parameters:
cfeCur - The file entry to compare to models.
dsModelSet - The set of models to compare against.
bOutput - If true verbose output is selected.
pOut - The output stream for results.
sSem - The semaphore that assures consistent output.
sDocumentClass - The name of the document class to represent documents by. Should inherit from ILoadableTextPrint.
sEvaluatorClass - The name of the evaluator class to use. Should inherit from SimilarityComparatorListener.
NGramSize_Min - The min n-gram rank to use.
NGramSize_Max - The max n-gram rank to use.
bSilent - If true, minimal debug output is given.
Returns:
The result similarity array.

getConstructor

protected int getConstructor(java.lang.String sClassName,
                             int iParams)
Returns the index of the constructor of a class, given its parameter count.

Parameters:
sClassName - The class name of interest.
iParams - The parameter count to look for.
Returns:
The index of the constructor in the Class.forName(sClassName).getConstructors() array.