sg.edu.nus.comp.nlp.ims.classifier
Class CWekaEvaluator

java.lang.Object
  extended by sg.edu.nus.comp.nlp.ims.classifier.CWekaEvaluator
All Implemented Interfaces:
IEvaluator
Direct Known Subclasses:
CPreLoadWekaEvaluator

public class CWekaEvaluator
extends java.lang.Object
implements IEvaluator

call weka-3.2.3 classifier to evaluate instances in a lexelt.

Author:
zhongzhi

Nested Class Summary
 class CWekaEvaluator.ResultInfo
          weka result
 
Field Summary
protected static java.util.regex.Pattern LEXELTPATTERN
           
protected  int m_ClassIndex
           
protected  java.lang.String m_ModelDir
           
protected  ISenseIndex m_SenseIndex
           
protected  java.lang.String m_StatDir
           
protected  java.lang.String m_UnknownSense
           
 
Constructor Summary
CWekaEvaluator()
          default constructor
CWekaEvaluator(java.lang.String p_StatDir, java.lang.String p_ModelDir)
          constructor with some parameters
CWekaEvaluator(java.lang.String p_StatDir, java.lang.String p_ModelDir, int p_ClassIndex)
          constructor with some parameters
CWekaEvaluator(java.lang.String p_StatDir, java.lang.String p_ModelDir, int p_ClassIndex, java.lang.String p_UnknownSense)
          constructor with some parameters
 
Method Summary
 java.lang.Object evaluate(java.lang.Object p_Lexelt)
          evaluate p_Lexelt
protected  weka.classifiers.Classifier getModel(java.lang.String p_LexeltID)
          get weka model
protected  IStatistic getStatistic(java.lang.String p_LexeltID)
          get statistic for lexelt
 void setOptions(java.lang.String[] p_Options)
          set options
 void setSenseIndex(ISenseIndex p_SenseIndex)
          set sense index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_StatDir

protected java.lang.String m_StatDir

m_ModelDir

protected java.lang.String m_ModelDir

m_ClassIndex

protected int m_ClassIndex

m_SenseIndex

protected ISenseIndex m_SenseIndex

m_UnknownSense

protected java.lang.String m_UnknownSense

LEXELTPATTERN

protected static java.util.regex.Pattern LEXELTPATTERN
Constructor Detail

CWekaEvaluator

public CWekaEvaluator()
default constructor


CWekaEvaluator

public CWekaEvaluator(java.lang.String p_StatDir,
                      java.lang.String p_ModelDir)
constructor with some parameters

Parameters:
p_StatDir - statistic directory
p_ModelDir - model directory

CWekaEvaluator

public CWekaEvaluator(java.lang.String p_StatDir,
                      java.lang.String p_ModelDir,
                      int p_ClassIndex)
constructor with some parameters

Parameters:
p_StatDir - statistic directory
p_ModelDir - model directory
p_ClassIndex - class index

CWekaEvaluator

public CWekaEvaluator(java.lang.String p_StatDir,
                      java.lang.String p_ModelDir,
                      int p_ClassIndex,
                      java.lang.String p_UnknownSense)
constructor with some parameters

Parameters:
p_StatDir - statistic directory
p_ModelDir - model directory
p_ClassIndex - class index
p_UnknownSense - unknown sense
Method Detail

evaluate

public java.lang.Object evaluate(java.lang.Object p_Lexelt)
                          throws java.lang.Exception
Description copied from interface: IEvaluator
evaluate p_Lexelt

Specified by:
evaluate in interface IEvaluator
Parameters:
p_Lexelt - lexelt
Returns:
evaluation result
Throws:
java.lang.Exception - evaluation exception

getStatistic

protected IStatistic getStatistic(java.lang.String p_LexeltID)
get statistic for lexelt

Parameters:
p_LexeltID - lexelt id
Returns:
statistic

getModel

protected weka.classifiers.Classifier getModel(java.lang.String p_LexeltID)
                                        throws java.io.IOException,
                                               java.lang.ClassNotFoundException
get weka model

Parameters:
p_LexeltID - lexelt id
Returns:
weka classifier
Throws:
java.io.IOException - io exception
java.lang.ClassNotFoundException - class not found

setOptions

public void setOptions(java.lang.String[] p_Options)
Description copied from interface: IEvaluator
set options

Specified by:
setOptions in interface IEvaluator
Parameters:
p_Options - options

setSenseIndex

public void setSenseIndex(ISenseIndex p_SenseIndex)
Description copied from interface: IEvaluator
set sense index

Specified by:
setSenseIndex in interface IEvaluator
Parameters:
p_SenseIndex - sense index