sg.edu.nus.comp.nlp.ims.feature
Class CPOSFeatureExtractor

java.lang.Object
  extended by sg.edu.nus.comp.nlp.ims.feature.CPOSFeatureExtractor
All Implemented Interfaces:
IFeatureExtractor

public class CPOSFeatureExtractor
extends java.lang.Object
implements IFeatureExtractor

POS feature extractor.

Author:
zhongzhi

Field Summary
protected static int g_PIDX
           
protected  ICorpus m_Corpus
           
protected  IFeature m_CurrentFeature
           
protected  int m_Index
           
protected  int m_IndexInSentence
           
protected  int m_InstanceLength
           
protected  int m_POSIndex
           
protected  java.util.ArrayList<java.lang.Integer> m_POSs
           
protected  ISentence m_Sentence
           
 
Constructor Summary
CPOSFeatureExtractor()
          constructor
CPOSFeatureExtractor(java.util.ArrayList<java.lang.Integer> p_Indice)
          constructor
 
Method Summary
protected  java.lang.String formPOSName(int p_Index)
          form POS feature name
 java.lang.String getCurrentInstanceID()
          get the ID of current instance to be extracted
protected  IFeature getNext()
          get the next feature of current instance
protected  java.lang.String getPOS(int p_Index)
          get the part-of-speech of item p_Index + m_IndexInSentence
 boolean hasNext()
          whether has at least one more feature
 IFeature next()
          get the next feature
 boolean restart()
          restart the iterator
 boolean setCorpus(ICorpus p_Corpus)
          set corpus to be extracted
 boolean setCurrentInstance(int p_Index)
          set the index of instance which to be extracted from corpus
protected  boolean validIndex(int p_Index)
          check the validity of index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_POSs

protected java.util.ArrayList<java.lang.Integer> m_POSs

m_Corpus

protected ICorpus m_Corpus

m_Index

protected int m_Index

m_Sentence

protected ISentence m_Sentence

m_IndexInSentence

protected int m_IndexInSentence

m_InstanceLength

protected int m_InstanceLength

m_POSIndex

protected int m_POSIndex

m_CurrentFeature

protected IFeature m_CurrentFeature

g_PIDX

protected static int g_PIDX
Constructor Detail

CPOSFeatureExtractor

public CPOSFeatureExtractor(java.util.ArrayList<java.lang.Integer> p_Indice)
constructor

Parameters:
p_Indice - pos tag interested

CPOSFeatureExtractor

public CPOSFeatureExtractor()
constructor

Method Detail

getCurrentInstanceID

public java.lang.String getCurrentInstanceID()
Description copied from interface: IFeatureExtractor
get the ID of current instance to be extracted

Specified by:
getCurrentInstanceID in interface IFeatureExtractor
Returns:
instance id

hasNext

public boolean hasNext()
Description copied from interface: IFeatureExtractor
whether has at least one more feature

Specified by:
hasNext in interface IFeatureExtractor
Returns:
has or not

getNext

protected IFeature getNext()
get the next feature of current instance

Returns:
feature

getPOS

protected java.lang.String getPOS(int p_Index)
get the part-of-speech of item p_Index + m_IndexInSentence

Parameters:
p_Index - index
Returns:
feature value

validIndex

protected boolean validIndex(int p_Index)
check the validity of index

Parameters:
p_Index - index
Returns:
valid or not

formPOSName

protected java.lang.String formPOSName(int p_Index)
form POS feature name

Parameters:
p_Index - index
Returns:
feature name

next

public IFeature next()
Description copied from interface: IFeatureExtractor
get the next feature

Specified by:
next in interface IFeatureExtractor
Returns:
feature

restart

public boolean restart()
Description copied from interface: IFeatureExtractor
restart the iterator

Specified by:
restart in interface IFeatureExtractor
Returns:
success or not

setCorpus

public boolean setCorpus(ICorpus p_Corpus)
Description copied from interface: IFeatureExtractor
set corpus to be extracted

Specified by:
setCorpus in interface IFeatureExtractor
Parameters:
p_Corpus - corpus to be extracted
Returns:
set success or not

setCurrentInstance

public boolean setCurrentInstance(int p_Index)
Description copied from interface: IFeatureExtractor
set the index of instance which to be extracted from corpus

Specified by:
setCurrentInstance in interface IFeatureExtractor
Parameters:
p_Index - instance index
Returns:
set success or not