sg.edu.nus.comp.nlp.ims.io
Class CWekaLexeltWriter

java.lang.Object
  extended by sg.edu.nus.comp.nlp.ims.io.CWekaLexeltWriter
All Implemented Interfaces:
ILexeltWriter
Direct Known Subclasses:
CWekaSparseLexeltWriter

public class CWekaLexeltWriter
extends java.lang.Object
implements ILexeltWriter

convert instances in a lexelt to weka sparse instances format.

Author:
zhongzhi

Field Summary
protected static java.util.regex.Pattern CommaPattern
           
protected static java.util.regex.Pattern QuotPattern
           
 
Constructor Summary
CWekaLexeltWriter()
          default constructor
 
Method Summary
protected  java.lang.String amendValue(java.lang.String p_Value)
          amend feature value
protected  java.lang.String getFeatureVector(IInstance p_Instance, IStatistic p_Stat)
          generate the feature vector for one instance
protected  java.lang.String getHeader(ILexelt p_Lexelt)
          generate the head part of arff file
 java.lang.Object getInstances(ILexelt p_Lexelt)
          extract instances from p_iLexelt
 java.lang.String toString(ILexelt p_Lexelt)
          write lexelt to a string
 void write(java.lang.String p_FileName, ILexelt p_Lexelt)
          write information of p_iLexelt to p_FileName in some format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QuotPattern

protected static java.util.regex.Pattern QuotPattern

CommaPattern

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

CWekaLexeltWriter

public CWekaLexeltWriter()
default constructor

Method Detail

write

public void write(java.lang.String p_FileName,
                  ILexelt p_Lexelt)
           throws java.io.IOException,
                  java.lang.ClassNotFoundException
Description copied from interface: ILexeltWriter
write information of p_iLexelt to p_FileName in some format

Specified by:
write in interface ILexeltWriter
Parameters:
p_FileName - file name
p_Lexelt - lexelt
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString(ILexelt p_Lexelt)
                          throws java.lang.ClassNotFoundException
Description copied from interface: ILexeltWriter
write lexelt to a string

Specified by:
toString in interface ILexeltWriter
Parameters:
p_Lexelt - lexelt
Returns:
feature vector string
Throws:
java.lang.ClassNotFoundException

getInstances

public java.lang.Object getInstances(ILexelt p_Lexelt)
                              throws java.lang.ClassNotFoundException
Description copied from interface: ILexeltWriter
extract instances from p_iLexelt

Specified by:
getInstances in interface ILexeltWriter
Parameters:
p_Lexelt - lexelt
Returns:
instances
Throws:
java.lang.ClassNotFoundException

getHeader

protected java.lang.String getHeader(ILexelt p_Lexelt)
                              throws java.lang.ClassNotFoundException
generate the head part of arff file

Parameters:
p_Lexelt - lexelt
Returns:
arff head
Throws:
java.lang.ClassNotFoundException

getFeatureVector

protected java.lang.String getFeatureVector(IInstance p_Instance,
                                            IStatistic p_Stat)
generate the feature vector for one instance

Parameters:
p_Instance - instance
p_Stat - statistic of training instances
Returns:
feature vector

amendValue

protected java.lang.String amendValue(java.lang.String p_Value)
amend feature value

Parameters:
p_Value - feature value
Returns:
new value